public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/107558] New: [10/11/12/13 Regression] ICE in fld_incomplete_type_of, at ipa-free-lang-data.cc:258
@ 2022-11-07 18:14 gscfq@t-online.de
  2022-11-08  9:30 ` [Bug c++/107558] [10/11/12/13 Regression] ICE in fld_incomplete_type_of with -fmerge-all-constants and openmp and LTO rguenth at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: gscfq@t-online.de @ 2022-11-07 18:14 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107558

            Bug ID: 107558
           Summary: [10/11/12/13 Regression] ICE in
                    fld_incomplete_type_of, at ipa-free-lang-data.cc:258
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gscfq@t-online.de
  Target Milestone: ---

Started with r9, between 20200508 and 20200612, reduced from file
llvm-project-llvmorg-14.0.6/clang/test/OpenMP/nvptx_lambda_capturing.cpp :


$ cat z1.cc
template <typename T>
int foo(const T &t) {
  #pragma omp target parallel
  t();
  return 0;
}
struct S {
  int a = 15;
  int foo() {
    auto &&L = [&]() { return a; };
#pragma omp target
    L();
#pragma omp target parallel
    L();
    return a + ::foo(L);
  }
} s;
int main(int argc, char **argv) {
  int &b = argc;
  int &&c = 1;
  int *d = &argc;
  int a;
  auto &&L = [&]() { return argc + b + c + reinterpret_cast<long int>(d) + a;
};
#pragma omp target firstprivate(argc) map(to : a)
  L();
#pragma omp target parallel
  L();
  return argc + s.foo();
}


$ cat z2.cc
  int a = 15;
  int foo() {
    auto &&L = [&]() { return a; };
#pragma omp target parallel
    L();
}


$ gcc-13-20221106 -c z2.cc -fopenmp -flto -fmerge-all-constants
z2.cc: In function 'int foo()':
z2.cc:6:1: warning: no return statement in function returning non-void
[-Wreturn-type]
    6 | }
      | ^
during IPA pass: *free_lang_data
z2.cc: At global scope:
z2.cc:6:1: internal compiler error: in fld_incomplete_type_of, at
ipa-free-lang-data.cc:258
0x1aa1387 fld_incomplete_type_of
        ../../gcc/ipa-free-lang-data.cc:257
0x1aa26dd fld_simplified_type
        ../../gcc/ipa-free-lang-data.cc:344
0x1aa26dd free_lang_data_in_decl
        ../../gcc/ipa-free-lang-data.cc:653
0x1aa26dd free_lang_data_in_cgraph
        ../../gcc/ipa-free-lang-data.cc:1068
0x1aa26dd free_lang_data
        ../../gcc/ipa-free-lang-data.cc:1109
0x1aa26dd execute
        ../../gcc/ipa-free-lang-data.cc:1176

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/107558] [10/11/12/13 Regression] ICE in fld_incomplete_type_of with -fmerge-all-constants and openmp and LTO
  2022-11-07 18:14 [Bug c++/107558] New: [10/11/12/13 Regression] ICE in fld_incomplete_type_of, at ipa-free-lang-data.cc:258 gscfq@t-online.de
@ 2022-11-08  9:30 ` rguenth at gcc dot gnu.org
  2022-11-21 12:31 ` [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 marxin at gcc dot gnu.org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-11-08  9:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107558

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |10.5

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [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
  2022-11-07 18:14 [Bug c++/107558] New: [10/11/12/13 Regression] ICE in fld_incomplete_type_of, at ipa-free-lang-data.cc:258 gscfq@t-online.de
  2022-11-08  9:30 ` [Bug c++/107558] [10/11/12/13 Regression] ICE in fld_incomplete_type_of with -fmerge-all-constants and openmp and LTO rguenth at gcc dot gnu.org
