Bug 1208989
| Summary: | GCC 5 no longer honors align attribute on complicated typedef | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Michael Catanzaro <mcatanzaro> | ||||
| Component: | gcc | Assignee: | Jakub Jelinek <jakub> | ||||
| Status: | CLOSED ERRATA | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||
| Severity: | unspecified | Docs Contact: | |||||
| Priority: | unspecified | ||||||
| Version: | 22 | CC: | davejohansen, jakub, law, mcatanzaro, mpolacek, zan | ||||
| Target Milestone: | --- | ||||||
| Target Release: | --- | ||||||
| Hardware: | x86_64 | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | gcc-5.0.1-0.1.fc22 | Doc Type: | Bug Fix | ||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2015-04-21 18:40:18 UTC | Type: | Bug | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Bug Depends On: | |||||||
| Bug Blocks: | 1214354 | ||||||
| Attachments: |
|
||||||
|
Description
Michael Catanzaro
2015-04-04 21:59:42 UTC
(In reply to Michael Catanzaro from comment #0) > Description of problem: We're getting some serious crashes in WebKit that > were traced to GCC 5 no longer honoring the aligned attribute on a > complicated typedef: > > typedef double Matrix4[4][4] __attribute__((aligned (16))); > > ^ That worked in GCC 4.9, but no longer works in GCC 5.0. Hm, it works in general. This test does NOT demonstrate the bug; it works fine with both versions of GCC so long as the attribute is present on the typedef: #include <stdio.h> typedef double Matrix4[4][4] __attribute__((aligned (16))); struct s { char a, b, c; // random variables to throw off alignment Matrix4 m; }; int main () { struct s s; Matrix4 m; char c; // again just trying to throw off alignment Matrix4 mm; printf ("Last digit should be 0: %p\n", s.m); printf ("Last digit should be 0: %p\n", m); printf ("Last digit should be 0: %p\n", mm); return 0; } So I'm not sure what is causing the problem. I guess the thing to do is try to work backwards from the WebKit code. This will be a pain. :( Created attachment 1011289 [details]
Preprocessed TransformationMatrix.cpp file
Attached is the preprocessed file where the problem manifests.
The Matrix4 type is defined on line 98480.
At the bottom of the file are two static_assert statements that test the alignment of the TransformationMatrix and TransformationMatrix::Matrix4 types, expecting 16 as the result. Both fail when compiling with g++-5 on Debian:
$ g++-5 -std=c++11 -c TransformationMatrix.E.cpp
This looks similar to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48138 which suggests there be dragons here, although that doesn't explain what changed between GCC 4.9 and 5.0. Note "but the core problem seems to be that alignments on typedefs aren't supported" from the upstream bug can't be correct, as http://gcc.gnu.org/onlinedocs/gcc/Type-Attributes.html introduces the attribute by demonstrating its use on a typedef. gcc-5.0.1-0.1.fc22 has been submitted as an update for Fedora 22. https://admin.fedoraproject.org/updates/gcc-5.0.1-0.1.fc22 gcc-5.0.1-0.1.fc22, libtool-2.4.2-33.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report. |