public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/106781] New: [13 Regression] ICE: verify_flow_info failed (error: returns_twice call is not first in basic block 2)
@ 2022-08-31  7:11 asolokha at gmx dot com
  2022-08-31  7:48 ` [Bug tree-optimization/106781] " amonakov at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: asolokha at gmx dot com @ 2022-08-31  7:11 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106781
           Summary: [13 Regression] ICE: verify_flow_info failed (error:
                    returns_twice call is not first in basic block 2)
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: asolokha at gmx dot com
  Target Milestone: ---

gcc 13.0.0 20220828 snapshot (g:1ae1325f24cea1698b56e4299d95446a1f7b90a2) ICEs
when compiling the following testcase w/ -O2:

int n;

__attribute__ ((noinline, returns_twice)) static int
bar (int)
{
  n /= 0;

  return n;
}

int
foo (int x)
{
  return bar (x);
}

% gcc-13.0.0 -O2 -w -c dmkrwty8.c
dmkrwty8.c: In function 'foo':
dmkrwty8.c:12:1: error: returns_twice call is not first in basic block 2
   12 | foo (int x)
      | ^~~
bar.constprop ();
during IPA pass: inline
dmkrwty8.c:12:1: internal compiler error: verify_flow_info failed
0x9fcb0d verify_flow_info()
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220828/work/gcc-13-20220828/gcc/cfghooks.cc:284
0xf44614 checking_verify_flow_info
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220828/work/gcc-13-20220828/gcc/cfghooks.h:214
0xf44614 cleanup_tree_cfg_noloop
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220828/work/gcc-13-20220828/gcc/tree-cfgcleanup.cc:1156
0xf44614 cleanup_tree_cfg(unsigned int)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220828/work/gcc-13-20220828/gcc/tree-cfgcleanup.cc:1207
0xdfdaf4 execute_function_todo
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220828/work/gcc-13-20220828/gcc/passes.cc:2057
0xdfdf4c execute_todo
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220828/work/gcc-13-20220828/gcc/passes.cc:2145
0xe00970 execute_one_ipa_transform_pass
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220828/work/gcc-13-20220828/gcc/passes.cc:2339
0xe00970 execute_all_ipa_transforms(bool)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220828/work/gcc-13-20220828/gcc/passes.cc:2399
0xa34d2d cgraph_node::expand()
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220828/work/gcc-13-20220828/gcc/cgraphunit.cc:1827
0xa34d2d cgraph_node::expand()
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220828/work/gcc-13-20220828/gcc/cgraphunit.cc:1787
0xa36304 expand_all_functions
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220828/work/gcc-13-20220828/gcc/cgraphunit.cc:1998
0xa36304 symbol_table::compile()
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220828/work/gcc-13-20220828/gcc/cgraphunit.cc:2348
0xa38e27 symbol_table::compile()
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220828/work/gcc-13-20220828/gcc/cgraphunit.cc:2261
0xa38e27 symbol_table::finalize_compilation_unit()
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220828/work/gcc-13-20220828/gcc/cgraphunit.cc:2529

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

* [Bug tree-optimization/106781] [13 Regression] ICE: verify_flow_info failed (error: returns_twice call is not first in basic block 2)
  2022-08-31  7:11 [Bug tree-optimization/106781] New: [13 Regression] ICE: verify_flow_info failed (error: returns_twice call is not first in basic block 2) asolokha at gmx dot com
@ 2022-08-31  7:48 ` amonakov at gcc dot gnu.org
  2022-08-31  8:23 ` [Bug tree-optimization/106781] [13 Regression] ICE: verify_flow_info failed (error: returns_twice call is not first in basic block 2) since r13-1754-g7a158a5776f5ca95 marxin at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: amonakov at gcc dot gnu.org @ 2022-08-31  7:48 UTC (permalink / raw)
  To: gcc-bugs

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

Alexander Monakov <amonakov at gcc dot gnu.org> changed:

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

--- Comment #1 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
Thanks.

Also ICEs in ipa-modref when 'noclone' added to 'noinline', a 12/13 regression
(different cause, needs a separate PR).

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

* [Bug tree-optimization/106781] [13 Regression] ICE: verify_flow_info failed (error: returns_twice call is not first in basic block 2) since r13-1754-g7a158a5776f5ca95
  2022-08-31  7:11 [Bug tree-optimization/106781] New: [13 Regression] ICE: verify_flow_info failed (error: returns_twice call is not first in basic block 2) asolokha at gmx dot com
  2022-08-31  7:48 ` [Bug tree-optimization/106781] " amonakov at gcc dot gnu.org
