From: Adam Nemet Date: Fri, 16 Jan 2009 18:56:47 +0000 (+0000) Subject: re PR target/38554 (ICE when compiling pamfunc.c in netpbm with -O1 enabled) X-Git-Tag: releases/gcc-4.4.0~836 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c1cb09ada04abbf0087eafedaab7b3ec32b23659;p=thirdparty%2Fgcc.git re PR target/38554 (ICE when compiling pamfunc.c in netpbm with -O1 enabled) PR target/38554 * expmed.c (expand_shift): With SHIFT_COUNT_TRUNCATED, don't lift the subreg from a lowpart subreg if it is also casting the value. testsuite/ PR target/38554 * gcc.c-torture/compile/pr38554.c: New test. From-SVN: r143440 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b6e30e058eb2..3c2457d84e61 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2009-01-16 Adam Nemet + + PR target/38554 + * expmed.c (expand_shift): With SHIFT_COUNT_TRUNCATED, don't lift + the subreg from a lowpart subreg if it is also casting the value. + 2009-01-16 Sebastian Pop Tobias Grosser diff --git a/gcc/expmed.c b/gcc/expmed.c index 9ee5f29883d0..da0db3b83473 100644 --- a/gcc/expmed.c +++ b/gcc/expmed.c @@ -2136,7 +2136,8 @@ expand_shift (enum tree_code code, enum machine_mode mode, rtx shifted, op1 = GEN_INT ((unsigned HOST_WIDE_INT) INTVAL (op1) % GET_MODE_BITSIZE (mode)); else if (GET_CODE (op1) == SUBREG - && subreg_lowpart_p (op1)) + && subreg_lowpart_p (op1) + && INTEGRAL_MODE_P (GET_MODE (SUBREG_REG (op1)))) op1 = SUBREG_REG (op1); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 96b4ce583d73..4a41a218ab17 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-01-16 Adam Nemet + + PR target/38554 + * gcc.c-torture/compile/pr38554.c: New test. + 2009-01-16 Jason Merrill PR c++/38579 diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38554.c b/gcc/testsuite/gcc.c-torture/compile/pr38554.c new file mode 100644 index 000000000000..7d40a223be0c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr38554.c @@ -0,0 +1,45 @@ +typedef unsigned long sample; +struct pam +{ + sample maxval; +}; +typedef sample *tuple; +enum function + { + FN_MULTIPLY, FN_DIVIDE, FN_ADD, FN_SUBTRACT, FN_MIN, FN_MAX, FN_AND, FN_OR, + FN_XOR, FN_NOT, FN_SHIFTLEFT, FN_SHIFTRIGHT + }; +struct cmdlineInfo +{ + enum function function; + union + { + float divisor; + unsigned int shiftCount; + } + u; +}; +applyFunction (struct cmdlineInfo const cmdline, struct pam const inpam, + struct pam const outpam, tuple * const inputRow, + tuple * const outputRow) +{ + float const oneOverDivisor = 1 / cmdline.u.divisor; + int col; + { + int plane; + { + sample const inSample = inputRow[col][plane]; + sample outSample; + switch (cmdline.function) + { + case FN_DIVIDE: + outSample = ((unsigned int) ((inSample * oneOverDivisor) + 0.5)); + break; + case FN_SHIFTLEFT: + outSample = (inSample << cmdline.u.shiftCount) & outpam.maxval; + } + outputRow[col][plane] = + ((outpam.maxval) < (outSample) ? (outpam.maxval) : (outSample)); + } + } +}