public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: richard.guenther@gmail.com (Richard Biener)
Cc: mliska@suse.cz, gcc-patches@gcc.gnu.org
Subject: Re: Still crashes due to aliasing violation (Re: [RFC, PATCH] Split pool_allocator and create a new object_allocator)
Date: Fri, 17 Jul 2015 13:50:00 -0000	[thread overview]
Message-ID: <20150717134424.08493B042@oc7340732750.ibm.com> (raw)
In-Reply-To: <F3DEE900-7F8E-4D98-9CAA-254C54CDEC7E@gmail.com> from "Richard Biener" at Jul 17, 2015 03:25:07 PM

Richard Biener wrote:
> On July 17, 2015 3:11:51 PM GMT+02:00, Ulrich Weigand <uweigand@de.ibm.com> wrote:
> >(Since there is no C++ operator new involved at all anymore,
> >this clearly violates even the C aliasing rules ...)
> >
> >I really think the allocate routine needs to be more careful to
> >avoid violating aliasing, e.g. by using memcpy or union-based
> >type-punning to access its free list info.
> 
> As far as I understand the object allocator delegates construction to callers and thus in the above case cselib
> Would be responsible for calling placement new on the return value from
> Allocate.

Ah, it looks like I was wrong above: the code uses the *object*
allocator, so it should go through a placement new here:
  inline T *
  allocate () ATTRIBUTE_MALLOC
  {
    return ::new (m_allocator.allocate ()) T ();
  }

It's still being miscompiled at least by my GCC 4.1 host compiler ...

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU/Linux compilers and toolchain
  Ulrich.Weigand@de.ibm.com

  reply	other threads:[~2015-07-17 13:44 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-29 14:01 [RFC, PATCH] Split pool_allocator and create a new object_allocator Martin Liška
2015-07-02 20:09 ` Richard Sandiford
2015-07-02 21:08   ` Trevor Saunders
2015-07-03  8:56     ` Richard Sandiford
2015-07-03 10:11       ` Martin Liška
2015-07-03 12:22       ` Martin Jambor
2015-07-03 13:07         ` Richard Sandiford
2015-07-03 14:15           ` Martin Liška
2015-07-03 16:19             ` Richard Sandiford
2015-07-09 21:43               ` Martin Liška
2015-07-10 14:19                 ` Pat Haugen
2015-07-16 11:00                 ` Martin Liška
2015-07-16 11:03                   ` Richard Biener
2015-07-17 13:25                   ` Still crashes due to aliasing violation (Re: [RFC, PATCH] Split pool_allocator and create a new object_allocator) Ulrich Weigand
2015-07-17 13:44                     ` Richard Biener
2015-07-17 13:50                       ` Ulrich Weigand [this message]
2015-07-17 13:54                         ` Martin Liška
2015-07-17 15:37                           ` Richard Biener
2015-07-17 17:49                             ` Ulrich Weigand
2015-07-17 18:12                               ` Richard Biener
2015-07-17 21:57                                 ` Ulrich Weigand
2015-07-18 13:04                                   ` Richard Biener
2015-07-17 18:14                             ` Martin Liška

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=20150717134424.08493B042@oc7340732750.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mliska@suse.cz \
    --cc=richard.guenther@gmail.com \
    /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).