PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / pr41750.c
blob3f5cb635d16c010e4b3905e3f4861bc1ebf4439b
1 /* PR 41750 - IPA-SRA used to pass hash->sgot by value rather than by
2 reference. */
4 struct bfd_link_hash_table
6 int hash;
7 };
9 struct foo_link_hash_table
11 struct bfd_link_hash_table root;
12 int *dynobj;
13 int *sgot;
16 struct foo_link_info
18 struct foo_link_hash_table *hash;
21 extern void abort (void);
23 int __attribute__((noinline))
24 foo_create_got_section (int *abfd, struct foo_link_info *info)
26 info->hash->sgot = abfd;
27 return 1;
30 static int *
31 get_got (int *abfd, struct foo_link_info *info,
32 struct foo_link_hash_table *hash)
34 int *got;
35 int *dynobj;
37 got = hash->sgot;
38 if (!got)
40 dynobj = hash->dynobj;
41 if (!dynobj)
42 hash->dynobj = dynobj = abfd;
43 if (!foo_create_got_section (dynobj, info))
44 return 0;
45 got = hash->sgot;
47 return got;
50 int * __attribute__((noinline,noclone))
51 elf64_ia64_check_relocs (int *abfd, struct foo_link_info *info)
53 return get_got (abfd, info, info->hash);
56 struct foo_link_info link_info;
57 struct foo_link_hash_table hash;
58 int abfd;
60 int
61 main ()
63 link_info.hash = &hash;
64 if (elf64_ia64_check_relocs (&abfd, &link_info) != &abfd)
65 abort ();
66 return 0;