Skip to content

Commit

Permalink
predator-regre/test-0095.c: fix undefined behavior
Browse files Browse the repository at this point in the history
The test started to hang with gcc-15 because the union was not fully
initialized.  Unlike with struct, there is no guarantee that the whole
union object will be initialized if a single member initializer is
specified.  So the test has been working only by accident.  This commit
makes the union static to enforce initialization.

Closes: #105
  • Loading branch information
kdudka committed Feb 1, 2025
1 parent c1c4c77 commit 94b78e7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/predator-regre/test-0095.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ union data {

int main()
{
union data d = {
static union data d = {
.number = 0L
};
__VERIFIER_plot(NULL);
Expand Down

0 comments on commit 94b78e7

Please sign in to comment.