https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81275
--- Comment #13 from Martin Liška <marxin at gcc dot gnu.org> --- (In reply to Tom de Vries from comment #12) > (In reply to Dmitry G. Dyachenko from comment #0) > > -fsanitize={address,undefined} unaffected > > FWIW, I've run into this with -fsanitize=address and gcc 7.3 (minimized from > gdb/gdbtypes.c): > ... > $ cat test.c > struct i > { > unsigned int i; > }; > typedef struct i si; > extern const si const1; > extern const si const2; > > si > foo (int c, int d) > { > si var = { 0 }; > > switch (c) > { > case 1: > switch (d) > { > case 2: > return var; > default: > return const1; > } > break; > default: > return const2; > } > } > $ g++-7 -O0 test.c -c -Wreturn-type -fsanitize=address > test.c: In function ‘si foo(int, int)’: > test.c:28:1: warning: control reaches end of non-void function > [-Wreturn-type] > } > ^ > $ g++-7 -O0 test.c -c -Wreturn-type > $ > ... Confirmed and fixed on trunk by my commit r254437, so please use a newer GCC.