@ 2022-11-21 12:31 ` marxin at gcc dot gnu.org
  2022-11-23 12:18 ` jakub at gcc dot gnu.org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-11-21 12:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107558

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[10/11/12/13 Regression]    |[10/11/12/13 Regression]
                   |ICE in                      |ICE in
                   |fld_incomplete_type_of with |fld_incomplete_type_of with
                   |-fmerge-all-constants and   |-fmerge-all-constants and
                   |openmp and LTO              |openmp and LTO since
                   |                            |r11-16-ga2f32550a085984f
   Last reconfirmed|                            |2022-11-21
                 CC|                            |jason at gcc dot gnu.org,
                   |                            |marxin at gcc dot gnu.org
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r11-16-ga2f32550a085984f.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [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
  2022-11-07 18:14 [Bug c++/107558] New: [10/11/12/13 Regression] ICE in fld_incomplete_type_of, at ipa-free-lang-data.cc:258 gscfq@t-online.de
  2022-11-08  9:30 ` [Bug c++/107558] [10/11/12/13 Regression] ICE in fld_incomplete_type_of with -fmerge-all-constants and openmp and LTO rguenth at gcc dot gnu.org
  2022-11-21 12:31 ` [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 marxin at gcc dot gnu.org
@ 2022-11-23 12:18 ` jakub at gcc dot gnu.org
  2023-01-13 12:41 ` rguenth at gcc dot gnu.org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-11-23 12:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107558

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
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 mentioned 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 >= 2))
+            might add TREE_STATIC to aggregate variables.  */
+         && (TREE_STATIC (decl)
+             || (flag_merge_constants >= 2
+                 && AGGREGATE_TYPE_P (type))))
        {
          /* If a TREE_READONLY variable needs initialization
             at runtime, it is no longer readonly and we need to
?

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [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
  2022-11-07 18:14 [Bug c++/107558] New: [10/11/12/13 Regression] ICE in fld_incomplete_type_of, at ipa-free-lang-data.cc:258 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2022-11-23 12:18 ` jakub at gcc dot gnu.org
@ 2023-01-13 12:41 ` rguenth at gcc dot gnu.org
  2023-03-10 19:39 ` cvs-commit at gcc dot gnu.org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-01-13 12:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107558

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [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
  2022-11-07 18:14 [Bug c++/107558] New: [10/11/12/13 Regression] ICE in fld_incomplete_type_of, at ipa-free-lang-data.cc:258 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2023-01-13 12:41 ` rguenth at gcc dot gnu.org
@ 2023-03-10 19:39 ` cvs-commit at gcc dot gnu.org
  2023-03-10 19:46 ` [Bug c++/107558] [10/11/12 " jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-03-10 19:39 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107558

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:60b6f5c0a334db3f8f6dffaf0b9aab42fd5c54a2

commit r13-6597-g60b6f5c0a334db3f8f6dffaf0b9aab42fd5c54a2
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Mar 10 20:38:13 2023 +0100

    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.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/107558] [10/11/12 Regression] ICE in fld_incomplete_type_of with -fmerge-all-constants and openmp and LTO since r11-16-ga2f32550a085984f
  2022-11-07 18:14 [Bug c++/107558] New: [10/11/12/13 Regression] ICE in fld_incomplete_type_of, at ipa-free-lang-data.cc:258 gscfq@t-online.de
                   ` (4 preceding siblings ...)
  2023-03-10 19:39 ` cvs-commit at gcc dot gnu.org
@ 2023-03-10 19:46 ` jakub at gcc dot gnu.org
  2023-03-19  5:30 ` cvs-commit at gcc dot gnu.org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-03-10 19:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107558

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org
             Status|NEW                         |ASSIGNED
            Summary|[10/11/12/13 Regression]    |[10/11/12 Regression] ICE
                   |ICE in                      |in fld_incomplete_type_of
                   |fld_incomplete_type_of with |with -fmerge-all-constants
                   |-fmerge-all-constants and   |and openmp and LTO since
                   |openmp and LTO since        |r11-16-ga2f32550a085984f
                   |r11-16-ga2f32550a085984f    |

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed on the trunk so far.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/107558] [10/11/12 Regression] ICE in fld_incomplete_type_of with -fmerge-all-constants and openmp and LTO since r11-16-ga2f32550a085984f
  2022-11-07 18:14 [Bug c++/107558] New: [10/11/12/13 Regression] ICE in fld_incomplete_type_of, at ipa-free-lang-data.cc:258 gscfq@t-online.de
                   ` (5 preceding siblings ...)
  2023-03-10 19:46 ` [Bug c++/107558] [10/11/12 " jakub at gcc dot gnu.org
@ 2023-03-19  5:30 ` cvs-commit at gcc dot gnu.org
  2023-03-20 10:30 ` [Bug c++/107558] [10/11 " jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-03-19  5:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107558

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:2744af7ac0a6e46551556cdf5d6df2486e79ef3f

commit r12-9289-g2744af7ac0a6e46551556cdf5d6df2486e79ef3f
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Mar 10 20:38:13 2023 +0100

    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.

    (cherry picked from commit 60b6f5c0a334db3f8f6dffaf0b9aab42fd5c54a2)

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/107558] [10/11 Regression] ICE in fld_incomplete_type_of with -fmerge-all-constants and openmp and LTO since r11-16-ga2f32550a085984f
  2022-11-07 18:14 [Bug c++/107558] New: [10/11/12/13 Regression] ICE in fld_incomplete_type_of, at ipa-free-lang-data.cc:258 gscfq@t-online.de
                   ` (6 preceding siblings ...)
  2023-03-19  5:30 ` cvs-commit at gcc dot gnu.org
@ 2023-03-20 10:30 ` jakub at gcc dot gnu.org
  2023-05-02 20:15 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-03-20 10:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107558

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[10/11/12 Regression] ICE   |[10/11 Regression] ICE in
                   |in fld_incomplete_type_of   |fld_incomplete_type_of with
                   |with -fmerge-all-constants  |-fmerge-all-constants and
                   |and openmp and LTO since    |openmp and LTO since
                   |r11-16-ga2f32550a085984f    |r11-16-ga2f32550a085984f

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed for 12.3 too.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/107558] [10/11 Regression] ICE in fld_incomplete_type_of with -fmerge-all-constants and openmp and LTO since r11-16-ga2f32550a085984f
  2022-11-07 18:14 [Bug c++/107558] New: [10/11/12/13 Regression] ICE in fld_incomplete_type_of, at ipa-free-lang-data.cc:258 gscfq@t-online.de
                   ` (7 preceding siblings ...)
  2023-03-20 10:30 ` [Bug c++/107558] [10/11 " jakub at gcc dot gnu.org
@ 2023-05-02 20:15 ` cvs-commit at gcc dot gnu.org
  2023-05-03  9:32 ` [Bug c++/107558] [10 " jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-05-02 20:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107558

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:17125f2f898828bd21e6215d9063dbca094c7a04

commit r11-10723-g17125f2f898828bd21e6215d9063dbca094c7a04
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Mar 10 20:38:13 2023 +0100

    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.c (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.

    (cherry picked from commit 60b6f5c0a334db3f8f6dffaf0b9aab42fd5c54a2)

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/107558] [10 Regression] ICE in fld_incomplete_type_of with -fmerge-all-constants and openmp and LTO since r11-16-ga2f32550a085984f
  2022-11-07 18:14 [Bug c++/107558] New: [10/11/12/13 Regression] ICE in fld_incomplete_type_of, at ipa-free-lang-data.cc:258 gscfq@t-online.de
                   ` (8 preceding siblings ...)
  2023-05-02 20:15 ` cvs-commit at gcc dot gnu.org
@ 2023-05-03  9:32 ` jakub at gcc dot gnu.org
  2023-05-03 15:22 ` cvs-commit at gcc dot gnu.org
  2023-05-04  7:21 ` jakub at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-05-03  9:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107558

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[10/11 Regression] ICE in   |[10 Regression] ICE in
                   |fld_incomplete_type_of with |fld_incomplete_type_of with
                   |-fmerge-all-constants and   |-fmerge-all-constants and
                   |openmp and LTO since        |openmp and LTO since
                   |r11-16-ga2f32550a085984f    |r11-16-ga2f32550a085984f

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed for 11.4 as well.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/107558] [10 Regression] ICE in fld_incomplete_type_of with -fmerge-all-constants and openmp and LTO since r11-16-ga2f32550a085984f
  2022-11-07 18:14 [Bug c++/107558] New: [10/11/12/13 Regression] ICE in fld_incomplete_type_of, at ipa-free-lang-data.cc:258 gscfq@t-online.de
                   ` (9 preceding siblings ...)
  2023-05-03  9:32 ` [Bug c++/107558] [10 " jakub at gcc dot gnu.org
@ 2023-05-03 15:22 ` cvs-commit at gcc dot gnu.org
  2023-05-04  7:21 ` jakub at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-05-03 15:22 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107558

--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:71ddae709ba21af895622d70480f5ebce0779723

commit r10-11376-g71ddae709ba21af895622d70480f5ebce0779723
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Mar 10 20:38:13 2023 +0100

    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.c (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.

    (cherry picked from commit 60b6f5c0a334db3f8f6dffaf0b9aab42fd5c54a2)

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/107558] [10 Regression] ICE in fld_incomplete_type_of with -fmerge-all-constants and openmp and LTO since r11-16-ga2f32550a085984f
  2022-11-07 18:14 [Bug c++/107558] New: [10/11/12/13 Regression] ICE in fld_incomplete_type_of, at ipa-free-lang-data.cc:258 gscfq@t-online.de
                   ` (10 preceding siblings ...)
  2023-05-03 15:22 ` cvs-commit at gcc dot gnu.org
@ 2023-05-04  7:21 ` jakub at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-05-04  7:21 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107558

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed for 10.5 too.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2023-05-04  7:21 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-07 18:14 [Bug c++/107558] New: [10/11/12/13 Regression] ICE in fld_incomplete_type_of, at ipa-free-lang-data.cc:258 gscfq@t-online.de
2022-11-08  9:30 ` [Bug c++/107558] [10/11/12/13 Regression] ICE in fld_incomplete_type_of with -fmerge-all-constants and openmp and LTO rguenth at gcc dot gnu.org
2022-11-21 12:31 ` [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 marxin at gcc dot gnu.org
2022-11-23 12:18 ` jakub at gcc dot gnu.org
2023-01-13 12:41 ` rguenth at gcc dot gnu.org
2023-03-10 19:39 ` cvs-commit at gcc dot gnu.org
2023-03-10 19:46 ` [Bug c++/107558] [10/11/12 " jakub at gcc dot gnu.org
2023-03-19  5:30 ` cvs-commit at gcc dot gnu.org
2023-03-20 10:30 ` [Bug c++/107558] [10/11 " jakub at gcc dot gnu.org
2023-05-02 20:15 ` cvs-commit at gcc dot gnu.org
2023-05-03  9:32 ` [Bug c++/107558] [10 " jakub at gcc dot gnu.org
2023-05-03 15:22 ` cvs-commit at gcc dot gnu.org
2023-05-04  7:21 ` jakub at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).