2009-07-17 Richard Guenther <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / torture / badshift.c
blob7288a374576cb0495580b5743799fcb8e55dc587
1 /* PR rtl-optimization/20532 */
3 /* { dg-do run } */
4 /* { dg-options "" } */
5 /* { dg-options "-march=i386" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
7 /* We used to optimize the DImode shift-by-32 to zero because in combine
8 we turned:
10 (v << 31) + (v << 31)
12 into:
14 (v * (((HOST_WIDE_INT)1 << 31) + ((HOST_WIDE_INT)1 << 31)))
16 With a 32-bit HOST_WIDE_INT, the coefficient overflowed to zero. */
18 unsigned long long int badshift(unsigned long long int v)
20 return v << 31 << 1;
23 extern void abort ();
25 int main() {
26 if (badshift (1) == 0)
27 abort ();
28 return 0;