Bug 109262 - [13 Regression] ICE: verify_gimple failed (error: statement marked for throw in middle of block) since r13-6624
Summary: [13 Regression] ICE: verify_gimple failed (error: statement marked for throw ...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 13.0
: P3 normal
Target Milestone: 13.0
Assignee: Richard Biener
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2023-03-23 12:32 UTC by Arseny Solokha
Modified: 2023-03-23 15:35 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2023-03-23 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Arseny Solokha 2023-03-23 12:32:51 UTC
gcc 13.0.1 20230319 snapshot (g:5426ab34643d9e6502f3ee572891a03471fa33ed) ICEs when compiling the following testcase, reduced from gcc/testsuite/g++.dg/torture/pr88149.C, w/ -O1 -fnon-call-exceptions:

template < typename > struct au;
template < typename b > au< b > operator*(au< b >, au< b > &p2) {
  au< b > ax;
  ax *= p2;
  return p2;
}
template <> struct au< double > {
  double p() { return __real__ az; }
  double q() { return __imag__ az; }
  void operator*=(au &o) {
    _Complex bd = o.p();
    __imag__ bd = o.q();
    az *= bd;
  }
  _Complex az;
};
long bm, m;
au< double > h;
void bn() {
  for (long k; ;) {
    au< double > br;
    for (long j = 0; 0 < bm; ++j)
      au n = br * h;
  }
}

% g++-13 -O1 -fnon-call-exceptions -c a7nq8mzi.C
a7nq8mzi.C: In function 'void operator*(au<b>, au<b>&) [with b = double]':
a7nq8mzi.C:20:1: error: statement marked for throw in middle of block
   20 | }
      | ^
# VUSE <.MEM_1(D)>
_6 = REALPART_EXPR <p2_2(D)->az>;
during GIMPLE pass: forwprop
a7nq8mzi.C:20:1: internal compiler error: verify_gimple failed
0x123bd51 verify_gimple_in_cfg(function*, bool, bool)
	/var/tmp/portage/sys-devel/gcc-13.0.1_p20230319/work/gcc-13-20230319/gcc/tree-cfg.cc:5648
0x1104820 execute_function_todo
	/var/tmp/portage/sys-devel/gcc-13.0.1_p20230319/work/gcc-13-20230319/gcc/passes.cc:2098
0x1104d8e execute_todo
	/var/tmp/portage/sys-devel/gcc-13.0.1_p20230319/work/gcc-13-20230319/gcc/passes.cc:2152
Comment 1 Arseny Solokha 2023-03-23 12:32:58 UTC
Sadly, this is likely my final GCC PR, at least for the foreseeable future. I would like to thank all GCC contributors, past and present, for their tireless effort of keeping GCC going. It was a real joy for me to work with you for the last nine years. I hope I will be able to get around to my casual semi-automated GCC testing trifle some day in the future; till then, I wish you all the best guys. Thank you for all your work. Please keep GCC thriving for the next decade.
Comment 2 Richard Biener 2023-03-23 14:17:45 UTC
(In reply to Arseny Solokha from comment #1)
> Sadly, this is likely my final GCC PR, at least for the foreseeable future.
> I would like to thank all GCC contributors, past and present, for their
> tireless effort of keeping GCC going. It was a real joy for me to work with
> you for the last nine years. I hope I will be able to get around to my
> casual semi-automated GCC testing trifle some day in the future; till then,
> I wish you all the best guys. Thank you for all your work. Please keep GCC
> thriving for the next decade.

Thanks a lot for all your work!  It has been very much appreciated!
Comment 3 Richard Biener 2023-03-23 14:18:09 UTC
Likely mine.
Comment 4 Jakub Jelinek 2023-03-23 14:54:39 UTC
Started with r13-6624-geb337d28c32b1b460cc85b3c00f8418ca535c77b
Comment 5 GCC Commits 2023-03-23 15:35:31 UTC
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:25979b6761516b9039004385e08141e0925e1a17

commit r13-6833-g25979b6761516b9039004385e08141e0925e1a17
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Mar 23 15:50:59 2023 +0100

    tree-optimization/109262 - ICE with non-call EH and forwprop
    
    The recent combining of complex part loads to a complex load missed
    to account for non-call EH.
    
            PR tree-optimization/109262
            * tree-ssa-forwprop.cc (pass_forwprop::execute): When
            combining a piecewise complex load avoid touching loads
            that throw internally.  Use fun, not cfun throughout.
    
            * g++.dg/torture/pr109262.C: New testcase.
Comment 6 Richard Biener 2023-03-23 15:35:49 UTC
Fixed.