https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122645
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to eczbek.void from comment #5)
> (In reply to Andrew Pinski from comment #1)
> > I am not even sure this is valid. It seg faults on aarch64 even with GCC
> > 10.2.0.
>
> The layout of thunk_struct is specifically for x86
Yes but since the layout is NOT documented nor said it will change it is
undefined IIRC. Plus as mentioned by Andreas, it changes even with
-fcf-protection=branch .
Oh also jumping into a statement expression is undefined too. so this is
undefined in a different way.
Oh jmp goes out of scope after the end of the statement expression so it is
undefined that way too.
There might be other things which cause this code to be undefined too.