This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Incorrect bitfield aliasing with Tree SSA


Richard Kenner writes:
> Otherwise, if you have
> 
> 	struct foo {int a: 32; int b: 32; };
> 	struct bar {int c: 32; int d: 32; };
> 
> you have the fields A and C conflicting, which is wrong.

Well, that is where structure-field aliasing comes in.  The two cannot
even alias for addressable fields:

struct s 
{ 
  int a; 
  int b; 
}; 
 
struct t 
{ 
  int a; 
  int b; 
}; 
 
struct s *a; 
struct t *b; 
 
main () 
{ 
  a->a = 1; 
  b->a = 2; 
  return a->a; 
} 

        movq    a(%rip), %rax
        movl    $1, (%rax)
        movq    b(%rip), %rax
        movl    $2, (%rax)
        movl    $1, %eax
        ret

Adam


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]