A simple testcase:
void foo (void * DAG_temp117584)
{
  char  uA;
  void* pA;
  void* pB;
  void* pC;
  do {
    int DAG_temp117585;
    int DAG_temp117586;
    void ** __indir_union1 = (void**)DAG_temp117584;
    DAG_temp117585 = *__indir_union1;
    DAG_temp117586 = DAG_temp117585;
    if ( DAG_temp117586 != (int)268435456 )
      pA = (void*)&uA;
    pB = (void*)&pA;
    pC = pB;
    union __block_indir0_u {  struct {  int val; }  __indir_struct; }
       * __indir_union = (union __block_indir0_u*)pC;
    f(__indir_union->__indir_struct.val);

    DAG_temp117584 += 64;
  } while (1);
}
---- CUT ---
Compile at -O1, we get the following ICE:
gcc/gcc/testsuite/gcc.c-torture/compile/20090206-2.c:19: internal compiler
error: in expand_expr_addr_expr_1, at expr.c:6817
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

If we compile with -O2, we get:
gcc/gcc/testsuite/gcc.c-torture/compile/20090206-2.c:1: internal compiler
error: in verify_expr, at tree-cfg.c:2876
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

forwprop1 produces:
  D.1591_10 = VIEW_CONVERT_EXPR<union __block_indir0_u>(pA).__indir_struct.val;

CCP2 produces:
  D.1591_10 = VIEW_CONVERT_EXPR<union
__block_indir0_u>(&uA).__indir_struct.val;

And then somewhere we must lose that the address of uA is taken because with
-O2 PRE creates:
  uA.18_15 = uA_11(D);
  D.2674_1 = uA.18_15;
  D.2676_8 = D.2674_1;
  D.2675_7 = &D.2676_8;
  pretmp.19_13 = VIEW_CONVERT_EXPR<union
__block_indir0_u>(D.2675_7).__indir_struct.val;

Which is just incorrect.


-- 
           Summary: [4.5 Regression] ICE with some code that produces VCE
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org


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

Reply via email to