This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch, Fortran] PR34186 -fdump-parse-tree fixes


:ADDPATCH fortran:

This fixes three problems with the parse tree, related to the ISO C
Binding patches.

a) c_alert etc. did not set cl->length, which caused a crash for
    use iso_c_binding, only: c_alert
when using -fdump-tree-original

b) BT_VOID was not handled. I think it is used for the C_LOC function

c) I added BIND(C) to the dumped attributes.

Bootstrapped and regression tested.
OK for the trunk?

Tobias
2007-11-30  Tobias Burnus  <burnus@net-b.de>

	PR fortran/34186
	* symbol.c (generate_isocbinding_symbol): Set string length.
	* dump-parse-tree.c (gfc_show_attr): Show BIND(C) attribute.
	* misc.c (gfc_basic_typename): Handle BT_VOID.

Index: gcc/fortran/symbol.c
===================================================================
--- gcc/fortran/symbol.c	(Revision 130533)
+++ gcc/fortran/symbol.c	(Arbeitskopie)
@@ -3810,6 +3810,8 @@ generate_isocbinding_symbol (const char 
 	tmp_sym->value->value.character.string[0]
 	  = (char) c_interop_kinds_table[s].value;
 	tmp_sym->value->value.character.string[1] = '\0';
+	tmp_sym->value->ts.cl = gfc_get_charlen ();
+	tmp_sym->value->ts.cl->length = gfc_int_expr (1);
 
 	/* May not need this in both attr and ts, but do need in
 	   attr for writing module file.  */
Index: gcc/fortran/dump-parse-tree.c
===================================================================
--- gcc/fortran/dump-parse-tree.c	(Revision 130533)
+++ gcc/fortran/dump-parse-tree.c	(Arbeitskopie)
@@ -582,6 +582,8 @@ gfc_show_attr (symbol_attribute *attr)
     gfc_status (" RESULT");
   if (attr->entry)
     gfc_status (" ENTRY");
+  if (attr->is_bind_c)
+    gfc_status (" BIND(C)");
 
   if (attr->data)
     gfc_status (" DATA");
Index: gcc/fortran/misc.c
===================================================================
--- gcc/fortran/misc.c	(Revision 130533)
+++ gcc/fortran/misc.c	(Arbeitskopie)
@@ -139,6 +139,9 @@ gfc_basic_typename (bt type)
     case BT_PROCEDURE:
       p = "PROCEDURE";
       break;
+    case BT_VOID:
+      p = "VOID";
+      break;
     case BT_UNKNOWN:
       p = "UNKNOWN";
       break;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]