From: Christophe Lyon <christophe.lyon@linaro.org>
To: Jeff Law <law@redhat.com>
Cc: Jakub Jelinek <jakub@redhat.com>,
Richard Biener <rguenther@suse.de>,
Jason Merrill <jason@redhat.com>,
"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Fix up -Wreturn-type (PR c++/83045)
Date: Wed, 22 Nov 2017 16:49:00 -0000 [thread overview]
Message-ID: <CAKdteOZfh=u7xDQS0Yt5aexeUpYCfgkwwoQ4iBvWZvfO03OT0Q@mail.gmail.com> (raw)
In-Reply-To: <62fa65f6-8e31-921e-00e4-6aac34eee17c@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 3250 bytes --]
Hi,
On 21 November 2017 at 18:23, Jeff Law <law@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 <jakub@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
[-- Attachment #2: pr56184.patch.txt --]
[-- Type: text/plain, Size: 700 bytes --]
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;
[-- Attachment #3: pr56184.chlog.txt --]
[-- Type: text/plain, Size: 125 bytes --]
2017-11-22 Christophe Lyon <christophe.lyon@linaro.org>
* gcc.target/arm/pr56184.C: Add -Wno-return-type to dg-options.
prev parent reply other threads:[~2017-11-22 16:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-21 13:57 Jakub Jelinek
2017-11-21 17:29 ` Jeff Law
2017-11-22 16:49 ` Christophe Lyon [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAKdteOZfh=u7xDQS0Yt5aexeUpYCfgkwwoQ4iBvWZvfO03OT0Q@mail.gmail.com' \
--to=christophe.lyon@linaro.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=jason@redhat.com \
--cc=law@redhat.com \
--cc=rguenther@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).