https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120918
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Summary|-Wreturn-type warning is |-Wreturn-type warning |confused by macro |location is seemly wrong CC| |pinskia at gcc dot gnu.org Last reconfirmed| |2025-07-05 Component|c++ |middle-end --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- So I don't think it is the macro which is causing the confusion but rather than the lambda: [/app/example.cpp:5:3] D.2986 = {CLOBBER(eos)}; That is where the warning is picking up the location from. Even this gives a bad location: ``` int f() { []{return 1;}() ? (void)1 : __builtin_abort(); } ``` : ``` <source>: In function 'int f()': <source>:3:3: warning: control reaches end of non-void function [-Wreturn-type] 3 | []{return 1;}() ? (void)1 : __builtin_abort(); | ^~~~~~~~~~~~~ ``` Confirmed. Using `-flifetime-dse=0 -fstack-reuse=none` gives the better location: ``` <source>: In function 'int f()': <source>:6:1: warning: control reaches end of non-void function [-Wreturn-type] 6 | } | ^ ``` I suspect pass_warn_function_return::execute should ignore CLOBBERS for location purposes.