diff options
author | Jakub Jelinek <jakub@redhat.com> | 2023-03-10 20:38:13 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2023-03-10 20:38:13 +0100 |
commit | 60b6f5c0a334db3f8f6dffaf0b9aab42fd5c54a2 (patch) | |
tree | 95ca6b2bfe6591b68ab19f0886659ab67a820ef9 /libgcc | |
parent | 991f9eb2da3a268b7b08346761fa0078ab55f506 (diff) | |
download | gcc-60b6f5c0a334db3f8f6dffaf0b9aab42fd5c54a2.zip gcc-60b6f5c0a334db3f8f6dffaf0b9aab42fd5c54a2.tar.gz gcc-60b6f5c0a334db3f8f6dffaf0b9aab42fd5c54a2.tar.bz2 |
c++: Don't clear TREE_READONLY for -fmerge-all-constants for non-aggregates [PR107558]
The following testcase ICEs, because OpenMP lowering for shared clause
on l variable with REFERENCE_TYPE creates POINTER_TYPE to REFERENCE_TYPE.
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_READONLY
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 undesirable.
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 <jakub@redhat.com>
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.
Diffstat (limited to 'libgcc')
0 files changed, 0 insertions, 0 deletions