re PR fortran/51308 (PARAMETER attribute conflicts with SAVE attribute)
authorTobias Burnus <burnus@net-b.de>
Mon, 28 Nov 2011 14:21:33 +0000 (15:21 +0100)
committerTobias Burnus <burnus@gcc.gnu.org>
Mon, 28 Nov 2011 14:21:33 +0000 (15:21 +0100)
2011-11-28  Tobias Burnus  <burnus@net-b.de>
            Steven G. Kargl  <kargl@gcc.gnu.org>

        PR fortran/51308
        * symbol.c (check_conflict): Ignore BIND(C) + PARAMETER
        conflicts for ISO_C_BINDING variables.
        (gen_special_c_interop_ptr): Don't mark c_ptr_null/c_funptr_null
        as SAVE.

2011-11-28  Tobias Burnus  <burnus@net-b.de>

        PR fortran/51308
        * gfortran.dg/iso_c_binding_compiler_4.f90: New.

Co-Authored-By: Steven G. Kargl <kargl@gcc.gnu.org>
From-SVN: r181778

gcc/fortran/ChangeLog
gcc/fortran/symbol.c
gcc/testsuite/ChangeLog

index 4ee062c23e7113a4ca4978fc3ee0642dd6837710..393f2a05076bdda25d338352ad3c0746753f5996 100644 (file)
@@ -1,3 +1,12 @@
+2011-11-28  Tobias Burnus  <burnus@net-b.de>
+           Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/51308
+       * symbol.c (check_conflict): Ignore BIND(C) + PARAMETER
+       conflicts for ISO_C_BINDING variables.
+       (gen_special_c_interop_ptr): Don't mark c_ptr_null/c_funptr_null
+       as SAVE.
+
 2011-11-25  Mikael Morin  <mikael@gcc.gnu.org>
 
        * trans-array.c (set_loop_bounds): Remove dead conditions.
index 9bd6ed489f33ea9f264876adaef84eff75fd2ecc..de42297981eb6f86d7582421f0e6953449eb9fd6 100644 (file)
@@ -742,9 +742,10 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where)
       conf2 (asynchronous);
       conf2 (threadprivate);
       conf2 (value);
-      conf2 (is_bind_c);
       conf2 (codimension);
       conf2 (result);
+      if (!attr->is_iso_c)
+       conf2 (is_bind_c);
       break;
 
     default:
@@ -3763,13 +3764,11 @@ gen_special_c_interop_ptr (int ptr_id, const char *ptr_name,
                           "create symbol for %s", ptr_name);
     }
 
-  /* Set up the symbol's important fields.  Save attr required so we can
-     initialize the ptr to NULL.  */
-  tmp_sym->attr.save = SAVE_EXPLICIT;
   tmp_sym->ts.is_c_interop = 1;
   tmp_sym->attr.is_c_interop = 1;
   tmp_sym->ts.is_iso_c = 1;
   tmp_sym->ts.type = BT_DERIVED;
+  tmp_sym->attr.flavor = FL_PARAMETER;
 
   /* The c_ptr and c_funptr derived types will provide the
      definition for c_null_ptr and c_null_funptr, respectively.  */
@@ -3817,9 +3816,6 @@ gen_special_c_interop_ptr (int ptr_id, const char *ptr_name,
   c->expr = gfc_get_expr ();
   c->expr->expr_type = EXPR_NULL;
   c->expr->ts.is_iso_c = 1;
-  /* Must declare c_null_ptr and c_null_funptr as having the
-     PARAMETER attribute so they can be used in init expressions.  */
-  tmp_sym->attr.flavor = FL_PARAMETER;
 
   return SUCCESS;
 }
index 7f738a0fa583eb9d6af77fee0c70468da7adfa02..a6a077c9b88a2ef6b8db341b5c63e42747508ff3 100644 (file)
@@ -1,3 +1,8 @@
+2011-11-28  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/51308
+       * gfortran.dg/iso_c_binding_compiler_4.f90: New.
+
 2011-11-27  Aldy Hernandez  <aldyh@redhat.com>
            Iain Sandoe  <iains@gcc.gnu.org>