------- Comment #8 from hjl dot tools at gmail dot com 2009-04-29 00:42 -------
This code:
---
void *memcpy(void *dest, const void *src, __SIZE_TYPE__ n);
struct timeval {
long tv_sec;
};
typedef struct timeval packed __attribute__((aligned(1)));
struct outdata {
long align;
char seq;
packed tv;
};
void send_probe(struct outdata *outdata, struct timeval *tp)
__attribute__((noin
line));
void send_probe(struct outdata *outdata, struct timeval *tp)
{
memcpy(&outdata->tv, tp, sizeof outdata->tv);
}
struct timeval t;
struct outdata outdata;
int main()
{
send_probe(&outdata, &t);
return 0;
}
---
works fine. It seems that we mishandled __attribute__((packed)).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39954