public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenther at suse dot de" <gcc-bugzilla@gcc.gnu.org>
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:27:00 -0000 [thread overview]
Message-ID: <bug-64798-4-29RWKbhjuP@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-64798-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64798
--- Comment #8 from rguenther at suse dot de <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
>
> Jakub Jelinek <jakub at gcc dot gnu.org> changed:
>
> What |Removed |Added
> ----------------------------------------------------------------------------
> CC| |jakub at gcc dot gnu.org
>
> --- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
> __BIGGEST_ALIGNMENT__ is unnecessarily large, e.g. on i?86-linux, it is 16,
> while you only need to guarantee 8-byte alignment.
> Isn't the bug just in the badalloc1.C testcase, if it provides its own malloc,
> it should IMHO guarantee the system malloc alignments (generally, something
> like alignment of
> union U
> {
> long long ll;
> double d;
> long double ld;
> void *p;
> };
> .
no, badalloc1.C provides __BIGGEST_ALIGNMENT__ aligned memory. The bug
is in the EH allocator which allocates the extra size_t entry aligned
but the EH object itself only size_t aligned. It's documented
that __attribute__((aligned)) aligns to the biggest type so using
__BIGGEST_ALIGNMENT__ looks correct here - this is also what malloc ()
guarantees for alignment, no? Do we have any other means of getting
the same alignment as malloc () provides?
Btw, it still wastes a lot less space than the previous allocator.
Bug in the patch anyway and the following hunk is also needed:
@@ -185,7 +186,7 @@ namespace
{
__gnu_cxx::__scoped_lock sentry(emergency_mutex);
allocated_entry *e = reinterpret_cast <allocated_entry *>
- (reinterpret_cast <char *> (data) - sizeof (std::size_t));
+ (reinterpret_cast <char *> (data) - offsetof (allocated_entry,
data));
std::size_t sz = e->size;
if (!first_free_entry)
{
next prev parent reply other threads:[~2015-01-27 12:27 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-26 13:52 [Bug libstdc++/64798] New: " ro at gcc dot gnu.org
2015-01-26 13:53 ` [Bug libstdc++/64798] " ro at gcc dot gnu.org
2015-01-26 15:00 ` rguenther at suse dot de
2015-01-26 15:02 ` rguenther at suse dot de
2015-01-26 15:23 ` rguenth at gcc dot gnu.org
2015-01-26 15:45 ` ro at CeBiTec dot Uni-Bielefeld.DE
2015-01-27 10:58 ` rguenth at gcc dot gnu.org
2015-01-27 12:10 ` jakub at gcc dot gnu.org
2015-01-27 12:16 ` ro at CeBiTec dot Uni-Bielefeld.DE
2015-01-27 12:27 ` rguenther at suse dot de [this message]
2015-01-27 12:31 ` rguenth at gcc dot gnu.org
2015-01-27 12:33 ` jakub at gcc dot gnu.org
2015-01-27 12:38 ` rguenther at suse dot de
2015-01-27 12:40 ` rguenth at gcc dot gnu.org
2015-01-27 12:42 ` jakub at gcc dot gnu.org
2015-01-27 12:51 ` rguenther at suse dot de
2015-01-27 12:52 ` jakub at gcc dot gnu.org
2015-01-28 9:54 ` rguenth at gcc dot gnu.org
2015-01-28 10:01 ` rguenth at gcc dot gnu.org
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-64798-4-29RWKbhjuP@http.gcc.gnu.org/bugzilla/ \
--to=gcc-bugzilla@gcc.gnu.org \
--cc=gcc-bugs@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).