[Bug tree-optimization/51990] ICE in copy_reference_ops_from_ref
vries at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Jan 25 12:10:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51990
vries at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |UNCONFIRMED
Ever Confirmed|1 |0
--- Comment #5 from vries at gcc dot gnu.org 2012-01-25 11:41:50 UTC ---
(In reply to comment #4)
> (In reply to comment #1)
> I think there are a lot of bugs lurking in the compiler with respect to
> not handling WITH_SIZE_EXPR (which incidentially isn't a handled-component,
> nor tcc_reference ...). You btw. also need to handle re-materializing
> them in create_component_ref_by_pieces_1.
Indeed. Using the proposed patch and this example:
...
int y;
extern int foo (int, ...) __attribute__((pure));
int
zzz (char *s1, char *s2, int len, int *q, int c)
{
int z = 5;
unsigned int i, b;
struct s { char a[z]; };
struct s x;
int y_tmp = 5;
for (i = 0; i < len; i++)
s1[i] = s2[i];
b = z & 0x3;
len += (b == 0 ? 0 : 1) + z;
*q = len;
if (c)
y_tmp = foo (z, x, x) + 4;
z = foo (z, x, x) + 4;
y = y_tmp;
return z;
}
...
I hit this ICE:
...
test2.c: In function ‘zzz’:
test2.c:5:1: internal compiler error: in create_component_ref_by_pieces_1, at
tree-ssa-pre.c:2925
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
...
tentative patch:
...
Index: tree-ssa-pre.c
===================================================================
--- tree-ssa-pre.c (revision 183325)
+++ tree-ssa-pre.c (working copy)
@@ -2780,6 +2780,7 @@ create_component_ref_by_pieces_1 (basic_
case REALPART_EXPR:
case IMAGPART_EXPR:
case VIEW_CONVERT_EXPR:
+ case WITH_SIZE_EXPR:
{
tree folded;
tree genop0 = create_component_ref_by_pieces_1 (block, ref,
@@ -2787,8 +2788,12 @@ create_component_ref_by_pieces_1 (basic_
stmts, domstmt);
if (!genop0)
return NULL_TREE;
- folded = fold_build1 (currop->opcode, currop->type,
- genop0);
+
+ folded
+ = (currop->opcode == WITH_SIZE_EXPR
+ ? fold_build2 (currop->opcode, currop->type, genop0, currop->op0)
+ : fold_build1 (currop->opcode, currop->type, genop0));
+
return folded;
}
break;
...
More information about the Gcc-bugs
mailing list