This is the mail archive of the gcc-bugs@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]

[Bug middle-end/39954] [4.5 Regression] Revision 146817 caused unaligned access in gcc.dg/torture/pr26565.c



------- 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


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