[Bug c/118997] Wrong struct padding or documentation is misleading

2025-02-24 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118997 --- Comment #8 from Jakub Jelinek --- The documentation is fairly clear that it affects that: https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html Although the size of a zero-length array is zero, an array member of this kind may increase the siz

[Bug c/118997] Wrong struct padding or documentation is misleading

2025-02-24 Thread vincenzo.romano at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118997 --- Comment #7 from Vincenzo Romano --- Quoting from "6.18 Arrays of Length Zero" > Declaring zero-length arrays is allowed in GNU C as an extension. I would say that under GNU C it is an extension. Or that the documentation needs some review

[Bug c/118997] Wrong struct padding or documentation is misleading

2025-02-24 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118997 --- Comment #6 from Jonathan Wakely --- You don't even need the 'two' member to get the same effect: typedef struct _test { _Alignas(long double) void* one; } _test; If the structure has to be aligned, then you will get padding after the 'on

[Bug c/118997] Wrong struct padding or documentation is misleading

2025-02-24 Thread xry111 at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118997 Xi Ruoyao changed: What|Removed |Added CC||xry111 at gcc dot gnu.org --- Comment #5 fr

[Bug c/118997] Wrong struct padding or documentation is misleading

2025-02-24 Thread vincenzo.romano at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118997 --- Comment #4 from Vincenzo Romano --- I think that an explicit statement in the documentation should be added, then. After all the zero-sized array field is both an extension (thus not in the standard manual) and a special case within the exte

[Bug c/118997] Wrong struct padding or documentation is misleading

2025-02-24 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118997 --- Comment #3 from Richard Biener --- (In reply to Jakub Jelinek from comment #2) > Your expectations are wrong. > If sizeof(void*) == 8 and alignof(long double) == 16, then padding needs to > be inserted > before the two member such that it is

[Bug c/118997] Wrong struct padding or documentation is misleading

2025-02-24 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118997 Jakub Jelinek changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED CC|

[Bug c/118997] Wrong struct padding or documentation is misleading

2025-02-24 Thread vincenzo.romano at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118997 --- Comment #1 from Vincenzo Romano --- As a third option, you could add to the documentation a "caveat" statement when the developer IS NOT using char as the base type for the trailing zero-sized array field.