2011-09-01 Andrew Stubbs gcc/ * config/arm/predicates.md (shift_amount_operand): Ensure shift amount is positive. gcc/testsuite/ * gcc.dg/pr50193-1.c: New file. === modified file 'gcc/config/arm/predicates.md' --- old/gcc/config/arm/predicates.md 2011-09-05 09:40:19 +0000 +++ new/gcc/config/arm/predicates.md 2011-09-12 11:24:34 +0000 @@ -132,7 +132,8 @@ (define_predicate "shift_amount_operand" (ior (and (match_test "TARGET_ARM") (match_operand 0 "s_register_operand")) - (match_operand 0 "const_int_operand"))) + (and (match_operand 0 "const_int_operand") + (match_test "INTVAL (op) > 0")))) (define_predicate "arm_add_operand" (ior (match_operand 0 "arm_rhs_operand") === added file 'gcc/testsuite/gcc.dg/pr50193-1.c' --- old/gcc/testsuite/gcc.dg/pr50193-1.c 1970-01-01 00:00:00 +0000 +++ new/gcc/testsuite/gcc.dg/pr50193-1.c 2011-09-01 12:22:14 +0000 @@ -0,0 +1,10 @@ +/* PR 50193: ARM: ICE on a | (b << negative-constant) */ +/* Ensure that the compiler doesn't ICE. */ + +/* { dg-options "-O2" } */ + +int +foo(int a, int b) +{ + return a | (b << -3); /* { dg-warning "left shift count is negative" } */ +}