From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 604433858D1E for ; Thu, 28 Apr 2022 05:46:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 604433858D1E Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-356-XSCIrKYkN764EQ_O4LjYZw-1; Thu, 28 Apr 2022 01:46:45 -0400 X-MC-Unique: XSCIrKYkN764EQ_O4LjYZw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E4B0C3804510; Thu, 28 Apr 2022 05:46:44 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 99D5F14682CA; Thu, 28 Apr 2022 05:46:44 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.16.1/8.16.1) with ESMTPS id 23S5kfnO3122343 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 28 Apr 2022 07:46:42 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.16.1/8.16.1/Submit) id 23S5keIc3122342; Thu, 28 Apr 2022 07:46:40 +0200 Date: Thu, 28 Apr 2022 07:46:40 +0200 From: Jakub Jelinek To: Jan Hubicka , Richard Biener Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] cgraph: Don't verify semantic_interposition flag for aliases [PR105399] Message-ID: Reply-To: Jakub Jelinek MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Apr 2022 05:46:48 -0000 Hi! The following testcase ICEs, because the ctors during cc1plus all have !opt_for_fn (decl, flag_semantic_interposition) - they have NULL DECL_FUNCTION_SPECIFIC_OPTIMIZATION (decl) and optimization_default_node is for -Ofast and so has flag_semantic_interposition cleared. During free lang data, we set DECL_FUNCTION_SPECIFIC_OPTIMIZATION (decl) for the ctor which has body (or for thunks), but don't touch it for aliases. During lto1 optimization_default_node reflects the lto1 flags which are -O2 rather than -Ofast and so has flag_semantic_interposition set, for the ctor which has body that makes no difference, but as the alias doesn't still have DECL_FUNCTION_SPECIFIC_OPTIMIZATION (decl) set, we now trigger this verification check. The following patch just doesn't verify it for aliases during lto1. Another possibility would be to set DECL_FUNCTION_SPECIFIC_OPTIMIZATION (decl) during free lang data even for aliases. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2022-04-28 Jakub Jelinek PR lto/105399 * cgraph.cc (cgraph_node::verify_node): Don't verify semantic_interposition flag against opt_for_fn (decl, flag_semantic_interposition) for aliases in lto1. * g++.dg/lto/pr105399_0.C: New test. --- gcc/cgraph.cc.jj 2022-04-20 09:24:12.194579146 +0200 +++ gcc/cgraph.cc 2022-04-27 11:53:52.102173154 +0200 @@ -3488,7 +3488,9 @@ cgraph_node::verify_node (void) "returns a pointer"); error_found = true; } - if (definition && externally_visible + if (definition + && externally_visible + && (!alias || thunk || !in_lto_p) && semantic_interposition != opt_for_fn (decl, flag_semantic_interposition)) { --- gcc/testsuite/g++.dg/lto/pr105399_0.C.jj 2022-04-27 11:54:25.659703199 +0200 +++ gcc/testsuite/g++.dg/lto/pr105399_0.C 2022-04-27 11:48:31.387664565 +0200 @@ -0,0 +1,9 @@ +// PR lto/105399 +// { dg-lto-do link } +// { dg-lto-options { { -fPIC -flto -Ofast } } } +// { dg-require-effective-target shared } +// { dg-require-effective-target fpic } +// { dg-extra-ld-options "-shared -O2" } + +struct S { S (); }; +S::S () {} Jakub