[fortran,committed] Simplify code for memory allocation and freeing

FX fxcoudert@gmail.com
Sat Aug 29 10:14:00 GMT 2015


The attached patch simplifies code in various gcc/fortran/trans* routines related to malloc and free:

  - we don’t need to check if types match before calling fold_convert(): fold_convert() does it itself
  - in some cases where the argument is used only once, we don’t need to call gfc_evaluate_now()
  - in other cases, we can used save_expr() instead of gfc_evaluate_now(), which is simpler to use and doesn’t create a new decl
  - the callers of gfc_call_free() don’t need to convert their argument to pvoid_type_node: gfc_call_free() itself does it

The resulting code is simpler, shorter and more unified.

Committed as revision 227316, after regtesting on x86_64-pc-linux-gnu.

FX


-------------- next part --------------
A non-text attachment was scrubbed...
Name: x.ChangeLog
Type: application/octet-stream
Size: 521 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20150829/c50c7f0a/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: x.diff
Type: application/octet-stream
Size: 7880 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20150829/c50c7f0a/attachment-0001.obj>


More information about the Gcc-patches mailing list