comparison gcc/testsuite/gcc.c-torture/execute/20030222-1.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children 1830386684a0
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 /* Verify that we get the low part of the long long as an int. We
2 used to get it wrong on big-endian machines, if register allocation
3 succeeded at all. We use volatile to make sure the long long is
4 actually truncated to int, in case a single register is wide enough
5 for a long long. */
6 /* { dg-skip-if "asm would require extra shift-left-4-byte" { spu-*-* } } */
7 /* { dg-skip-if "asm requires register allocation" { nvptx-*-* } } */
8 #include <limits.h>
9
10 void
11 ll_to_int (long long x, volatile int *p)
12 {
13 int i;
14 asm ("" : "=r" (i) : "0" (x));
15 *p = i;
16 }
17
18 int val = INT_MIN + 1;
19
20 int main() {
21 volatile int i;
22
23 ll_to_int ((long long)val, &i);
24 if (i != val)
25 abort ();
26
27 exit (0);
28 }