From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 83718 invoked by alias); 15 Nov 2017 08:07:39 -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 83708 invoked by uid 89); 15 Nov 2017 08:07:39 -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,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=no version=3.3.2 spammy=Wonder, family, HContent-Transfer-Encoding:8bit 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; Wed, 15 Nov 2017 08:07:37 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D14BB7EA8F; Wed, 15 Nov 2017 08:07:34 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-116-247.ams2.redhat.com [10.36.116.247]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 006F911E764; Wed, 15 Nov 2017 08:07:31 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id vAF87TY8025665; Wed, 15 Nov 2017 09:07:29 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id vAF87QrV025664; Wed, 15 Nov 2017 09:07:26 +0100 Date: Wed, 15 Nov 2017 08:23:00 -0000 From: Jakub Jelinek To: Martin =?utf-8?B?TGnFoWth?= Cc: Eric Botcazou , gcc-patches@gcc.gnu.org, Jason Merrill , Marek Polacek , Jonathan Wakely Subject: Re: [PATCH][RFC] Instrument function exit with __builtin_unreachable in C++. Message-ID: <20171115080726.GP14653@tucnak> Reply-To: Jakub Jelinek References: <31ddd79e-1152-9dd9-663b-acd8d1bcd4ab@suse.cz> <99de094c-0e98-f2f2-39a9-a7394e0604ad@redhat.com> <0d484e7b-782b-7c4c-cdda-723efffe15a5@suse.cz> <3785116.x86eWSSaOg@polaris> <20171106173358.GU14653@tucnak> <806d7d62-1de5-128e-67e6-4b740c70d3b4@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <806d7d62-1de5-128e-67e6-4b740c70d3b4@suse.cz> User-Agent: Mutt/1.7.1 (2016-10-04) X-IsSubscribed: yes X-SW-Source: 2017-11/txt/msg01165.txt.bz2 On Tue, Nov 07, 2017 at 11:08:58AM +0100, Martin Liška wrote: > > Hasn't it enabled it also for any other FEs other than C family and Fortran? > > Say jit, brig, go, lto?, ... > > I think better would be to remove the initialization to -1 and revert the > > fortran/options.c change, and instead use in the C family: > > if (!global_options_set.x_warn_return_type) > > warn_return_type = c_dialect_cxx (); > > > > Unless it for some reason doesn't work for -Wall or -W or similar. > > > > Hello. > > Sorry for the inconvenience, however using Jakub's approach really does not work properly > with -Wall. If -Wall had an underlying variable, then we could use: if (!global_options_set.x_warn_return_type && !global_options_set.x_warn_all) warn_return_type = c_dialect_cxx (); But we don't. Wonder if in addition to your patch or instead of it it wouldn't be safer (especially for FEs added in the future) to: /* If we see "return;" in some basic block, then we do reach the end without returning a value. */ - else if (warn_return_type + else if (warn_return_type > 0 && !TREE_NO_WARNING (fun->decl) && EDGE_COUNT (EXIT_BLOCK_PTR_FOR_FN (fun)->preds) > 0 && !VOID_TYPE_P (TREE_TYPE (TREE_TYPE (fun->decl)))) in tree-cfg.c. That change is preapproved if it works, and your patch if you want in addition to that is ok too. Jakub