aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/fortran/ChangeLog8
-rw-r--r--gcc/fortran/interface.c7
-rw-r--r--gcc/fortran/symbol.c1
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/c_loc_pure_1.f9011
5 files changed, 30 insertions, 2 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index ed66a73..84b81e2 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -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
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index f779dfa..d6ff240 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -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);
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c
index b74318c..2c4ce36 100644
--- a/gcc/fortran/symbol.c
+++ b/gcc/fortran/symbol.c
@@ -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;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 62f0f78..dd39cc1 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 0000000..911f542
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c_loc_pure_1.f90
@@ -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