Fixed a bug involving abbreviation of arrays of channels into arrays of channel-ends in the C++ backend
The array for the channel-ends was not being allocated storage, so the array (a pointer to some random location) was being written to and causing a seg-fault
This commit is contained in:
parent
6ff8e3b163
commit
a4f0e85c72
|
@ -621,9 +621,15 @@ cppintroduceSpec (A.Specification _ n (A.Proc _ sm fs p))
|
||||||
--A helper function for calling the wrapped functions:
|
--A helper function for calling the wrapped functions:
|
||||||
genParamList :: [A.Formal] -> CGen()
|
genParamList :: [A.Formal] -> CGen()
|
||||||
genParamList fs = infixComma $ map genParam fs
|
genParamList fs = infixComma $ map genParam fs
|
||||||
cppintroduceSpec (A.Specification _ n (A.Is _ am t@(A.Array _ (A.ChanEnd {})) (A.DirectedVariable
|
cppintroduceSpec (A.Specification _ n (A.Is _ am t@(A.Array ds c@(A.ChanEnd {})) dirV@(A.DirectedVariable
|
||||||
m dir v)))
|
m dir v)))
|
||||||
= do call genDecl am t n
|
= do t' <- if A.UnknownDimension `elem` ds
|
||||||
|
then do dirVT <- astTypeOf dirV
|
||||||
|
case dirVT of
|
||||||
|
A.Array ds' _ -> return $ A.Array ds' c
|
||||||
|
_ -> diePC m $ formatCode "Expected variable to be an array type, instead: %" dirVT
|
||||||
|
else return t
|
||||||
|
call genDeclaration t' n False
|
||||||
tell [";"]
|
tell [";"]
|
||||||
tell ["tockInitChan",if dir == A.DirInput then "in" else "out","Array("]
|
tell ["tockInitChan",if dir == A.DirInput then "in" else "out","Array("]
|
||||||
call genVariableAM v am
|
call genVariableAM v am
|
||||||
|
|
Loading…
Reference in New Issue
Block a user