public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "xinliangli at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/23383] builtin array operator new is not marked with malloc attribute
Date: Thu, 05 Jan 2012 18:55:00 -0000	[thread overview]
Message-ID: <bug-23383-4-q3YiVoQSht@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-23383-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23383

--- Comment #22 from davidxl <xinliangli at gmail dot com> 2012-01-05 18:54:51 UTC ---
(In reply to comment #21)
> But can't a valid code also compare the result from realloc with the old
> pointer, and if they are equal, do something, otherwise do something else?
> I think it is pretty common e.g. if the malloced block contains pointers to
> parts of the malloced area and upon realloc that didn't return the passed
> address wants to adjust all those pointers.
> Having a malloc attribute on realloc would still break this.
> I'd say we want realloc attribute and handle it where we currently handle
> BUILT_IN_REALLOC.

Right, the case you describe may be common. On the other hand, the compiler
probably should not optimize away pointer comparisons without knowing if the
pointer is used after 'free' or 'free' like function 'realloc'.

David


  parent reply	other threads:[~2012-01-05 18:55 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-23383-4@http.gcc.gnu.org/bugzilla/>
2012-01-04  0:29 ` xinliangli at gmail dot com
2012-01-04  9:44 ` rguenther at suse dot de
2012-01-04 17:12 ` xinliangli at gmail dot com
2012-01-05  8:40 ` rguenther at suse dot de
2012-01-05 18:11 ` xinliangli at gmail dot com
2012-01-05 18:27 ` jakub at gcc dot gnu.org
2012-01-05 18:55 ` xinliangli at gmail dot com [this message]
2012-01-09  8:39 ` rguenther at suse dot de
2012-01-09  8:40 ` rguenther at suse dot de
2013-07-08  4:54 ` pinskia at gcc dot gnu.org
     [not found] <bug-23383-6528@http.gcc.gnu.org/bugzilla/>
2008-03-05  7:48 ` pinskia at gcc dot gnu dot org
2008-03-12 20:30 ` pinskia at gcc dot gnu dot org
2008-06-04  3:22 ` sabre at nondot dot org
2008-06-04  4:16 ` xinliangli at gmail dot com
2008-06-04  4:33 ` sabre at nondot dot org
2008-06-04  4:33 ` sabre at nondot dot org
2008-06-04  4:47 ` xinliangli at gmail dot com
2008-06-04  4:48 ` sabre at nondot dot org
2008-06-04  5:24 ` xinliangli at gmail dot com
2008-06-04  5:35 ` sabre at nondot dot org
2008-06-04  7:58 ` rguenth at gcc dot gnu dot org
2008-06-04 16:48 ` davidxl at gcc dot gnu dot org
2008-06-04 17:04 ` rguenth at gcc dot gnu dot org
2008-06-04 17:35 ` davidxl at gcc dot gnu dot org
2005-08-14  5:39 [Bug c++/23383] New: " pinskia at gcc dot gnu dot org
2005-08-23 16:40 ` [Bug c++/23383] " pinskia at gcc dot gnu dot 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-23383-4-q3YiVoQSht@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).