OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [const-elim-1.c] - Blame information for rev 689

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* 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.)  */
7
 
8
/* { dg-do compile } */
9
/* { dg-options "-O2 -std=c99" } */
10
/* { dg-final { scan-assembler-not "L\\\$?C\[^A-Z\]" } } */
11
 
12
#define I (__extension__ 1.0iF)
13
 
14
struct S { int a; double b[2]; void *c; };
15
 
16
extern void use_str(const char *);
17
extern void use_S(const struct S *);
18
extern void use_cplx(__complex__ double);
19
 
20
static inline int
21
returns_23(void) { return 23; }
22
 
23
void
24
test1(void)
25
{
26
        if (returns_23() == 23)
27
                return;
28
 
29
        use_str("waltz, nymph, for quick jigs vex bud");
30
        use_S(&(const struct S){12, {3.1415, 2.1828}, 0 });
31
        use_cplx(3.1415 + 2.1828*I);
32
}
33
 
34
void
35
test2(void)
36
{
37
        const char *str = "pack my box with five dozen liquor jugs";
38
        const struct S S = { 23, { 1.414, 1.618 }, 0 };
39
        const __complex__ double cplx = 1.414 + 1.618*I;
40
 
41
        if (returns_23() == 23)
42
                return;
43
 
44
        use_str(str);
45
        use_S(&S);
46
        use_cplx(cplx);
47
}
48
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.