[committed] Fortran: resolve.c - remove '*XCNEW' based nullifying

Tobias Burnus tobias@codesourcery.com
Mon Jun 14 12:49:00 GMT 2021

Found this odd code. It starts fine with:
   gfc_ref *ref = gfc_get_ref ();
this uses XCNEW to return nullified memory.

We then operate on
where 'ar' is a struct which is in a 'u'nion which is in gfc_ref.

Hence, 'ref->u.ar' is not a pointer. Hence, the following is a
wasteful way to memset '\0' the struct – which is still '\0'
from the first XCNEW:
   ref->u.ar = *gfc_get_array_ref()

Note the '*' before the XCNEW calling macro gfc_get_array_ref!

Committed as obvious.


Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 München Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Frank Thürauf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: committed.diff
Type: text/x-patch
Size: 718 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20210614/dd356a6c/attachment.bin>

More information about the Gcc-patches mailing list