From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25907 invoked by alias); 27 Jan 2015 12:38:53 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 14300 invoked by uid 55); 27 Jan 2015 12:38:44 -0000 From: "rguenther at suse dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/64798] [5 regression] g++.old-deja/g++.eh/badalloc1.C FAILs Date: Tue, 27 Jan 2015 12:38:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenther at suse dot de X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 5.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-01/txt/msg03076.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64798 --- Comment #11 from rguenther at suse dot de --- On Tue, 27 Jan 2015, jakub at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64798 > > --- Comment #10 from Jakub Jelinek --- > __BIGGEST_ALIGNMENT__ has nothing to do with alignment of malloc returned > memory. > The union I've mentioned is a reasonable guess (something actually mandated by > the standard), glibc right now guarantees 2 * sizeof (void *) (which is wrong > for ppc32). For malloc alignment, we've added an attribute for that, but glibc > maintainers haven't added it to their headers :( and obviously other libcs > neither. I can drop __BIGGEST_ALIGNMENT__ and use alignof (allocated_entry::data) which is aligned via __attribute__((aligned)) by the patch (same trick that badalloc1.C uses). That attribute trick is documented as "Alternatively, you can leave out the alignment factor and just ask the compiler to align a variable or field to the default alignment for the target architecture you are compiling for. The default alignment is sufficient for all scalar types, but may not be enough for all vector types on a target that supports vector operations. The default alignment is fixed for a particular target ABI." but then "GCC also provides a target specific macro @code{__BIGGEST_ALIGNMENT__}, which is the largest alignment ever used for any data type on the target machine you are compiling for." and the following example suggests that the first doesn't necessarily matches the second. Though testing on x86_64 reveals that __attribute__((aligned)) aligns to 16 bytes as well.