www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24029] New: ImportC: symbol name clash on statement expressions

https://issues.dlang.org/show_bug.cgi?id=24029

          Issue ID: 24029
           Summary: ImportC: symbol name clash on statement expressions
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: dkorpel live.nl

Found in the test case of https://github.com/dlang/dmd/pull/15375 with multiple
asserts. Reduced:

```C
int x = 0;
int y = 0;

void a()
{
    (__extension__ ({ x += 2; })); // test.a.__dgliteral1
}

void b()
{
    (__extension__ ({ y += 1; })); // test.b.__dgliteral1
}

int main(void)
{
    a();
    b();
    __check(x == 2);
    __check(y == 1);
    return 0;
}
```

Output:
```
/usr/bin/ld: warning: size of symbol `__dgliteral1' changed from 20 in test.o
to 19 in test.o
```

And the test fails. Because it's ImportC, the __dgliteral symbols don't get
their function as a prefix in the mangle, so the symbols clash.

--
Jul 03 2023