This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/39954] [4.5 Regression] Revision 146817 caused unaligned access in gcc.dg/torture/pr26565.c
- From: "hjl dot tools at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Apr 2009 00:42:07 -0000
- Subject: [Bug middle-end/39954] [4.5 Regression] Revision 146817 caused unaligned access in gcc.dg/torture/pr26565.c
- References: <bug-39954-682@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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