From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 88585 invoked by alias); 21 Nov 2017 17:23:19 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 88574 invoked by uid 89); 21 Nov 2017 17:23:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=BAYES_00,KB_WAM_FROM_NAME_SINGLEWORD,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 21 Nov 2017 17:23:17 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9098C6E770; Tue, 21 Nov 2017 17:23:16 +0000 (UTC) Received: from localhost.localdomain (ovpn-112-12.rdu2.redhat.com [10.10.112.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 23A455C883; Tue, 21 Nov 2017 17:23:14 +0000 (UTC) Subject: Re: [PATCH] Fix up -Wreturn-type (PR c++/83045) To: Jakub Jelinek , Richard Biener , Jason Merrill Cc: gcc-patches@gcc.gnu.org References: <20171121135232.GW14653@tucnak> From: Jeff Law Message-ID: <62fa65f6-8e31-921e-00e4-6aac34eee17c@redhat.com> Date: Tue, 21 Nov 2017 17:29:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20171121135232.GW14653@tucnak> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2017-11/txt/msg01933.txt.bz2 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 > > 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