Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk. Richard.
2014-11-27 Richard Biener <rguent...@suse.de> PR middle-end/64088 * fold-const.c (const_unop): Re-instantiate missing condition before calling fold_abs_const. * gcc.dg/torture/pr64088.c: New testcase. Index: gcc/fold-const.c =================================================================== --- gcc/fold-const.c (revision 218121) +++ gcc/fold-const.c (working copy) @@ -1481,7 +1489,9 @@ const_unop (enum tree_code code, tree ty } case ABS_EXPR: - return fold_abs_const (arg0, type); + if (TREE_CODE (arg0) == INTEGER_CST || TREE_CODE (arg0) == REAL_CST) + return fold_abs_const (arg0, type); + break; case CONJ_EXPR: if (TREE_CODE (arg0) == COMPLEX_CST) Index: gcc/testsuite/gcc.dg/torture/pr64088.c =================================================================== --- gcc/testsuite/gcc.dg/torture/pr64088.c (revision 0) +++ gcc/testsuite/gcc.dg/torture/pr64088.c (working copy) @@ -0,0 +1,17 @@ +/* { dg-do compile } */ + +extern int abs (int); +extern void attenuate_curve(int*); +int a; +void +setup_tone_curves_center_boost () +{ + int b[0]; + a = 0; + for (; a < 6; a++) + { + int c = abs (a); + b[a] = c; + } + attenuate_curve (b); +}