OSDN Git Service

2009-01-06 Thomas Koenig <tkoenig@gcc.gnu.org>
authortkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 6 Jan 2009 23:03:18 +0000 (23:03 +0000)
committertkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 6 Jan 2009 23:03:18 +0000 (23:03 +0000)
PR fortran/38220
* interface.c (gfc_procedure_use):  Don't warn about functions
from ISO_C_BINDING.
* symbol.c (generate_isocbinding_symbol):  Mark c_loc and
c_funloc as pure.

2009-01-06  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/38220
* gfortran.dg/c_loc_pure_1.f90:  New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@143140 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/interface.c
gcc/fortran/symbol.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/c_loc_pure_1.f90 [new file with mode: 0644]

index ed66a73..84b81e2 100644 (file)
@@ -1,3 +1,11 @@
+2009-01-06  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       PR fortran/38220
+       * interface.c (gfc_procedure_use):  Don't warn about functions
+       from ISO_C_BINDING.
+       * symbol.c (generate_isocbinding_symbol):  Mark c_loc and
+       c_funloc as pure.
+
 2009-01-05  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/38657
index f779dfa..d6ff240 100644 (file)
@@ -2411,9 +2411,12 @@ void
 gfc_procedure_use (gfc_symbol *sym, gfc_actual_arglist **ap, locus *where)
 {
 
-  /* Warn about calls with an implicit interface.  */
+  /* Warn about calls with an implicit interface.  Special case
+     for calling a ISO_C_BINDING becase c_loc and c_funloc
+     are pseudo-unknown.  */
   if (gfc_option.warn_implicit_interface
-      && sym->attr.if_source == IFSRC_UNKNOWN)
+      && sym->attr.if_source == IFSRC_UNKNOWN
+      && ! sym->attr.is_iso_c)
     gfc_warning ("Procedure '%s' called with an implicit interface at %L",
                 sym->name, where);
 
index b74318c..2c4ce36 100644 (file)
@@ -4169,6 +4169,7 @@ generate_isocbinding_symbol (const char *mod_name, iso_c_binding_symbol s,
                tmp_sym->result = tmp_sym;
                tmp_sym->attr.external = 1;
                tmp_sym->attr.use_assoc = 0;
+               tmp_sym->attr.pure = 1;
                tmp_sym->attr.if_source = IFSRC_UNKNOWN;
                tmp_sym->attr.proc = PROC_UNKNOWN;
              }
index 62f0f78..dd39cc1 100644 (file)
@@ -1,3 +1,8 @@
+2009-01-06  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       PR fortran/38220
+       * gfortran.dg/c_loc_pure_1.f90:  New test.
+
 2009-01-06  Mikael Morin  <mikael.morin@tele2.fr>
 
        PR fortran/38669
diff --git a/gcc/testsuite/gfortran.dg/c_loc_pure_1.f90 b/gcc/testsuite/gfortran.dg/c_loc_pure_1.f90
new file mode 100644 (file)
index 0000000..911f542
--- /dev/null
@@ -0,0 +1,11 @@
+! { dg-do compile }
+! { dg-options "-Wimplicit-interface" }
+! PR 38220 - c_loc is pure and has an explicit interface
+USE ISO_C_BINDING, ONLY: C_PTR, C_LOC
+CONTAINS
+  PURE SUBROUTINE F(x)
+    INTEGER, INTENT(in), TARGET :: x
+    TYPE(C_PTR) :: px
+    px = C_LOC(x)
+  END SUBROUTINE
+END