Bug 98205 - ICE in expand_omp_for_generic, at omp-expand.c:4307
Summary: ICE in expand_omp_for_generic, at omp-expand.c:4307
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 11.0
: P3 normal
Target Milestone: 8.5
Assignee: Jakub Jelinek
URL:
Keywords: openmp
Depends on:
Blocks:
 
Reported: 2020-12-08 17:40 UTC by G. Steinmetz
Modified: 2021-09-11 14:22 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2020-12-09 00:00:00


Attachments
gcc11-pr98205.patch (792 bytes, patch)
2020-12-09 12:02 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description G. Steinmetz 2020-12-08 17:40:03 UTC
Affects versions down to r6 :


$ cat z1.c
void f (int n)
{
  int i;
  #pragma omp for ordered(1)
  for (i = 0; i < 8; i += n)
    for (;;);
}


$ gcc-11-20201206 -c z1.c -fopenmp
during GIMPLE pass: ompexp
z1.c: In function 'f':
z1.c:4:11: internal compiler error: Segmentation fault
    4 |   #pragma omp for ordered(1)
      |           ^~~
0xd2670f crash_signal
        ../../gcc/toplev.c:327
0x1880c99 bb_seq_addr
        ../../gcc/gimple.h:1764
0x1880c99 gsi_last_bb
        ../../gcc/gimple-iterator.h:164
0x1880c99 expand_omp_for_generic
        ../../gcc/omp-expand.c:4307
0x18852c9 expand_omp_for
        ../../gcc/omp-expand.c:8107
0x188616a expand_omp
        ../../gcc/omp-expand.c:9901
0x188802d execute_expand_omp
        ../../gcc/omp-expand.c:10133
Comment 1 Jakub Jelinek 2020-12-09 12:02:55 UTC
Created attachment 49712 [details]
gcc11-pr98205.patch

Untested fix.
Comment 2 GCC Commits 2020-12-10 10:08:46 UTC
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:a2a17ae7d85e420db5fe0c7ab2f59a470e2c7a78

commit r11-5897-ga2a17ae7d85e420db5fe0c7ab2f59a470e2c7a78
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Dec 10 11:07:07 2020 +0100

    openmp: Fix ICE with broken doacross loop [PR98205]
    
    If the loop body doesn't ever continue, we don't have a bb to insert the
    updates.  Fixed by not adding them at all in that case.
    
    2020-12-10  Jakub Jelinek  <jakub@redhat.com>
    
            PR middle-end/98205
            * omp-expand.c (expand_omp_for_generic): Fix up broken_loop handling.
    
            * c-c++-common/gomp/doacross-4.c: New test.
Comment 3 GCC Commits 2021-01-06 09:39:44 UTC
The releases/gcc-10 branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:c925d4cebf817905c237aa2d93887f254b4a74f4

commit r10-9219-gc925d4cebf817905c237aa2d93887f254b4a74f4
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Dec 10 11:07:07 2020 +0100

    openmp: Fix ICE with broken doacross loop [PR98205]
    
    If the loop body doesn't ever continue, we don't have a bb to insert the
    updates.  Fixed by not adding them at all in that case.
    
    2020-12-10  Jakub Jelinek  <jakub@redhat.com>
    
            PR middle-end/98205
            * omp-expand.c (expand_omp_for_generic): Fix up broken_loop handling.
    
            * c-c++-common/gomp/doacross-4.c: New test.
    
    (cherry picked from commit a2a17ae7d85e420db5fe0c7ab2f59a470e2c7a78)
Comment 4 GCC Commits 2021-04-20 23:30:43 UTC
The releases/gcc-9 branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:6f0a0d1c2bb7ad2020852ccf14ca86967ddb134a

commit r9-9400-g6f0a0d1c2bb7ad2020852ccf14ca86967ddb134a
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Dec 10 11:07:07 2020 +0100

    openmp: Fix ICE with broken doacross loop [PR98205]
    
    If the loop body doesn't ever continue, we don't have a bb to insert the
    updates.  Fixed by not adding them at all in that case.
    
    2020-12-10  Jakub Jelinek  <jakub@redhat.com>
    
            PR middle-end/98205
            * omp-expand.c (expand_omp_for_generic): Fix up broken_loop handling.
    
            * c-c++-common/gomp/doacross-4.c: New test.
    
    (cherry picked from commit c925d4cebf817905c237aa2d93887f254b4a74f4)
Comment 5 GCC Commits 2021-04-22 16:49:23 UTC
The releases/gcc-8 branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:a66e756ea9cf1ce8f2c73bd29bfe7ed785fae89a

commit r8-10868-ga66e756ea9cf1ce8f2c73bd29bfe7ed785fae89a
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Dec 10 11:07:07 2020 +0100

    openmp: Fix ICE with broken doacross loop [PR98205]
    
    If the loop body doesn't ever continue, we don't have a bb to insert the
    updates.  Fixed by not adding them at all in that case.
    
    2020-12-10  Jakub Jelinek  <jakub@redhat.com>
    
            PR middle-end/98205
            * omp-expand.c (expand_omp_for_generic): Fix up broken_loop handling.
    
            * c-c++-common/gomp/doacross-4.c: New test.
    
    (cherry picked from commit c925d4cebf817905c237aa2d93887f254b4a74f4)
Comment 6 Jakub Jelinek 2021-04-22 17:08:38 UTC
Fixed.