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
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
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
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
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
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
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
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96293
lavr at ncbi dot nlm.nih.gov changed:
What|Removed |Added
Status|RESOLVED|UNCONFIRMED
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
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96293
Richard Biener changed:
What|Removed |Added
Status|UNCONFIRMED |RESOLVED
Resolution|---
10 matches
Mail list logo