From: Sebastian Pop Date: Fri, 8 Jan 2010 08:04:35 +0000 (+0000) Subject: re PR tree-optimization/42221 (ICE from '-Os -fgraphite-identity') X-Git-Tag: releases/gcc-4.5.0~1339 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4e98c66c4fa2d8f4cb09d589ad909895eb247880;p=thirdparty%2Fgcc.git re PR tree-optimization/42221 (ICE from '-Os -fgraphite-identity') Fix PR42221. 2009-12-23 Sebastian Pop PR middle-end/42221 * sese.c (expand_scalar_variables_expr): Follow the SSA links into the array indexing of ADDR_EXPRs. * testsuite/gcc.dg/graphite/pr42221.c: New. From-SVN: r155731 --- diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite index 165f7ebec972..b093edd8d52b 100644 --- a/gcc/ChangeLog.graphite +++ b/gcc/ChangeLog.graphite @@ -1,3 +1,11 @@ +2010-01-07 Sebastian Pop + + PR middle-end/42221 + * sese.c (expand_scalar_variables_expr): Follow the SSA links into + the array indexing of ADDR_EXPRs. + + * testsuite/gcc.dg/graphite/pr42221.c: New. + 2010-01-07 Sebastian Pop PR middle-end/42521 diff --git a/gcc/sese.c b/gcc/sese.c index e59fdf667d0c..4950c08b586c 100644 --- a/gcc/sese.c +++ b/gcc/sese.c @@ -874,7 +874,20 @@ expand_scalar_variables_expr (tree type, tree op0, enum tree_code code, return expand_scalar_variables_ssa_name (op0, bb, region, map, gsi); if (code == ADDR_EXPR) - return op0; + { + tree op00 = TREE_OPERAND (op0, 0); + + if (handled_component_p (op00) + && TREE_CODE (op00) == ARRAY_REF) + { + tree e = expand_scalar_variables_expr (TREE_TYPE (op00), op00, + TREE_CODE (op00), + NULL, bb, region, map, gsi); + return fold_build1 (code, TREE_TYPE (op0), e); + } + + return op0; + } gcc_unreachable (); return NULL; diff --git a/gcc/testsuite/gcc.dg/graphite/pr42221.c b/gcc/testsuite/gcc.dg/graphite/pr42221.c new file mode 100644 index 000000000000..da8daa1e2a11 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr42221.c @@ -0,0 +1,24 @@ +/* { dg-options "-Os -fgraphite-identity" } */ + +static void b2w(unsigned int *out, const unsigned char *in, unsigned int len) +{ + const unsigned char *bpend = in + len; + for (; in != bpend; in += 4, ++out) + { + *out = (unsigned int) (in[0] ) | + (unsigned int) (in[3] << 24); + } +} +static void md4step(unsigned int state[4], const unsigned char *data) +{ + unsigned int A, X[16]; + b2w(X, data, 64); + state[0] += A; +} +void md4sum(void) +{ + unsigned char final[128]; + unsigned int state[4]; + md4step(state, final); + md4step(state, final + 64); +}