https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109585
--- Comment #11 from Hector Martin ---
Giving a nonzero size to the `ZixBTreeIterFrame stack[]` member also avoids the
segfault, so this might be a flexible array member thing.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109585
--- Comment #10 from Andrew Pinski ---
If I change zix_btree_iter_is_end to:
ZIX_API bool
zix_btree_iter_is_end(const struct ZixBTreeIterImpl* const i)
{
if (!i)
return 1;
if (i->stack[0].node == NULL)
return 1;
return 0;
}
Then
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109585
--- Comment #9 from Hector Martin ---
Yes, a strict aliasing violation could explain the behavior of the optimizer
here... but given all the types are identical and there is no casting going on,
clearly there is no strict aliasing violation.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109585
--- Comment #8 from Andrew Pinski ---
Interesting compiling with the C++ front-end (with one minor change of adding a
cast to the malloc) does not seg fault at -O2.