public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/107001] New: ICE in expand_gimple_stmt_1, at cfgexpand.cc:4017
@ 2022-09-21 17:35 gscfq@t-online.de
  2022-09-22 19:11 ` [Bug c/107001] ICE in expand_gimple_stmt_1, at cfgexpand.cc:4017 since r9-3941-g28567c40e2c7c88e marxin at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: gscfq@t-online.de @ 2022-09-21 17:35 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 107001
           Summary: ICE in expand_gimple_stmt_1, at cfgexpand.cc:4017
           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, at -O0 :


$ cat z1.c
void bar (int *q);
void foo (int *p, int *q)
{
  #pragma omp taskgroup task_reduction (*: p[0])
  {
    #pragma omp taskgroup task_reduction (*: q[0])
    bar (q);
  }
}


$ gcc-13-20220918 -c z1.c -O0 -fopenmp -fexceptions
during RTL pass: expand
z1.c: In function 'foo':
z1.c:2:6: internal compiler error: in expand_gimple_stmt_1, at
cfgexpand.cc:4017
    2 | void foo (int *p, int *q)
      |      ^~~
0x9587db expand_gimple_stmt_1
        ../../gcc/cfgexpand.cc:4017
0x9587db expand_gimple_stmt
        ../../gcc/cfgexpand.cc:4044
0x95febf expand_gimple_basic_block
        ../../gcc/cfgexpand.cc:6096
0x962516 execute
        ../../gcc/cfgexpand.cc:6822

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

* [Bug c/107001] ICE in expand_gimple_stmt_1, at cfgexpand.cc:4017 since r9-3941-g28567c40e2c7c88e
  2022-09-21 17:35 [Bug c/107001] New: ICE in expand_gimple_stmt_1, at cfgexpand.cc:4017 gscfq@t-online.de
@ 2022-09-22 19:11 ` marxin at gcc dot gnu.org
  2022-09-23 12:04 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-09-22 19:11 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |marxin at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-09-22
     Ever confirmed|0                           |1
            Summary|ICE in                      |ICE in
                   |expand_gimple_stmt_1, at    |expand_gimple_stmt_1, at
                   |cfgexpand.cc:4017           |cfgexpand.cc:4017 since
                   |                            |r9-3941-g28567c40e2c7c88e

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r9-3941-g28567c40e2c7c88e, it was rejected before the revision.

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

* [Bug c/107001] ICE in expand_gimple_stmt_1, at cfgexpand.cc:4017 since r9-3941-g28567c40e2c7c88e
  2022-09-21 17:35 [Bug c/107001] New: ICE in expand_gimple_stmt_1, at cfgexpand.cc:4017 gscfq@t-online.de
  2022-09-22 19:11 ` [Bug c/107001] ICE in expand_gimple_stmt_1, at cfgexpand.cc:4017 since r9-3941-g28567c40e2c7c88e marxin at gcc dot gnu.org
@ 2022-09-23 12:04 ` jakub at gcc dot gnu.org
  2022-09-24  7:31 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-09-23 12:04 UTC (permalink / raw)
  To: gcc-bugs

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

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 53618
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53618&action=edit
gcc13-pr107001.patch

I think it is easiest to treat taskgroup like target data in that we don't
use GOMP_RETURN at the end for it, the end is added instead during
gimplification into try .. finally, and after omp lowering we don't really need
to care if something is or isn't nested in taskgroup.

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

* [Bug c/107001] ICE in expand_gimple_stmt_1, at cfgexpand.cc:4017 since r9-3941-g28567c40e2c7c88e
  2022-09-21 17:35 [Bug c/107001] New: ICE in expand_gimple_stmt_1, at cfgexpand.cc:4017 gscfq@t-online.de
  2022-09-22 19:11 ` [Bug c/107001] ICE in expand_gimple_stmt_1, at cfgexpand.cc:4017 since r9-3941-g28567c40e2c7c88e marxin at gcc dot gnu.org
  2022-09-23 12:04 ` jakub at gcc dot gnu.org
