This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Bug x86 backend 4.8.1?
- From: Hendrik Greving <hendrik dot greving dot intel at gmail dot com>
- To: GCC Development <gcc at gcc dot gnu dot org>
- Date: Tue, 1 Oct 2013 14:59:18 -0700
- Subject: Bug x86 backend 4.8.1?
- Authentication-results: sourceware.org; auth=none
gcc --version
gcc (GCC) 4.8.1
(4.7.2 seems to work)
gcc -g -fPIC -O2 -Wall -o test test.c
./test
type_a is 0x0
Correct would be 0x14000. I don't see how the C-code could be
ambiguous, I think this is a bug?
test.c:
#include <stdio.h>
typedef struct
{
unsigned int a:4;
unsigned int b:5;
unsigned int c:5;
unsigned int d:18;
} my_comb_t;
struct my_s
{
int l;
};
my_comb_t *getps_f (struct my_s *a);
#define GETPS(x) getps_f(&(x))
my_comb_t *
getps_f (struct my_s *a)
{
my_comb_t *p = (my_comb_t *) &(a->l);
return p;
}
int g_modes = 5;
int main(void)
{
int modes = g_modes;
int type_a = 0;
if (modes)
{
struct my_s m;
m.l = type_a;
my_comb_t *p = GETPS(m);
p->d |= modes;
type_a = m.l;
}
printf("type_a is 0x%x\n", type_a);
return 0;
}
Regards,
Hendrik Greving