From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5CEE73858CDA; Fri, 10 Mar 2023 19:39:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5CEE73858CDA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678477148; bh=eSq2aqhSGZPqdTAYJXg3P6n6Vg5bagCAMX0JMDk5kcY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=dDsmFBadVrVwX1g36ccXLV8LGs3C2mYwDsuuFLQaWixavgQJb1mI/JUYKIbqpXXVO 14LJgQhCg+QxUkB5J4dX4AcIjUhNwpM3ab9EnyYK4Ge17bEYN8SLjerBcuESvTfPBM A0ljJapRx0mdVYxMsF5RsuXl2vs7ZjTLdqJ1CBsM= From: "cvs-commit 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: Fri, 10 Mar 2023 19:39:08 +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: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 10.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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 --- Comment #3 from CVS Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:60b6f5c0a334db3f8f6dffaf0b9aab42fd5c54a2 commit r13-6597-g60b6f5c0a334db3f8f6dffaf0b9aab42fd5c54a2 Author: Jakub Jelinek Date: Fri Mar 10 20:38:13 2023 +0100 c++: Don't clear TREE_READONLY for -fmerge-all-constants for non-aggreg= ates [PR107558] The following testcase ICEs, because OpenMP lowering for shared clause on l variable with REFERENCE_TYPE creates POINTER_TYPE to REFERENCE_TYP= E. The reason is that the automatic variable has non-trivial construction (reference to a lambda) and -fmerge-all-constants is on and so TREE_READONLY isn't set - omp-low will handle automatic TREE_READONLY vars in shared specially and only copy to the construct and not back, while !TREE_READ= ONLY are assumed to be changeable. The PR91529 change rationale was that the gimplification can change some non-addressable automatic variables to TREE_STATIC with -fmerge-all-constants and therefore TREE_READONLY on them is undesirabl= e. But, the gimplifier does that only for aggregate variables: switch (TREE_CODE (type)) { case RECORD_TYPE: case UNION_TYPE: case QUAL_UNION_TYPE: case ARRAY_TYPE: and not for anything else. So, I think clearing TREE_READONLY for automatic integral or reference or pointer etc. vars for -fmerge-all-constants only is unnecessary. 2023-03-10 Jakub Jelinek PR c++/107558 * decl.cc (cp_finish_decl): Don't clear TREE_READONLY on automatic non-aggregate variables just because of -fmerge-all-constants. * g++.dg/gomp/pr107558.C: New test.=