@ 2022-09-24  7:31 ` cvs-commit at gcc dot gnu.org
  2022-11-03  0:23 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-09-24  7:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:ad2aab5c816a6fd56b46210c0a4a4c6243da1de9

commit r13-2829-gad2aab5c816a6fd56b46210c0a4a4c6243da1de9
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Sat Sep 24 09:24:26 2022 +0200

    openmp: Fix ICE with taskgroup at -O0 -fexceptions [PR107001]

    The following testcase ICEs because with -O0 -fexceptions
GOMP_taskgroup_end
    call isn't directly followed by GOMP_RETURN statement, but there are some
    conditionals to handle exceptions and we fail to find the correct
GOMP_RETURN.

    The fix is to treat taskgroup similarly to target data, both of these
constructs
    emit a try { body } finally { end_call } around the construct's body during
    gimplification and we need to see proper construct nesting during
gimplification
    and omp lowering (including nesting of regions checks), but during omp
expansion
    we don't really need their nesting anymore, all we need is emit something
at
    the start of the region and the end of the region is the end API call we've
    already emitted during gimplification.  For target data, we weren't adding
    GOMP_RETURN statement during omp lowering, so after that pass it is treated
    merely like stand-alone omp directives.  This patch does the same for
    taskgroup too.

    2022-09-24  Jakub Jelinek  <jakub@redhat.com>

            PR c/107001
            * omp-low.cc (lower_omp_taskgroup): Don't add GOMP_RETURN statement
            at the end.
            * omp-expand.cc (build_omp_regions_1): Clarify
GF_OMP_TARGET_KIND_DATA
            is not stand-alone directive.  For GIMPLE_OMP_TASKGROUP, also don't
            update parent.
            (omp_make_gimple_edges) <case GIMPLE_OMP_TASKGROUP>: Reset
            cur_region back after new_omp_region.

            * c-c++-common/gomp/pr107001.c: New test.

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

* [Bug c/107001] ICE in expand_gimple_stmt_1, at cfgexpand.cc:4017 since r9-3941-g28567c40e2c7c88e
  2022-09-21 17:35 [Bug c/107001] New: ICE in expand_gimple_stmt_1, at cfgexpand.cc:4017 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2022-09-24  7:31 ` cvs-commit at gcc dot gnu.org
@ 2022-11-03  0:23 ` cvs-commit at gcc dot gnu.org
  2022-11-04  8:31 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-11-03  0:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 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:c8dc6b06daf910b758bb964116ada2c5070de764

commit r12-8885-gc8dc6b06daf910b758bb964116ada2c5070de764
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Sat Sep 24 09:24:26 2022 +0200

    openmp: Fix ICE with taskgroup at -O0 -fexceptions [PR107001]

    The following testcase ICEs because with -O0 -fexceptions
GOMP_taskgroup_end
    call isn't directly followed by GOMP_RETURN statement, but there are some
    conditionals to handle exceptions and we fail to find the correct
GOMP_RETURN.

    The fix is to treat taskgroup similarly to target data, both of these
constructs
    emit a try { body } finally { end_call } around the construct's body during
    gimplification and we need to see proper construct nesting during
gimplification
    and omp lowering (including nesting of regions checks), but during omp
expansion
    we don't really need their nesting anymore, all we need is emit something
at
    the start of the region and the end of the region is the end API call we've
    already emitted during gimplification.  For target data, we weren't adding
    GOMP_RETURN statement during omp lowering, so after that pass it is treated
    merely like stand-alone omp directives.  This patch does the same for
    taskgroup too.

    2022-09-24  Jakub Jelinek  <jakub@redhat.com>

            PR c/107001
            * omp-low.cc (lower_omp_taskgroup): Don't add GOMP_RETURN statement
            at the end.
            * omp-expand.cc (build_omp_regions_1): Clarify
GF_OMP_TARGET_KIND_DATA
            is not stand-alone directive.  For GIMPLE_OMP_TASKGROUP, also don't
            update parent.
            (omp_make_gimple_edges) <case GIMPLE_OMP_TASKGROUP>: Reset
            cur_region back after new_omp_region.

            * c-c++-common/gomp/pr107001.c: New test.

    (cherry picked from commit ad2aab5c816a6fd56b46210c0a4a4c6243da1de9)

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

* [Bug c/107001] ICE in expand_gimple_stmt_1, at cfgexpand.cc:4017 since r9-3941-g28567c40e2c7c88e
  2022-09-21 17:35 [Bug c/107001] New: ICE in expand_gimple_stmt_1, at cfgexpand.cc:4017 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2022-11-03  0:23 ` cvs-commit at gcc dot gnu.org