@ 2022-08-31  8:23 ` marxin at gcc dot gnu.org
  2022-08-31  8:24 ` marxin at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-08-31  8:23 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marxin at gcc dot gnu.org
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2022-08-31
            Summary|[13 Regression] ICE:        |[13 Regression] ICE:
                   |verify_flow_info failed     |verify_flow_info failed
                   |(error: returns_twice call  |(error: returns_twice call
                   |is not first in basic block |is not first in basic block
                   |2)                          |2) since
                   |                            |r13-1754-g7a158a5776f5ca95
             Status|UNCONFIRMED                 |NEW

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
So this one started with r13-1754-g7a158a5776f5ca95.

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

* [Bug tree-optimization/106781] [13 Regression] ICE: verify_flow_info failed (error: returns_twice call is not first in basic block 2) since r13-1754-g7a158a5776f5ca95
  2022-08-31  7:11 [Bug tree-optimization/106781] New: [13 Regression] ICE: verify_flow_info failed (error: returns_twice call is not first in basic block 2) asolokha at gmx dot com
  2022-08-31  7:48 ` [Bug tree-optimization/106781] " amonakov at gcc dot gnu.org
  2022-08-31  8:23 ` [Bug tree-optimization/106781] [13 Regression] ICE: verify_flow_info failed (error: returns_twice call is not first in basic block 2) since r13-1754-g7a158a5776f5ca95 marxin at gcc dot gnu.org
@ 2022-08-31  8:24 ` marxin at gcc dot gnu.org
  2022-08-31  8:59 ` amonakov at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-08-31  8:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to Alexander Monakov from comment #1)
> Thanks.
> 
> Also ICEs in ipa-modref when 'noclone' added to 'noinline', a 12/13
> regression (different cause, needs a separate PR).

Can't reproduce Alexander, please attach a testcase.

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

* [Bug tree-optimization/106781] [13 Regression] ICE: verify_flow_info failed (error: returns_twice call is not first in basic block 2) since r13-1754-g7a158a5776f5ca95
  2022-08-31  7:11 [Bug tree-optimization/106781] New: [13 Regression] ICE: verify_flow_info failed (error: returns_twice call is not first in basic block 2) asolokha at gmx dot com
                   ` (2 preceding siblings ...)
  2022-08-31  8:24 ` marxin at gcc dot gnu.org
@ 2022-08-31  8:59 ` amonakov at gcc dot gnu.org
  2022-08-31 12:17 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: amonakov at gcc dot gnu.org @ 2022-08-31  8:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
(In reply to Martin Liška from comment #3)
> > Also ICEs in ipa-modref when 'noclone' added to 'noinline', a 12/13
> > regression (different cause, needs a separate PR).
> 
> Can't reproduce Alexander, please attach a testcase.

Ah, it ICEs when emitting a dump, so -fdump-tree-modref2 is needed in addition
to -O2, I've filed that as PR 106783.

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

* [Bug tree-optimization/106781] [13 Regression] ICE: verify_flow_info failed (error: returns_twice call is not first in basic block 2) since r13-1754-g7a158a5776f5ca95
  2022-08-31  7:11 [Bug tree-optimization/106781] New: [13 Regression] ICE: verify_flow_info failed (error: returns_twice call is not first in basic block 2) asolokha at gmx dot com
                   ` (3 preceding siblings ...)
  2022-08-31  8:59 ` amonakov at gcc dot gnu.org
@ 2022-08-31 12:17 ` rguenth at gcc dot gnu.org
  2022-08-31 13:37 ` amonakov at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-08-31 12:17 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |13.0
           Keywords|                            |ice-checking

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

* [Bug tree-optimization/106781] [13 Regression] ICE: verify_flow_info failed (error: returns_twice call is not first in basic block 2) since r13-1754-g7a158a5776f5ca95
  2022-08-31  7:11 [Bug tree-optimization/106781] New: [13 Regression] ICE: verify_flow_info failed (error: returns_twice call is not first in basic block 2) asolokha at gmx dot com
                   ` (4 preceding siblings ...)
  2022-08-31 12:17 ` rguenth at gcc dot gnu.org
@ 2022-08-31 13:37 ` amonakov at gcc dot gnu.org
  2022-10-19  7:01 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: amonakov at gcc dot gnu.org @ 2022-08-31 13:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
GCC discovers that 'bar' is noreturn, tries to remove its LHS but unfortunately
cgraph.cc:cgraph_edge::redirect_call_stmt_to_callee wants to emit an assignment
of SSA default-def to the LHS. fixup_noreturn_call seems to handle that in a
smarter way.

