Bug 96424 - ICE: verify_flow_info failed (error: wrong outgoing edge flags at end of bb 23); or ICE: Segmentation fault (in expand_omp_for_init_vars/contains_struct_check)
Summary: ICE: verify_flow_info failed (error: wrong outgoing edge flags at end of bb 2...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 11.0
: P3 normal
Target Milestone: ---
Assignee: Jakub Jelinek
URL:
Keywords: openmp
Depends on:
Blocks:
 
Reported: 2020-08-03 03:03 UTC by Arseny Solokha
Modified: 2020-08-08 11:36 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2020-08-07 00:00:00


Attachments
gcc11-pr96424.patch (1.04 KB, patch)
2020-08-07 10:08 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Arseny Solokha 2020-08-03 03:03:41 UTC
1.

g++-11.0.0-alpha20200726 snapshot (g:39ddfef9a5c24acf6412236f52f6716c8e0ebc9e) ICEs when compiling the following testcase, reduced from libgomp/testsuite/libgomp.c/loop-18.c, w/ -fbranch-probabilities -fnon-call-exceptions -fopenmp:

int
main ()
{
  int i, j;

#pragma omp for collapse (2)
  for (i = 0; i < 1; ++i)
    for (j = 0; j <= i; ++j)
      {
      }

  return 0;
}

% g++-11.0.0 -fbranch-probabilities -fnon-call-exceptions -fopenmp -c qr6y7wzi.c
qr6y7wzi.c: In function 'int main()':
qr6y7wzi.c:13:1: error: wrong outgoing edge flags at end of bb 23
   13 | }
      | ^
during IPA pass: profile
qr6y7wzi.c:13:1: internal compiler error: verify_flow_info failed
0xb80b56 verify_flow_info()
	/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200726/work/gcc-11-20200726/gcc/cfghooks.c:269
0x105e7e7 checking_verify_flow_info
	/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200726/work/gcc-11-20200726/gcc/cfghooks.h:212
0x105e7e7 gimple_flow_call_edges_add
	/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200726/work/gcc-11-20200726/gcc/tree-cfg.c:8622
0xf81fdd branch_prob(bool)
	/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200726/work/gcc-11-20200726/gcc/profile.c:1099
0x10fe836 tree_profiling
	/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200726/work/gcc-11-20200726/gcc/tree-profile.c:779
0x10fe836 execute
	/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200726/work/gcc-11-20200726/gcc/tree-profile.c:885

2.

Replacing <= w/ < yields the following instead:

--- qr6y7wzi.c
+++ #<buffer qr6y7wzi.c>
@@ -5,7 +5,7 @@ main ()
 
 #pragma omp for collapse (2)
   for (i = 0; i < 1; ++i)
-    for (j = 0; j <= i; ++j)
+    for (j = 0; j < i; ++j)
       {
       }
 

% g++-11.0.0 -fbranch-probabilities -fnon-call-exceptions -fopenmp -c qr6y7wzi.c
during GIMPLE pass: ompexp
qr6y7wzi.c: In function 'int main()':
qr6y7wzi.c:6:9: internal compiler error: Segmentation fault
    6 | #pragma omp for collapse (2)
      |         ^~~
0x1028baf crash_signal
	/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200726/work/gcc-11-20200726/gcc/toplev.c:328
0xec69ae contains_struct_check(tree_node*, tree_node_structure_enum, char const*, int, char const*)
	/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200726/work/gcc-11-20200726/gcc/tree.h:3416
0xec69ae expand_omp_for_init_vars
	/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200726/work/gcc-11-20200726/gcc/omp-expand.c:2271
0xeccbe2 expand_omp_for_static_nochunk
	/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200726/work/gcc-11-20200726/gcc/omp-expand.c:4969
0xedc6b4 expand_omp_for
	/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200726/work/gcc-11-20200726/gcc/omp-expand.c:7421
0xedcb8a expand_omp
	/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200726/work/gcc-11-20200726/gcc/omp-expand.c:9691
0xede96c execute_expand_omp
	/var/tmp/portage/sys-devel/gcc-11.0.0_alpha20200726/work/gcc-11-20200726/gcc/omp-expand.c:9920
Comment 1 Jakub Jelinek 2020-08-07 10:08:42 UTC
Created attachment 49018 [details]
gcc11-pr96424.patch

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

https://gcc.gnu.org/g:87d6dae308d604bad111b1c0bfea7835888eed8d

commit r11-2614-g87d6dae308d604bad111b1c0bfea7835888eed8d
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Sat Aug 8 11:07:09 2020 +0200

    openmp: Avoid floating point comparison at the end of bb with -fnon-call-exceptions
    
    The following testcase ICEs with -fexceptions -fnon-call-exceptions because
    in that mode floating point comparisons should not be done at the end of bb
    in GIMPLE_COND.  Fixed by forcing it into a bool SSA_NAME and comparing that against
    false.
    
    2020-08-08  Jakub Jelinek  <jakub@redhat.com>
    
            PR tree-optimization/96424
            * omp-expand.c: Include tree-eh.h.
            (expand_omp_for_init_vars): Handle -fexceptions -fnon-call-exceptions
            by forcing floating point comparison into a bool temporary.
    
            * c-c++-common/gomp/pr96424.c: New test.
Comment 3 Jakub Jelinek 2020-08-08 11:36:15 UTC
Fixed.