[Bug fortran/30723] Freeing memory doesn't need to call a library function

2007-05-14 Thread fxcoudert at gcc dot gnu dot org


--- Comment #5 from fxcoudert at gcc dot gnu dot org  2007-05-14 20:34 
---
Subject: Bug 30723

Author: fxcoudert
Date: Mon May 14 19:33:57 2007
New Revision: 124721

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=124721
Log:
   PR fortran/30723

* trans.h (gfor_fndecl_internal_malloc, gfor_fndecl_internal_malloc64,
gfor_fndecl_internal_free): Remove prototypes.
(gfor_fndecl_os_error, gfc_call_free, gfc_call_malloc): Add prototypes.
* trans.c (gfc_call_malloc, gfc_call_free): New functions.
* f95-lang.c (gfc_init_builtin_functions): Add __builtin_free
and __builtin_malloc builtins.
* trans-decl.c (gfor_fndecl_internal_malloc,
gfor_fndecl_internal_malloc64, gfor_fndecl_internal_free): Remove.
(gfor_fndecl_os_error): Add.
(gfc_build_builtin_function_decls): Don't create internal_malloc,
internal_malloc64 and internal_free library function declaration.
Create os_error library call function declaration.
* trans-array.c (gfc_trans_allocate_array_storage,
gfc_trans_auto_array_allocation, gfc_trans_dummy_array_bias,
gfc_conv_array_parameter, gfc_duplicate_allocatable): Use
gfc_call_malloc and gfc_call_free instead of building calls to
internal_malloc and internal_free.
* trans-expr.c (gfc_conv_string_tmp): Likewise.
* trans-stmt.c (gfc_do_allocate, gfc_trans_assign_need_temp,
gfc_trans_pointer_assign_need_temp, gfc_trans_forall_1,
gfc_trans_where_2: Likewise.
* trans-intrinsic.c (gfc_conv_intrinsic_ctime,
gfc_conv_intrinsic_fdate, gfc_conv_intrinsic_ttynam,
gfc_conv_intrinsic_array_transfer, gfc_conv_intrinsic_trim): Likewise.

* runtime/memory.c (internal_malloc, internal_malloc64,
internal_free): Remove.
* runtime/error.c (os_error): Export function.
* intrinsics/move_alloc.c: Include stdlib.h.
(move_alloc): Call free instead of internal_free.
(move_alloc_c): Wrap long lines.
* libgfortran.h (os_error): Export prototype.
(internal_free): Remove prototype.
* gfortran.map (GFORTRAN_1.0): Remove _gfortran_internal_free,
_gfortran_internal_malloc and _gfortran_internal_malloc64.
Add _gfortran_os_error.

Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/f95-lang.c
trunk/gcc/fortran/trans-array.c
trunk/gcc/fortran/trans-decl.c
trunk/gcc/fortran/trans-expr.c
trunk/gcc/fortran/trans-intrinsic.c
trunk/gcc/fortran/trans-stmt.c
trunk/gcc/fortran/trans.c
trunk/gcc/fortran/trans.h
trunk/libgfortran/ChangeLog
trunk/libgfortran/gfortran.map
trunk/libgfortran/intrinsics/move_alloc.c
trunk/libgfortran/libgfortran.h
trunk/libgfortran/runtime/error.c
trunk/libgfortran/runtime/memory.c


-- 


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



[Bug fortran/30723] Freeing memory doesn't need to call a library function

2007-05-14 Thread fxcoudert at gcc dot gnu dot org


--- Comment #6 from fxcoudert at gcc dot gnu dot org  2007-05-14 20:34 
---
Fixed on mainline.


-- 

fxcoudert at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED


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



[Bug fortran/30723] Freeing memory doesn't need to call a library function

2007-03-04 Thread fxcoudert at gcc dot gnu dot org


--- Comment #3 from fxcoudert at gcc dot gnu dot org  2007-03-04 20:12 
---
Created an attachment (id=13141)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13141action=view)
Patch removing need for internal_malloc and internal_free library functions

Attached patch updates the previous one, and allows the front-end to generate
code to malloc and free directly. This removes the need for the library
internal_malloc and internal_free functions, and allows better optimization.


-- 

fxcoudert at gcc dot gnu dot org changed:

   What|Removed |Added

  Attachment #13020|0   |1
is obsolete||
 AssignedTo|unassigned at gcc dot gnu   |fxcoudert at gcc dot gnu dot
   |dot org |org
 Status|NEW |ASSIGNED


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



[Bug fortran/30723] Freeing memory doesn't need to call a library function

2007-03-04 Thread rguenth at gcc dot gnu dot org


--- Comment #4 from rguenth at gcc dot gnu dot org  2007-03-04 21:01 ---
Note that we currently do not optimize

 tmp = malloc (XXX);
 free (tmp);

That would require some special handling in DCE (or a completely separate
pass).


-- 

rguenth at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||rguenth at gcc dot gnu dot
   ||org


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



[Bug fortran/30723] Freeing memory doesn't need to call a library function

2007-02-07 Thread rguenth at gcc dot gnu dot org


--- Comment #1 from rguenth at gcc dot gnu dot org  2007-02-07 09:58 ---
Confirmed.  Note we already NULLify the pointer in the caller for
_gfortran_deallocate (but I missed to fix the comment before that function as
well).


-- 


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



[Bug fortran/30723] Freeing memory doesn't need to call a library function

2007-02-07 Thread fxcoudert at gcc dot gnu dot org


--- Comment #2 from fxcoudert at gcc dot gnu dot org  2007-02-07 19:22 
---
Created an attachment (id=13020)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13020action=view)
Patch to not generate calls to internal_free any more


-- 


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



[Bug fortran/30723] Freeing memory doesn't need to call a library function

2007-02-06 Thread fxcoudert at gcc dot gnu dot org


-- 

fxcoudert at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever Confirmed|0   |1
   Last reconfirmed|-00-00 00:00:00 |2007-02-06 23:05:58
   date||
   Target Milestone|--- |4.3.0


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