@ 2022-11-04  8:31 ` cvs-commit at gcc dot gnu.org
  2023-05-03 15:19 ` cvs-commit at gcc dot gnu.org
  2023-05-04  7:20 ` jakub at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-11-04  8:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 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:8693cafd8975364ef9b409c18ddfc233e66345d8

commit r11-10360-g8693cafd8975364ef9b409c18ddfc233e66345d8
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Sat Sep 24 09:24:26 2022 +0200

    openmp: Fix ICE with taskgroup at -O0 -fexceptions [PR107001]

    The following testcase ICEs because with -O0 -fexceptions
GOMP_taskgroup_end
    call isn't directly followed by GOMP_RETURN statement, but there are some
    conditionals to handle exceptions and we fail to find the correct
GOMP_RETURN.

    The fix is to treat taskgroup similarly to target data, both of these
constructs
    emit a try { body } finally { end_call } around the construct's body during
    gimplification and we need to see proper construct nesting during
gimplification
    and omp lowering (including nesting of regions checks), but during omp
expansion
    we don't really need their nesting anymore, all we need is emit something
at
    the start of the region and the end of the region is the end API call we've
    already emitted during gimplification.  For target data, we weren't adding
    GOMP_RETURN statement during omp lowering, so after that pass it is treated
    merely like stand-alone omp directives.  This patch does the same for
    taskgroup too.

    2022-09-24  Jakub Jelinek  <jakub@redhat.com>

            PR c/107001
            * omp-low.c (lower_omp_taskgroup): Don't add GOMP_RETURN statement
            at the end.
            * omp-expand.c (build_omp_regions_1): Clarify
GF_OMP_TARGET_KIND_DATA
            is not stand-alone directive.  For GIMPLE_OMP_TASKGROUP, also don't
            update parent.
            (omp_make_gimple_edges) <case GIMPLE_OMP_TASKGROUP>: Reset
            cur_region back after new_omp_region.

            * c-c++-common/gomp/pr107001.c: New test.

    (cherry picked from commit ad2aab5c816a6fd56b46210c0a4a4c6243da1de9)

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

* [Bug c/107001] ICE in expand_gimple_stmt_1, at cfgexpand.cc:4017 since r9-3941-g28567c40e2c7c88e
  2022-09-21 17:35 [Bug c/107001] New: ICE in expand_gimple_stmt_1, at cfgexpand.cc:4017 gscfq@t-online.de
                   ` (4 preceding siblings ...)
  2022-11-04  8:31 ` cvs-commit at gcc dot gnu.org
@ 2023-05-03 15:19 ` cvs-commit at gcc dot gnu.org
  2023-05-04  7:20 ` jakub at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-05-03 15:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 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:8629045a50bbc37d25fe9203c810a96ef96ef0f7

commit r10-11338-g8629045a50bbc37d25fe9203c810a96ef96ef0f7
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Sat Sep 24 09:24:26 2022 +0200

    openmp: Fix ICE with taskgroup at -O0 -fexceptions [PR107001]

    The following testcase ICEs because with -O0 -fexceptions
GOMP_taskgroup_end
    call isn't directly followed by GOMP_RETURN statement, but there are some
    conditionals to handle exceptions and we fail to find the correct
GOMP_RETURN.

    The fix is to treat taskgroup similarly to target data, both of these
constructs
    emit a try { body } finally { end_call } around the construct's body during
    gimplification and we need to see proper construct nesting during
gimplification
    and omp lowering (including nesting of regions checks), but during omp
expansion
    we don't really need their nesting anymore, all we need is emit something
at
    the start of the region and the end of the region is the end API call we've
    already emitted during gimplification.  For target data, we weren't adding
    GOMP_RETURN statement during omp lowering, so after that pass it is treated
    merely like stand-alone omp directives.  This patch does the same for
    taskgroup too.

    2022-09-24  Jakub Jelinek  <jakub@redhat.com>

            PR c/107001
            * omp-low.c (lower_omp_taskgroup): Don't add GOMP_RETURN statement
            at the end.
            * omp-expand.c (build_omp_regions_1): Clarify
GF_OMP_TARGET_KIND_DATA
            is not stand-alone directive.  For GIMPLE_OMP_TASKGROUP, also don't
            update parent.
            (omp_make_gimple_edges) <case GIMPLE_OMP_TASKGROUP>: Reset
            cur_region back after new_omp_region.

            * c-c++-common/gomp/pr107001.c: New test.

    (cherry picked from commit ad2aab5c816a6fd56b46210c0a4a4c6243da1de9)

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

* [Bug c/107001] ICE in expand_gimple_stmt_1, at cfgexpand.cc:4017 since r9-3941-g28567c40e2c7c88e
  2022-09-21 17:35 [Bug c/107001] New: ICE in expand_gimple_stmt_1, at cfgexpand.cc:4017 gscfq@t-online.de
                   ` (5 preceding siblings ...)
  2023-05-03 15:19 ` cvs-commit at gcc dot gnu.org
@ 2023-05-04  7:20 ` jakub at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-05-04  7:20 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

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

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

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-21 17:35 [Bug c/107001] New: ICE in expand_gimple_stmt_1, at cfgexpand.cc:4017 gscfq@t-online.de
2022-09-22 19:11 ` [Bug c/107001] ICE in expand_gimple_stmt_1, at cfgexpand.cc:4017 since r9-3941-g28567c40e2c7c88e marxin at gcc dot gnu.org
2022-09-23 12:04 ` jakub at gcc dot gnu.org
2022-09-24  7:31 ` cvs-commit at gcc dot gnu.org
2022-11-03  0:23 ` cvs-commit at gcc dot gnu.org
2022-11-04  8:31 ` cvs-commit at gcc dot gnu.org
2023-05-03 15:19 ` cvs-commit at gcc dot gnu.org
2023-05-04  7:20 ` 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).