https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118806

--- Comment #2 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
(In reply to Xi Ruoyao from comment #1)
> Maybe it can also be done if main is [[noreturn]]?
Not sure about that.

The proposed patch /sets/ [[noreturn]] provided the conditions are right, i.e.
-mno-call-main and main() doesn't have [[section]].  Rationale is to trigger a
warning when main() /does/ return, since there is no way to call exit() like
the current .init9 code does, and the code would go haywire like in the
testsuite where returning from main() is commonplace.

To date, one effect of [[noreturn]] is that no callee-saved regs are
pushed/popped.  That's also the case for OS_task, which is the default except
-mno-main-is-OS_task.

Thinking about it, [[noreturn]] -> -mno-call-main should work, though I wanted
to be conservative in order not to produce testsuite fallout, and let the user
be in control.

Reply via email to