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

--- Comment #2 from Zhendong Su <su at cs dot ucdavis.edu> ---
(In reply to Andrew Pinski from comment #1)
> Most likely a dup of bug 78060.

Yes, it looks like.  But the reported C++ test case for 78060 has undefined
behavior due to uninitialized variables.  The ICE disappears if c and l are
initialized: 

$ g++-trunk -O3 -c small.cpp
small.cpp: In function ‘void fn1()’:
small.cpp:9:6: error: type mismatch in binary expression
 void fn1()
      ^~~
long int

long int

int

_29 = _27 - l_5(D);
small.cpp:9:6: internal compiler error: verify_gimple failed
0xe33b6f verify_gimple_in_cfg(function*, bool)
        ../../gcc-source-trunk/gcc/tree-cfg.c:5208
0xd13f42 execute_function_todo
        ../../gcc-source-trunk/gcc/passes.c:1965
0xd148f9 execute_todo
        ../../gcc-source-trunk/gcc/passes.c:2015
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$ 
$ g++-trunk -O3 -c small-fixed.cpp
$ 
$ cat small-fixed.cpp
class A {
public:
  template <typename T2> int &operator[](T2);
};

int a;
A b;

void fn1() 
{
  long c = 0; 
  for (int l = 0; l < c; ++l)
    b[l] = l < 2 ? : a;
}
$

Reply via email to