[Bug c/91526] Unnecessary SSE and other instructions generated when compiling in C mode (vs. C++ mode)
joseph at codesourcery dot com
gcc-bugzilla@gcc.gnu.org
Fri Aug 23 16:29:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91526
--- Comment #7 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
There's more or less the same ABI question as in bug 91398 about whether
there is any constraint on the called function writing to the return value
slot in cases where it does not return normally.
Supposing the ABI allows the return value slot (register or memory) to be
written to by the called function even if it does not end up returning
normally, then the optimization in this bug would be valid, while that in
bug 91398 would not be valid if non-normal return is a possibility. (The
example in the present bug also doesn't allow non-normal return, unless we
say longjmp from a SIGFPE handler is OK - is -fnon-call-exceptions only
needed for language exceptions or also for longjmp?)
(Validity would also depend on it not affecting the observed address of
the variable "result" in such a way as to make it equal to the observed
address of some object in a calling function - but I expect the
interesting cases for this optimization are where the variable is only
stored to, not ones where addresses get compared, if it's even possible
for the same return value slot to get used in more than one function on
the call stack.)
More information about the Gcc-bugs
mailing list