* gcc.dg/const-elim-1.c: xfail for xtensa.
[official-gcc.git] / gcc / testsuite / gcc.dg / const-elim-1.c
blobb68abfc917cdad07a8e6e8da19ca48cb05d514e2
1 /* Verify that constants in memory, referenced only by dead code,
2 are not emitted to the object file.
3 FIXME: Not presently possible to apply -pedantic to code with
4 complex constants in it. The __extension__ should shut up the
5 warning but doesn't. (Hard to fix -- the lexer is not aware of
6 the parser's state.) */
8 /* { dg-do compile } */
9 /* { dg-options "-O2 -std=c99" } */
10 /* This test fails on ARM and Xtensa cores because we use a block move to
11 initialize "S" in test2, and GCC is not clever enough to eliminate
12 the block move. */
13 /* { dg-final { scan-assembler-not "L\\\$?C\[^A-Z\]" { xfail arm-*-* strongarm-*-* xscale-*-* powerpc*-*-aix* xtensa-*-* } } } */
15 #define I (__extension__ 1.0iF)
17 struct S { int a; double b[2]; void *c; };
19 extern void use_str(const char *);
20 extern void use_S(const struct S *);
21 extern void use_cplx(__complex__ double);
23 static inline int
24 returns_23(void) { return 23; }
26 void
27 test1(void)
29 if (returns_23() == 23)
30 return;
32 use_str("waltz, nymph, for quick jigs vex bud");
33 use_S(&(const struct S){12, {3.1415, 2.1828}, 0 });
34 use_cplx(3.1415 + 2.1828*I);
37 void
38 test2(void)
40 const char *str = "pack my box with five dozen liquor jugs";
41 const struct S S = { 23, { 1.414, 1.618 }, 0 };
42 const __complex__ double cplx = 1.414 + 1.618*I;
44 if (returns_23() == 23)
45 return;
47 use_str(str);
48 use_S(&S);
49 use_cplx(cplx);