[Bug c++/47273] References to unaligned packed structure members not allowed

2011-01-14 Thread pinskia at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47273 Andrew Pinski changed: What|Removed |Added Status|NEW |RESOLVED Resolution|

[Bug c++/47273] References to unaligned packed structure members not allowed

2011-01-14 Thread rguenth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47273 --- Comment #8 from Richard Guenther 2011-01-14 16:02:06 UTC --- It works with typedef int T __attribute__((aligned(1))); struct s { T a; T& GetValr() { return a; } } __attribute__((packed)); int main() { struct s s1; s1.GetVa

[Bug c++/47273] References to unaligned packed structure members not allowed

2011-01-14 Thread rguenth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47273 Richard Guenther changed: What|Removed |Added Status|WAITING |NEW Component|c

[Bug c/47273] References to unaligned packed structure members not allowed

2011-01-14 Thread waldemarbancewicz at ruggedcom dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47273 --- Comment #6 from Waldemar Valdas Bancewicz 2011-01-14 15:42:57 UTC --- About Comment #4: This is a question to the GCC/G++ team. How are unaligned pointers dealt with? I came up with the following possible options: (1) Compiler inserts the fo

[Bug c/47273] References to unaligned packed structure members not allowed

2011-01-14 Thread waldemarbancewicz at ruggedcom dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47273 --- Comment #5 from Waldemar Valdas Bancewicz 2011-01-14 14:08:26 UTC --- Created attachment 22966 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22966 testcase

[Bug c/47273] References to unaligned packed structure members not allowed

2011-01-14 Thread waldemarbancewicz at ruggedcom dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47273 --- Comment #4 from Waldemar Valdas Bancewicz 2011-01-14 14:04:19 UTC --- The reason pointers and references are treated differently: Consider the following code fragment: struct s { char a; int b; int* GetValp() { return &b; } /

[Bug c/47273] References to unaligned packed structure members not allowed

2011-01-14 Thread waldemarbancewicz at ruggedcom dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47273 --- Comment #3 from Waldemar Valdas Bancewicz 2011-01-14 13:44:04 UTC --- This bug has to do with g++, not gcc. Should I delete this bug and re-submit?

[Bug c/47273] References to unaligned packed structure members not allowed

2011-01-14 Thread waldemarbancewicz at ruggedcom dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47273 --- Comment #2 from Waldemar Valdas Bancewicz 2011-01-14 13:42:03 UTC --- Consider the following program test.c: #include struct s { char a; int b; int* GetValp() { return &b; } int& GetValr() { return b; } } __attribute__((pack

[Bug c/47273] References to unaligned packed structure members not allowed

2011-01-13 Thread rguenth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47273 Richard Guenther changed: What|Removed |Added Status|UNCONFIRMED |WAITING Last reconfirmed|