This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/60725] [-Wreturn-type] false positive in trivial switch


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

--- Comment #6 from Manuel LÃpez-IbÃÃez <manu at gcc dot gnu.org> ---
(In reply to Martin Sebor from comment #5)
> Not to complicate things too much, but reaching the closing } of a non-void
> function is valid in C.  What is not valid (i.e., has undefined behavior) is
> calling such a function and using its return value when none was provided
> (as in the program in comment #3).  The program in the Description, however,
> has well-defined behavior because f1's return value isn't used.

Good point. I don't know whether it is possible for the sanitizers to
distinguish between the two cases. 

Pretty sure it is not possible for the warning code, since at the time of
warning we know nothing of the callers (not even if there are any callers).

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]