File: 20020219-1.c

package info (click to toggle)
gcc-riscv64-unknown-elf 8.3.0.2019.08%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 680,956 kB
  • sloc: ansic: 3,237,715; cpp: 896,882; ada: 772,854; f90: 144,254; asm: 68,788; makefile: 67,456; sh: 29,743; exp: 28,045; objc: 15,273; fortran: 11,885; python: 7,369; pascal: 5,375; awk: 3,725; perl: 2,872; yacc: 316; xml: 311; ml: 285; lex: 198; haskell: 122
file content (50 lines) | stat: -rw-r--r-- 1,497 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/* PR c/4389
   This testcase failed because host_integerp (x, 0) was returning
   1 even for constants bigger than 2^31.  It fails under hppa
   hpux without -mdisable-indexing because the pointer x - 1 is used
   as the base address of an indexed load.  Because the struct A is not
   actually allocated, x - 1 lies in the text segment and this causes
   the wrong space register to be selected for the load.  It fails on
   IA64 hpux in ILP32 mode because extending x - 1 before adding the
   array offset gives a different answer then adding first and then
   extending.  The underlying problem is the same as with hppa, x - 1 is
   not a legal data address.  It also fails on x32 targets for the
   same reason.  */
/* { dg-do run } */
/* { dg-options "-O2" } */
/* { dg-options "-O2 -mdisable-indexing" { target hppa*-*-hpux* } } */
/* { dg-skip-if "" { aarch64*-*-* && ilp32 } } */
/* { dg-skip-if "" { "ia64-*-hpux*" } "*" "-mlp64" } */
/* { dg-skip-if "" { { i?86-*-* x86_64-*-* } && x32 } } */

/* Disable the test entirely for 16-bit targets.  */
#if __INT_MAX__ > 32767

extern void abort (void);
extern void exit (int);
struct A {
  int a[10000][10000];
};
int b[2] = { 213151, 0 };

void foo (struct A *x, int y)
{
  if (x->a[9999][9999] != x->a[y][y])
    abort ();
  if (x->a[9999][9999] != 213151)
    abort ();
}

int main (void)
{
  struct A *x;
  asm ("" : "=r" (x) : "0" (&b[1]));
  foo (x - 1, 9999);
  exit (0);
}

#else

int main () { return 0; }

#endif /* __INT_MAX__ */