[Bug c/96293] Extraneously noisy "taking address of packed member may result in an unaligned pointer value"

2022-07-07 Thread lavr at ncbi dot nlm.nih.gov via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96293 --- Comment #10 from lavr at ncbi dot nlm.nih.gov --- > In your code, `>record.data[0]` is not a well-aligned access It is well-aligned, its offset gets printed out by the very test code, and it's 2. > because `struct attribute` is defined as

[Bug c/96293] Extraneously noisy "taking address of packed member may result in an unaligned pointer value"

2022-07-07 Thread ldeng at mail dot ustc.edu.cn via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96293 --- Comment #9 from Long Deng --- I take your point, although there seems to be a slight problem with your example. In your code, `>record.data[0]` is not a well-aligned access, because `struct attribute` is defined as packed, so compiler has no

[Bug c/96293] Extraneously noisy "taking address of packed member may result in an unaligned pointer value"

2022-07-06 Thread lavr at ncbi dot nlm.nih.gov via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96293 --- Comment #8 from lavr at ncbi dot nlm.nih.gov --- Consider the following code: struct record { unsigned char len; unsigned short data[5]; } __attribute__((packed)); struct attribute { unsigned char code; struct record

[Bug c/96293] Extraneously noisy "taking address of packed member may result in an unaligned pointer value"

2022-07-06 Thread lavr at ncbi dot nlm.nih.gov via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96293 --- Comment #7 from lavr at ncbi dot nlm.nih.gov --- The problem with the aligned(4) attribute is that if this structure appears as a member of an outer packed structure, it may not be "enclosed" properly without a gap. The warnings are

[Bug c/96293] Extraneously noisy "taking address of packed member may result in an unaligned pointer value"

2022-07-06 Thread ldeng at mail dot ustc.edu.cn via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96293 --- Comment #6 from Long Deng --- I met the same problem. I found that gcc issue this warning probably because `struct S` can located any address, which means that `s.d` may not alignment to 4. So as Richard said, you can use

[Bug c/96293] Extraneously noisy "taking address of packed member may result in an unaligned pointer value"

2020-07-27 Thread lavr at ncbi dot nlm.nih.gov
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96293 --- Comment #5 from lavr at ncbi dot nlm.nih.gov --- My test case is not invalid. You're talking about base address of a structure, which would make offsets within it all unaligned, which is why I said "the same rule should apply for

[Bug c/96293] Extraneously noisy "taking address of packed member may result in an unaligned pointer value"

2020-07-27 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96293 Jakub Jelinek changed: What|Removed |Added CC||jakub at gcc dot gnu.org --- Comment #4

[Bug c/96293] Extraneously noisy "taking address of packed member may result in an unaligned pointer value"

2020-07-23 Thread lavr at ncbi dot nlm.nih.gov
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96293 lavr at ncbi dot nlm.nih.gov changed: What|Removed |Added Status|RESOLVED|UNCONFIRMED

[Bug c/96293] Extraneously noisy "taking address of packed member may result in an unaligned pointer value"

2020-07-23 Thread lavr at ncbi dot nlm.nih.gov
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96293 --- Comment #2 from lavr at ncbi dot nlm.nih.gov --- I don't want my structure to be aligned at the int boundary. I want my structure to reflect the actual data layout "byte","byte","short","int" as they are laid out without any gaps, and

[Bug c/96293] Extraneously noisy "taking address of packed member may result in an unaligned pointer value"

2020-07-23 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96293 Richard Biener changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|---