PR tree-optimization/83369 - Missing diagnostics during inlining
[official-gcc.git] / gcc / testsuite / gcc.dg / pr39565.c
blob9c14055a43a05cf0993573fd87d91e8d6ae9732b
1 /* PR39565: Static variable leaves undefined symbol in object file.
2 Variables codestrs_4 and codestrs_8 should not be undefined,
3 when this program is compiled at -O2. As a basic sanity test,
4 verify that this program compiles into an executable and runs. */
6 /* { dg-do run } */
7 /* { dg-options "-O2" } */
9 extern void abort (void);
10 extern void exit (int);
11 extern int strcmp (const char *, const char *);
13 static const union codestrs_t_4 {
14 struct {
15 char str_2[sizeof ("Illegal opcode")];
17 char str[0];
18 } codestrs_4 = { {"Illegal opcode"} };
20 static const union codestrs_t_8 {
21 struct {
22 char str_12[sizeof ("Integer divide by zero")];
24 char str[0];
25 } codestrs_8 = { {"Integer divide by zero"} };
27 const char *
28 psiginfo (int pinfo)
30 const char *base = ((void *)0);
32 switch (pinfo)
34 case 4: base = codestrs_4.str; break;
35 case 8: base = codestrs_8.str; break;
37 return base;
40 int
41 main (void)
43 if (strcmp (psiginfo (4), codestrs_4.str))
44 abort ();
45 if (strcmp (psiginfo (8), codestrs_8.str))
46 abort ();
47 exit (0);