Bug 109469 - [12 regression] ICE: internal compiler error: verify_flow_info failed (error: returns_twice call is not first in basic block 2) when building xdvik
Summary: [12 regression] ICE: internal compiler error: verify_flow_info failed (error:...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 13.0
: P2 normal
Target Milestone: 12.3
Assignee: Richard Biener
URL:
Keywords: ice-checking, ice-on-valid-code
: 109477 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-04-11 06:39 UTC by Sam James
Modified: 2023-04-17 09:17 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work: 13.0
Known to fail:
Last reconfirmed: 2023-04-11 00:00:00


Attachments
util.i.orig (unreduced) (156.41 KB, text/plain)
2023-04-11 06:40 UTC, Sam James
Details
util.i (reduced) (132 bytes, text/plain)
2023-04-11 06:40 UTC, Sam James
Details
util2.i (reduced further, but check) (146 bytes, text/plain)
2023-04-11 06:41 UTC, Sam James
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sam James 2023-04-11 06:39:18 UTC
Hit this when building xdvik-22.87.06 with 13.0.1 20230409 w/ checking.

```
x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I.  -I./gui -DPS_GS  -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include   -Wimplicit -Wreturn-type -O2 -pipe -march=native -fdiagnostics-color=always -frecord-gcc-switches -Wreturn-type      -ggdb3 -Werror=implicit-function-declaration -Werror=implicit-int -Wformat -Waddress -Warray-bounds -Wfree-nonheap-object -Wimplicit-function-declaration -Wimplicit-int -Wincompatible-pointer-types -Wint-conversion -Wint-to-pointer-cast -Wmain -Wnonnull -Wodr -Wparentheses -Wreturn-type -Wsizeof-pointer-memaccess -Wstrict-aliasing -Wstring-compare -Wuninitialized -Wunused-value -Wvarargs -c -o util.o util.c
util.c: In function ‘fork_process’:
util.c:988:1: error: returns_twice call is not first in basic block 25
  988 | fork_process(const char *proc_name, Boolean redirect_stdout,
      | ^~~~~~~~~~~~
pid_96 = vfork ();
during GIMPLE pass: slp
util.c:988:1: internal compiler error: verify_flow_info failed
0x7aa668 verify_flow_info()
        /usr/src/debug/sys-devel/gcc-13.0.1_pre20230409-r1/gcc-13-20230409/gcc/cfghooks.cc:285
0x151e50d execute_function_todo
        /usr/src/debug/sys-devel/gcc-13.0.1_pre20230409-r1/gcc-13-20230409/gcc/passes.cc:2110
0x1485fd1 do_per_function
        /usr/src/debug/sys-devel/gcc-13.0.1_pre20230409-r1/gcc-13-20230409/gcc/passes.cc:1694
0x1485fd1 execute_todo
        /usr/src/debug/sys-devel/gcc-13.0.1_pre20230409-r1/gcc-13-20230409/gcc/passes.cc:2152
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See <https://bugs.gentoo.org/> for instructions.
```
Comment 1 Sam James 2023-04-11 06:40:00 UTC
Created attachment 54826 [details]
util.i.orig (unreduced)
Comment 2 Sam James 2023-04-11 06:40:18 UTC
Created attachment 54827 [details]
util.i (reduced)
Comment 3 Sam James 2023-04-11 06:41:13 UTC
Created attachment 54828 [details]
util2.i (reduced further, but check)
Comment 4 Sam James 2023-04-11 06:41:48 UTC
This might be a dupe of PR108783 or PR109410 but I had to try reduce it to be relatively sure, so may as well file it here for completeness.
Comment 5 Sam James 2023-04-11 06:43:03 UTC
(In reply to Sam James from comment #4)
> This might be a dupe of PR108783 or PR109410 but I had to try reduce it to
> be relatively sure, so may as well file it here for completeness.

I thought it was interesting in this case that it happens even without a definition of foo which was the main motivation for bothering here.
Comment 6 Alexander Monakov 2023-04-11 13:11:08 UTC
Not a dup. Why is SLP emitting a vector construction in BB 2 and not BB 4? (-fno-tree-slp-vectorize disables it):

 void dummy_write_proc ()
 {
+  void (*<T24b>) () * vectp.4;
+  vector(2) long unsigned int * {ref-all} vectp_myproc.3;
+  long unsigned int _7;
+  long unsigned int _8;
+  vector(2) long unsigned int _9;
+
   <bb 2> [local count: 1073741824]:
+  _7 = VIEW_CONVERT_EXPR<long unsigned int>(dummy_write_proc);
+  _8 = VIEW_CONVERT_EXPR<long unsigned int>(dummy_write_proc);
+  _9 = {_8, _7};
   # DEBUG BEGIN_STMT
   foo ();
   goto <bb 4>; [99.96%]

   <bb 3> [local count: 429496]:
   .ABNORMAL_DISPATCHER (0);

   <bb 4> [local count: 1073312329]:
   # DEBUG BEGIN_STMT
-  myproc.write_proc = dummy_write_proc;
-  myproc.read_proc = dummy_write_proc;
+  MEM <vector(2) long unsigned int> [(void (*<T24b>) () *)&myproc] = _9;
   return;

 }
Comment 7 Richard Biener 2023-04-11 13:39:58 UTC
I will have a look.
Comment 8 Alexander Monakov 2023-04-12 06:05:02 UTC
*** Bug 109477 has been marked as a duplicate of this bug. ***
Comment 9 GCC Commits 2023-04-12 06:49:32 UTC
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:2d7ad38707e1fd71193d440198cc0726092b9015

commit r13-7144-g2d7ad38707e1fd71193d440198cc0726092b9015
Author: Richard Biener <rguenther@suse.de>
Date:   Tue Apr 11 16:06:12 2023 +0200

    tree-optimization/109469 - SLP with returns-twice region start
    
    The following avoids an SLP region starting with a returns-twice
    call where we cannot insert stmts at the head.
    
            PR tree-optimization/109469
            * tree-vect-slp.cc (vect_slp_function): Skip region starts with
            a returns-twice call.
    
            * gcc.dg/torture/pr109469.c: New testcase.
Comment 10 Richard Biener 2023-04-12 06:51:09 UTC
Fixed (but latent).
Comment 11 Richard Biener 2023-04-12 06:51:56 UTC
On a 2nd thought I'm going to backport it for 12.3.
Comment 12 GCC Commits 2023-04-17 09:14:46 UTC
The releases/gcc-12 branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:9cc16b95d5d63b18cbc0aa780ffb6b460c791351

commit r12-9411-g9cc16b95d5d63b18cbc0aa780ffb6b460c791351
Author: Richard Biener <rguenther@suse.de>
Date:   Tue Apr 11 16:06:12 2023 +0200

    tree-optimization/109469 - SLP with returns-twice region start
    
    The following avoids an SLP region starting with a returns-twice
    call where we cannot insert stmts at the head.
    
            PR tree-optimization/109469
            * tree-vect-slp.cc (vect_slp_function): Skip region starts with
            a returns-twice call.
    
            * gcc.dg/torture/pr109469.c: New testcase.
    
    (cherry picked from commit 2d7ad38707e1fd71193d440198cc0726092b9015)
Comment 13 Richard Biener 2023-04-17 09:17:15 UTC
Fixed.