Is it possible to simply let fixup_noreturn_call do its thing?

diff --git a/gcc/cgraph.cc b/gcc/cgraph.cc
index 8d6ed38ef..6597de669 100644
--- a/gcc/cgraph.cc
+++ b/gcc/cgraph.cc
@@ -1567,7 +1567,7 @@ cgraph_edge::redirect_call_stmt_to_callee (cgraph_edge
*e)

   /* If the call becomes noreturn, remove the LHS if possible.  */
   tree lhs = gimple_call_lhs (new_stmt);
-  if (lhs
+  if (0 && lhs
       && gimple_call_noreturn_p (new_stmt)
       && (VOID_TYPE_P (TREE_TYPE (gimple_call_fntype (new_stmt)))
          || should_remove_lhs_p (lhs)))

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

* [Bug tree-optimization/106781] [13 Regression] ICE: verify_flow_info failed (error: returns_twice call is not first in basic block 2) since r13-1754-g7a158a5776f5ca95
  2022-08-31  7:11 [Bug tree-optimization/106781] New: [13 Regression] ICE: verify_flow_info failed (error: returns_twice call is not first in basic block 2) asolokha at gmx dot com
                   ` (5 preceding siblings ...)
  2022-08-31 13:37 ` amonakov at gcc dot gnu.org
@ 2022-10-19  7:01 ` rguenth at gcc dot gnu.org
  2022-10-19  8:56 ` cvs-commit at gcc dot gnu.org
  2022-10-19  8:56 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-10-19  7:01 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
Mine.

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

* [Bug tree-optimization/106781] [13 Regression] ICE: verify_flow_info failed (error: returns_twice call is not first in basic block 2) since r13-1754-g7a158a5776f5ca95
  2022-08-31  7:11 [Bug tree-optimization/106781] New: [13 Regression] ICE: verify_flow_info failed (error: returns_twice call is not first in basic block 2) asolokha at gmx dot com
                   ` (6 preceding siblings ...)
  2022-10-19  7:01 ` rguenth at gcc dot gnu.org
@ 2022-10-19  8:56 ` cvs-commit at gcc dot gnu.org
  2022-10-19  8:56 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-10-19  8:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:32ab9238d86dfa6d74d3592bec570f4f257d0413

commit r13-3370-g32ab9238d86dfa6d74d3592bec570f4f257d0413
Author: Richard Biener <rguenther@suse.de>
Date:   Wed Oct 19 09:01:56 2022 +0200

    tree-optimization/106781 - adjust cgraph lhs removal

    The following matches up the cgraph code removing LHS of a noreturn
    call with what fixup_noreturn_call does which gets along without
    inserting a definition, fixing the ICE resulting from having no
    place to actually insert that new def.

            PR tree-optimization/106781
            * cgraph.cc (cgraph_edge::redirect_call_stmt_to_callee): Copy
            LHS removal from fixup_noreturn_call.

            * gcc.dg/pr106781.c: New testcase.

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

* [Bug tree-optimization/106781] [13 Regression] ICE: verify_flow_info failed (error: returns_twice call is not first in basic block 2) since r13-1754-g7a158a5776f5ca95
  2022-08-31  7:11 [Bug tree-optimization/106781] New: [13 Regression] ICE: verify_flow_info failed (error: returns_twice call is not first in basic block 2) asolokha at gmx dot com
                   ` (7 preceding siblings ...)
  2022-10-19  8:56 ` cvs-commit at gcc dot gnu.org
@ 2022-10-19  8:56 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-10-19  8:56 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2022-10-19  8:56 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-31  7:11 [Bug tree-optimization/106781] New: [13 Regression] ICE: verify_flow_info failed (error: returns_twice call is not first in basic block 2) asolokha at gmx dot com
2022-08-31  7:48 ` [Bug tree-optimization/106781] " amonakov at gcc dot gnu.org
2022-08-31  8:23 ` [Bug tree-optimization/106781] [13 Regression] ICE: verify_flow_info failed (error: returns_twice call is not first in basic block 2) since r13-1754-g7a158a5776f5ca95 marxin at gcc dot gnu.org
2022-08-31  8:24 ` marxin at gcc dot gnu.org
2022-08-31  8:59 ` amonakov at gcc dot gnu.org
2022-08-31 12:17 ` rguenth at gcc dot gnu.org
2022-08-31 13:37 ` amonakov at gcc dot gnu.org
2022-10-19  7:01 ` rguenth at gcc dot gnu.org
2022-10-19  8:56 ` cvs-commit at gcc dot gnu.org
2022-10-19  8:56 ` rguenth 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).