Sam <samueldotj@xxxxxxxxx> writes: > ICE was found when a large project was compiled with gcc 4.6.3(with > optimization enabled). It is working fine with gcc 4.5.3. > > From the stack trace it looked like a simple bug so I fix it and with > the following patch gcc-4.6.3 works fine. However I am not sure > whether this patch is correct or I am just suppressing the root cause > by this fix. > Can some gcc guru look at this and confirm whether it is a really a bug? > > diff -rupN gcc-4.6.3/gcc/expr.c gcc-4.6.3.new1/gcc/expr.c > --- gcc-4.6.3/gcc/expr.c 2012-02-09 09:28:22.000000000 -0800 > +++ gcc-4.6.3.new1/gcc/expr.c 2012-06-20 22:53:10.613748645 -0700 > @@ -9182,6 +9182,7 @@ expand_expr_real_1 (tree exp, rtx target > orig_op0 = op0 > = expand_expr (tem, > (TREE_CODE (TREE_TYPE (tem)) == UNION_TYPE > + && TYPE_SIZE (TREE_TYPE (tem)) > && (TREE_CODE (TYPE_SIZE (TREE_TYPE (tem))) > != INTEGER_CST) > && modifier != EXPAND_STACK_PARM An ICE is always a compiler bug but this does not look like the complete fix. A UNION_TYPE should not have a NULL TYPE_SIZE. Ian