>> With LTO all the code after __builtin_unreachable(); is gone, breaking
>> the project.
>
> Code after __builtin_unreachable() is unreachable, this not needed.
> If you claim a function is noreturn but there is a code path that can reach
> the end of such a function, your claim is obviously wrong, thus the warning.
>
> Note that the compiler has no knowledge on the magic of RST.CTRL.
> I don't know how the macro exactly expands, presumably it's just some
> inline assembler and SFR writes. This means that code execution resumes
> after the sequence, except you tell so. This is accomplished by
> __builtin_unreachable. It means "I never come here, any code after here
> is dead".

The issue is one of scope.  I expect the reach of __unreachable() to
be limited to the __noreturn__ function or at least the file that it
is contained in.

With LTO all code after __unreachable() in *all* files linked after it
(guessing about 30) are gone.  Does not seem correct.

_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
https://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to