[Bug middle-end/45709] [4.3/4.4/4.5/4.6 regression] internal compiler error: in add_phi_arg, at tree-phinodes.c:395

2010-09-17 Thread pinskia at gcc dot gnu dot org


--- Comment #1 from pinskia at gcc dot gnu dot org  2010-09-17 20:25 ---
Reduced testcase:
struct Region {
int storage[4];
int count;
};
static inline Region subtract(int lhs)
{
  Region reg;
  int* storage = reg.storage;
  if (lhs  0)
storage++;
  reg.count = storage - reg.storage;
  return reg;
}
void bar(int a)
{
  const Region copyBack(subtract(a));
}

 CUT ---
Comes from inlining.


-- 

pinskia at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||hubicka at gcc dot gnu dot
   ||org
 Status|UNCONFIRMED |NEW
 Ever Confirmed|0   |1
   Last reconfirmed|-00-00 00:00:00 |2010-09-17 20:25:35
   date||
   Target Milestone|--- |4.3.6


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45709



[Bug middle-end/45709] [4.3/4.4/4.5/4.6 regression] internal compiler error: in add_phi_arg, at tree-phinodes.c:395

2010-09-17 Thread pinskia at gcc dot gnu dot org


--- Comment #2 from pinskia at gcc dot gnu dot org  2010-09-17 20:35 ---
Not what is happening is an interaction between the inlining and the return
slot optimization and the named value optimization.
Before inlining we have:

  # storage_1 = PHI retval.storage[0](2), retval.storage[1](3)
...
  copyBack.1_1 = (struct Region *) copyBack;
  *copyBack.1_1 ={v} subtract (a_2(D)) [return slot optimization];

--- Cut 
Since (*copyBack.1_1).storage[0] is not a constant we get an ICE.  Why we
don't remove the extra cast to begin is questionable.  If we change:
  const Region copyBack(subtract(a));
to
  const Region copyBack = (subtract(a));

We can remove the cast and it works.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45709



[Bug middle-end/45709] [4.3/4.4/4.5/4.6 regression] internal compiler error: in add_phi_arg, at tree-phinodes.c:395

2010-09-17 Thread hjl dot tools at gmail dot com


--- Comment #3 from hjl dot tools at gmail dot com  2010-09-17 22:02 ---
It was introduced between revision 127644 and 127649.


-- 

hjl dot tools at gmail dot com changed:

   What|Removed |Added

 CC||rguenth at gcc dot gnu dot
   ||org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45709



[Bug middle-end/45709] [4.3/4.4/4.5/4.6 regression] internal compiler error: in add_phi_arg, at tree-phinodes.c:395

2010-09-17 Thread hjl dot tools at gmail dot com


--- Comment #4 from hjl dot tools at gmail dot com  2010-09-17 22:17 ---
Revision 127647:

http://gcc.gnu.org/ml/gcc-cvs/2007-08/msg00541.html

introduced:

[...@gnu-26 gcc]$ ./xgcc -B./ -S -O ../../../pr45709.cc 
../../../pr45709.cc: In member function ‘virtual void foo::bar()’:
../../../pr45709.cc:27: error: PHI def is not a GIMPLE value
storage_8 = PHI copyBack.1_1-storage[0](2), copyBack.1_1-storage[1](3)

copyBack.1_1-storage[0];

../../../pr45709.cc:27: error: PHI def is not a GIMPLE value
storage_8 = PHI copyBack.1_1-storage[0](2), copyBack.1_1-storage[1](3)

copyBack.1_1-storage[1];

../../../pr45709.cc:27: error: invalid operand to unary operator
copyBack.1_1-storage;

../../../pr45709.cc:27: internal compiler error: verify_stmts failed
Please submit a full bug report,
with preprocessed source if appropriate.
See URL:http://gcc.gnu.org/bugs.html for instructions.
[...@gnu-26 gcc]$ 


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45709