Skip to content

REF_TO array is incorrectly generated #1623

@Angus-Bethke-Bachmann

Description

@Angus-Bethke-Bachmann

Describe the bug
REF_TO array is incorrectly generated, see the below example.

To Reproduce
Following function in PLC:

FUNCTION Util_PackBitsToDWORD : ErrorCode
VAR_INPUT
    ValueRef: REF_TO ARRAY [*] OF BOOL;
    StartIndex: INT := 0;
    Length: INT := 32;
    Offset: INT := 0;
END_VAR
VAR_OUTPUT
    Result: DWORD;
END_VAR
END_FUNCTION

which is generated into:

void Util_PackBitsToDWORD(ErrorCode *Util_PackBitsToDWORD, __Util_PackBitsToDWORD_ValueRef_ *ValueRef,
                          int16_t StartIndex, int16_t Length, int16_t Offset, uint32_t *Result);

The second argument will then lead to:
error: unknown type name '__Util_PackBitsToDWORD_ValueRef_'.

Expected behavior
From the above example, I would expect a bool* ValueRef to be generated instead of the __Util_PackBitsToDWORD_ValueRef_ *ValueRef.

Additional context
Originally reported by Guillaume.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingheader-generatorThis label is for issues that specifically affect the header generator sub process of the compiler.high-priority

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions