public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/54833] New: Don't wrap __builtin_free(a) in if (a != NULL)
@ 2012-10-06 10:13 tkoenig at gcc dot gnu.org
  2012-10-06 10:13 ` [Bug fortran/54833] " tkoenig at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2012-10-06 10:13 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 54833
           Summary: Don't wrap __builtin_free(a) in if (a != NULL)
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: fortran
        AssignedTo: tkoenig@gcc.gnu.org
        ReportedBy: tkoenig@gcc.gnu.org


The Fortran front end at the moment generates many calls
to __builtin_free with

      if (a.data != 0B)
        {
          __builtin_free ((void *) a.data);
        }
      a.data = 0B;

This is not necessary, because free(NULL) is well-defined no-op.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/54833] Don't wrap __builtin_free(a) in if (a != NULL)
  2012-10-06 10:13 [Bug fortran/54833] New: Don't wrap __builtin_free(a) in if (a != NULL) tkoenig at gcc dot gnu.org
@ 2012-10-06 10:13 ` tkoenig at gcc dot gnu.org
  2012-10-07 15:52 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2012-10-06 10:13 UTC (permalink / raw)
  To: gcc-bugs


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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2012-10-06
     Ever Confirmed|0                           |1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/54833] Don't wrap __builtin_free(a) in if (a != NULL)
  2012-10-06 10:13 [Bug fortran/54833] New: Don't wrap __builtin_free(a) in if (a != NULL) tkoenig at gcc dot gnu.org
  2012-10-06 10:13 ` [Bug fortran/54833] " tkoenig at gcc dot gnu.org
@ 2012-10-07 15:52 ` jakub at gcc dot gnu.org
  2015-08-31 10:55 ` fxcoudert at gcc dot gnu.org
  2015-08-31 10:55 ` fxcoudert at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-10-07 15:52 UTC (permalink / raw)
  To: gcc-bugs


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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-10-07 15:51:51 UTC ---
It depends on what is the probability that the pointer is NULL.  If it is
unlikely, then unconditional free is the right choice, if NULL is very likely,
then the test may be less expensive (avoids call including likely PLT slot
overhead and comparison at least).


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/54833] Don't wrap __builtin_free(a) in if (a != NULL)
  2012-10-06 10:13 [Bug fortran/54833] New: Don't wrap __builtin_free(a) in if (a != NULL) tkoenig at gcc dot gnu.org
  2012-10-06 10:13 ` [Bug fortran/54833] " tkoenig at gcc dot gnu.org
  2012-10-07 15:52 ` jakub at gcc dot gnu.org
@ 2015-08-31 10:55 ` fxcoudert at gcc dot gnu.org
  2015-08-31 10:55 ` fxcoudert at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2015-08-31 10:55 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54833

--- Comment #2 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> ---
Author: fxcoudert
Date: Mon Aug 31 10:54:36 2015
New Revision: 227336

URL: https://gcc.gnu.org/viewcvs?rev=227336&root=gcc&view=rev
Log:
        PR fortran/54833
        * trans.c (gfc_call_free): Don't check if pointer is NULL.
        * trans.h (gfc_call_free): Adjust comment.

Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans.c
    trunk/gcc/fortran/trans.h


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/54833] Don't wrap __builtin_free(a) in if (a != NULL)
  2012-10-06 10:13 [Bug fortran/54833] New: Don't wrap __builtin_free(a) in if (a != NULL) tkoenig at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2015-08-31 10:55 ` fxcoudert at gcc dot gnu.org
@ 2015-08-31 10:55 ` fxcoudert at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2015-08-31 10:55 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54833

Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
                 CC|                            |fxcoudert at gcc dot gnu.org
         Resolution|---                         |FIXED
           Assignee|tkoenig at gcc dot gnu.org         |fxcoudert at gcc dot gnu.org
   Target Milestone|---                         |6.0

--- Comment #3 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> ---
Fixed on trunk.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-08-31 10:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-06 10:13 [Bug fortran/54833] New: Don't wrap __builtin_free(a) in if (a != NULL) tkoenig at gcc dot gnu.org
2012-10-06 10:13 ` [Bug fortran/54833] " tkoenig at gcc dot gnu.org
2012-10-07 15:52 ` jakub at gcc dot gnu.org
2015-08-31 10:55 ` fxcoudert at gcc dot gnu.org
2015-08-31 10:55 ` fxcoudert at gcc dot gnu.org

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).