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 c++/34747] __attribute__((aligned(x)))+__alignof != correct behaviour


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=34747

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |msebor at gcc dot gnu.org
             Blocks|                            |58601
         Resolution|---                         |DUPLICATE

--- Comment #5 from Martin Sebor <msebor at gcc dot gnu.org> ---
When compiled with the current trunk (7.0), the test produces the output below
(same as in comment #4).  After reviewing the tests I believe all the failures
are false positives.  The failing tests assume that a #pragma pack directive
doesn't affect the alignment of struct members.  However, according to GCC
documentation for attribute packed: "Specifying this attribute [packed] for
struct and union types is equivalent to specifying the packed attribute on each
of the structure or union members."  And specifying the attribute on a member
reduces its alignment to the one specified.  So test5, for instance, expects
the alignment of a struct defined just following #pragma pack not to be
affected by the #pragma.  Similarly for all the other failing tests.  Since the
valid tests pass (fixed by PR 10179) I'll go ahead and close this report as a
duplicate of that bug.  (Based on the summary of this I'm assuming the
expectation is that #pragma pack have the same effect as attribute packed and
not something else.)

FAILED: test5
FAILED: test7
FAILED: test20
FAILED: test21
FAILED: test25
FAILED: test26
FAILED: test37
FAILED: test46
FAILED: test47
FAILED: test48
10 tests failed!

*** This bug has been marked as a duplicate of bug 10179 ***


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58601
[Bug 58601] [meta-bug] alignas

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