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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [testsuite/] [gcc.dg/] [tree-ssa/] [vrp14.c] - Blame information for rev 12

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 jlechner
/* { dg-do run } */
2
/* { dg-options "-O2" } */
3
 
4
struct tree_decl
5
{
6
  union tree_decl_u1 {
7
    int f;
8
    long i;
9
    struct tree_decl_u1_a {
10
      unsigned int align : 24;
11
      unsigned int off_align : 8;
12
    } a;
13
  } u1;
14
};
15
 
16
extern void abort (void);
17
 
18
unsigned int
19
assemble_variable (struct tree_decl decl)
20
{
21
  unsigned int align;
22
 
23
  align = decl.u1.a.align;
24
 
25
  if (align > (1 << ((8 * 4) < 64 ? (8 * 4) - 2 : 62)))
26
    align = (1 << ((8 * 4) < 64 ? (8 * 4) - 2 : 62));
27
 
28
  /* VRP should not be propagating 0 to the RHS of this assignment.
29
     But it was erroneously applying a cast operation between types of
30
     different precision.  align is an unsigned int with range [0,
31
     0x4000000] but the .align field holds only 24 bits.  So the cast
32
     was returning a [0, 0] range.  */
33
  decl.u1.a.align = align;
34
 
35
  return decl.u1.a.align;
36
}
37
 
38
main ()
39
{
40
  struct tree_decl decl;
41
  decl.u1.a.align = 13;
42
  unsigned int x = assemble_variable (decl);
43
  if (x == 0)
44
    abort ();
45
  return 0;
46
}

powered by: WebSVN 2.1.0

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