Menu

#4063 New test tests/bug-3393-designated.c

open
nobody
None
other
5
4 days ago
2026-08-23
No

This test fails on aarch64 host:

results/host/tst_bug-3393-designated.out:6:--- FAIL: "Assertion failed" on v.y == 0 at /home/sdcc-builder/build/sdcc-build/orig/sdcc/support/regression/cases/../tests/bug-3393-designated.c:127
results/host/tst_bug-3393-designated.out:7:--- FAIL: "Assertion failed" on v.w == 0 at /home/sdcc-builder/build/sdcc-build/orig/sdcc/support/regression/cases/../tests/bug-3393-designated.c:128

But at first sight, it feels like the test is wrong:

union U {
    char c;
    struct {
        char x;
        char y;
        char w;
    };
};
…
          union U v = {.c = 5};

          ASSERT (v.c == 5);
          ASSERT (v.y == 0);
          ASSERT (v.w == 0);

We initialize the member c of the union. That leaves the struct uninitalized (though practically, x will share storage with c, so it will get the same value as c). But I don't see why y or w would be required to be initialized (to 0 or any other value).

Discussion

  • Philipp Klaus Krause

    • summary: New test tests/bug-3393-designated. --> New test tests/bug-3393-designated.c
     

Log in to post a comment.