struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-pr41750.c
bloba48b8f35a10d717efba3cd642410eef0635cd016
1 /*
2 pr41750.c from the execute part of the gcc torture tests.
3 */
5 #include <testfwk.h>
7 #ifdef __SDCC
8 #pragma std_c99
9 #endif
11 /* PR 41750 - IPA-SRA used to pass hash->sgot by value rather than by
12 reference. */
14 struct bfd_link_hash_table
16 int hash;
19 struct foo_link_hash_table
21 struct bfd_link_hash_table root;
22 int *dynobj;
23 int *sgot;
26 struct foo_link_info
28 struct foo_link_hash_table *hash;
31 extern void abort (void);
33 int
34 foo_create_got_section (int *abfd, struct foo_link_info *info)
36 info->hash->sgot = abfd;
37 return 1;
40 static int *
41 get_got (int *abfd, struct foo_link_info *info,
42 struct foo_link_hash_table *hash)
44 int *got;
45 int *dynobj;
47 got = hash->sgot;
48 if (!got)
50 dynobj = hash->dynobj;
51 if (!dynobj)
52 hash->dynobj = dynobj = abfd;
53 if (!foo_create_got_section (dynobj, info))
54 return 0;
55 got = hash->sgot;
57 return got;
60 int *
61 elf64_ia64_check_relocs (int *abfd, struct foo_link_info *info)
63 return get_got (abfd, info, info->hash);
66 struct foo_link_info link_info;
67 struct foo_link_hash_table hash;
68 int abfd;
70 void
71 testTortureExecute (void)
73 link_info.hash = &hash;
74 if (elf64_ia64_check_relocs (&abfd, &link_info) != &abfd)
75 ASSERT (0);
76 return;