From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 056263854541; Wed, 23 Nov 2022 12:18:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 056263854541 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669205918; bh=FFgeNIbFdVBR+p8TZb7VKqcoHDXaaYpOUQAHrYNbTNA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=QJJjgG+tViE6MuXZDYPd2OipCqjw1TF4KMXEAJm7WaDMNv4J9dEbZHA3rExEF/Ayi fAcNZrYcBRxjRwJgjoEZsncff7INt+ee1yhOxzOETvyoEvUYrWPHVhN7HuLaP2Biys amZbkj5/nhBGpagaO9ektqul9Z4UC/CpdKOip/xU= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/107558] [10/11/12/13 Regression] ICE in fld_incomplete_type_of with -fmerge-all-constants and openmp and LTO since r11-16-ga2f32550a085984f Date: Wed, 23 Nov 2022 12:18:28 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: ice-on-valid-code, openmp X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 10.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107558 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #2 from Jakub Jelinek --- The reason is that omp-low.cc creates a pointer to reference type, because = an automatic variable with REFERENCE_TYPE is not TREE_READONLY. While we perhaps could tweak all spots in omp-low.cc that reference TREE_READONLY to check also for REFERENCE_TYPE, I think the reason mentione= d in r11-16-ga2f32550a085984f is never the case for non-aggregate types. So perhaps instead: --- gcc/cp/decl.cc.jj 2022-11-19 09:21:14.662439877 +0100 +++ gcc/cp/decl.cc 2022-11-23 13:12:31.866553152 +0100 @@ -8679,8 +8679,10 @@ cp_finish_decl (tree decl, tree init, bo if (var_definition_p /* With -fmerge-all-constants, gimplify_init_constructor - might add TREE_STATIC to the variable. */ - && (TREE_STATIC (decl) || flag_merge_constants >=3D 2)) + might add TREE_STATIC to aggregate variables. */ + && (TREE_STATIC (decl) + || (flag_merge_constants >=3D 2 + && AGGREGATE_TYPE_P (type)))) { /* If a TREE_READONLY variable needs initialization at runtime, it is no longer readonly and we need to ?=