rusty icon indicating copy to clipboard operation
rusty copied to clipboard

Duplicate symbol error when aliasing to same hardware address across multiple files

Open mhasel opened this issue 1 year ago • 0 comments

With #1301 we submitted a fix to prevent the pre-processor to generate multiple global variables mapping the same address variable, e.g.:

VAR_GLOBAL
    foo AT %IX1.2.3.4 : BOOL;
    bar AT %IX1.2.3.4 : BOOL;
END_VAR

While the above example now compiles without error, the following example will still fail to compile, reporting ambiguous global variables:

file1.st:

VAR_GLOBAL
    foo AT %IX1.2.3.4 : BOOL;
END_VAR

file2.st

VAR_GLOBAL
    bar AT %IX1.2.3.4 : BOOL;
END_VAR

This is due to the pre-processor only checking for already existing internally mangled globals on a unit-by-unit basis.

mhasel avatar Sep 10 '24 14:09 mhasel