Hi,
On 21 November 2017 at 18:23, Jeff Law <l...@redhat.com> wrote: > On 11/21/2017 06:52 AM, Jakub Jelinek wrote: >> Hi! >> >> The C++ FE now emits __builtin_unreachable () with BUILTINS_LOCATION >> on spots that return from functions/methods returning non-void without >> proper return. This breaks the -Wreturn-type warning, because we then >> don't see any return stmt without argument on the edges to exit, instead >> we see those __builtin_unreachable () calls at the end of blocks without >> successors. >> >> I wonder if the C++ FE addition of __builtin_unreachable () shouldn't be >> done only if (optimize). >> >> Anyway, this patch tweaks tree-cfg.c so that it recognizes those >> __builtin_unreachable () calls and reports the -Wreturn-type warning >> in those cases too (warning in the FE would be too early, we need to >> optimize away unreachable code). >> >> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? >> >> The patch regresses g++.dg/gomp/declare-simd-1.C, but given that it revealed >> a real bug, I'm not trying to work around it in the patch and will fix it up >> incrementally instead. >> >> 2017-11-21 Jakub Jelinek <ja...@redhat.com> >> >> PR c++/83045 >> * tree-cfg.c (pass_warn_function_return::execute): Formatting fix. >> Also warn if seen __builtin_unreachable () call with BUILTINS_LOCATION. >> Use LOCATION_LOCUS when comparing against UNKNOWN_LOCATION. >> >> * c-c++-common/pr61405.c (fn0, fn1): Add return stmts. >> * c-c++-common/Wlogical-op-2.c (fn): Likewise. >> * g++.dg/debug/pr53466.C: Add -Wno-return-type to dg-options. >> * g++.dg/opt/combine.C: Likewise. >> * g++.dg/ubsan/return-3.C: Likewise. >> * g++.dg/pr59445.C: Likewise. >> * g++.dg/pr49847.C: Likewise. >> * g++.dg/ipa/pr61800.C: Likewise. >> * g++.dg/ipa/pr63470.C: Likewise. >> * g++.dg/ipa/pr68672-1.C: Likewise. >> * g++.dg/pr58438.C: Likewise. >> * g++.dg/torture/pr59265.C: Likewise. >> * g++.dg/tree-ssa/ssa-dse-2.C: Likewise. >> * g++.old-deja/g++.eh/catch13.C: Likewise. >> * g++.old-deja/g++.eh/crash1.C: Likewise. >> * g++.dg/tm/pr60004.C: Expect -Wreturn-type warning. >> * g++.dg/torture/pr55740.C: Likewise. >> * g++.dg/torture/pr43257.C: Likewise. >> * g++.dg/torture/pr64280.C: Likewise. >> * g++.dg/torture/pr54684.C: Likewise. >> * g++.dg/torture/pr56694.C: Likewise. >> * g++.dg/torture/pr68470.C: Likewise. >> * g++.dg/torture/pr60648.C: Likewise. >> * g++.dg/torture/pr71281.C: Likewise. >> * g++.dg/torture/pr52772.C: Add -Wno-return-type dg-additional-options. >> * g++.dg/torture/pr64669.C: Likewise. >> * g++.dg/torture/pr58369.C: Likewise. >> * g++.dg/torture/pr33627.C: Likewise. >> * g++.dg/torture/predcom-1.C: Add >> #pragma GCC diagnostic ignored "-Wreturn-type". >> * g++.dg/lto/20090221_0.C: Likewise. >> * g++.dg/lto/20091026-1_1.C: Likewise. >> * g++.dg/lto/pr54625-1_1.C: Likewise. >> * g++.dg/warn/pr83045.C: New test. > OK. > jeff As an obvious follow-up, I have committed the usual fix to gcc.target/arm/pr56184.C (added -Wno-return-type). Christophe
diff --git a/gcc/testsuite/gcc.target/arm/pr56184.C b/gcc/testsuite/gcc.target/arm/pr56184.C index fd278d3..8244222 100644 --- a/gcc/testsuite/gcc.target/arm/pr56184.C +++ b/gcc/testsuite/gcc.target/arm/pr56184.C @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-skip-if "incompatible options" { ! { arm_thumb1_ok || arm_thumb2_ok } } } */ -/* { dg-options "-fno-short-enums -O2 -mthumb -march=armv7-a -mfpu=neon -mfloat-abi=softfp -mtune=cortex-a9 -fno-section-anchors" } */ +/* { dg-options "-fno-short-enums -O2 -mthumb -march=armv7-a -mfpu=neon -mfloat-abi=softfp -mtune=cortex-a9 -fno-section-anchors -Wno-return-type" } */ typedef unsigned int size_t; __extension__ typedef int __intptr_t;
2017-11-22 Christophe Lyon <christophe.l...@linaro.org> * gcc.target/arm/pr56184.C: Add -Wno-return-type to dg-options.