gfortran MAIN__ symbol not marked TREE_PUBLIC

Paul Brook paul@codesourcery.com
Thu Aug 19 22:16:00 GMT 2004


On Thursday 19 August 2004 05:25, David Edelsohn wrote:
> 	When gfortran synthesizes the MAIN__ symbol, the decl is not
> receiving the attribute TREE_PUBLIC, which is causing problems on AIX
> because the symbol is not being globalized.
>
> 	I assume that some bit is missing from
> trans.c:gfc_generate_code().
>
> 	I have opened PR fortran/17091 to track the bug.

I decided to use the sledgehammer approach and make gfc_clear_attr use memset.

Tested on i686-linux.
Applied to mainline.

2004-08-19  Paul Brook  <paul@codesourcery.com>

	PR fortran/17091
	* gfortran.h (gfc_access): Give ACCESS_UNKNOWN value 0.
	* symbol.c (gfc_clear_attr): Use memset.

Index: gfortran.h
===================================================================
RCS file: /var/cvsroot/gcc-cvs/gcc/gcc/fortran/gfortran.h,v
retrieving revision 1.24
diff -u -p -r1.24 gfortran.h
--- gfortran.h	19 Aug 2004 15:31:37 -0000	1.24
+++ gfortran.h	19 Aug 2004 20:05:30 -0000
@@ -243,7 +243,7 @@ sym_intent;
 
 /* Access types.  */
 typedef enum
-{ ACCESS_PUBLIC = 1, ACCESS_PRIVATE, ACCESS_UNKNOWN
+{ ACCESS_UNKNOWN = 0, ACCESS_PUBLIC, ACCESS_PRIVATE, 
 }
 gfc_access;
 
Index: symbol.c
===================================================================
RCS file: /var/cvsroot/gcc-cvs/gcc/gcc/fortran/symbol.c,v
retrieving revision 1.12
diff -u -p -r1.12 symbol.c
--- symbol.c	17 Aug 2004 15:34:09 -0000	1.12
+++ symbol.c	19 Aug 2004 20:52:29 -0000
@@ -1010,37 +1010,7 @@ gfc_add_type (gfc_symbol * sym, gfc_type
 void
 gfc_clear_attr (symbol_attribute * attr)
 {
-
-  attr->allocatable = 0;
-  attr->dimension = 0;
-  attr->external = 0;
-  attr->intrinsic = 0;
-  attr->optional = 0;
-  attr->pointer = 0;
-  attr->save = 0;
-  attr->target = 0;
-  attr->dummy = 0;
-  attr->result = 0;
-  attr->entry = 0;
-  attr->data = 0;
-  attr->use_assoc = 0;
-  attr->in_namelist = 0;
-
-  attr->in_common = 0;
-  attr->function = 0;
-  attr->subroutine = 0;
-  attr->generic = 0;
-  attr->implicit_type = 0;
-  attr->sequence = 0;
-  attr->elemental = 0;
-  attr->pure = 0;
-  attr->recursive = 0;
-
-  attr->access = ACCESS_UNKNOWN;
-  attr->intent = INTENT_UNKNOWN;
-  attr->flavor = FL_UNKNOWN;
-  attr->proc = PROC_UNKNOWN;
-  attr->if_source = IFSRC_UNKNOWN;
+  memset (attr, 0, sizeof(symbol_attribute));
 }
 
 



More information about the Gcc-patches mailing list