This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch, fortran] PR32361 TYPE DECLARATION TO INITIALIZE DATA IN NAMED COMMON
- From: Jerry DeLisle <jvdelisle at verizon dot net>
- To: Fortran List <fortran at gcc dot gnu dot org>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 16 Jun 2007 18:36:05 -0700
- Subject: [patch, fortran] PR32361 TYPE DECLARATION TO INITIALIZE DATA IN NAMED COMMON
This patch is simple, allowing the NULL to be used.
Regression tested on x86-64.
OK for trunk? Test case will be added.
Does this need to be an extension similar to my question on pr32360?
Reporters example case:
BLOCK DATA
integer, pointer :: ptr1 => NULL()
common / T / ptr1
END
Jerry
2007-06-16 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/32361
* match.c (gfc_match_common): If the symbol value expression type is
NULL_EXPR, don't error if previously initialized to null.
Index: match.c
===================================================================
*** match.c (revision 125747)
--- match.c (working copy)
*************** gfc_match_common (void)
*** 2417,2423 ****
if (gfc_add_in_common (&sym->attr, sym->name, NULL) == FAILURE)
goto cleanup;
! if (sym->value != NULL
&& (name[0] == '\0' || !sym->attr.data))
{
if (name[0] == '\0')
--- 2417,2423 ----
if (gfc_add_in_common (&sym->attr, sym->name, NULL) == FAILURE)
goto cleanup;
! if (sym->value != NULL && sym->value->expr_type != EXPR_NULL
&& (name[0] == '\0' || !sym->attr.data))
{
if (name[0] == '\0')