This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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] Fix -std=* handling for using ISO_* modules


The patch is rather obvious: The "break" is supposed to be a "continue".
I have now moved it down a few lines in order to add a better error
message for USE statements with rename. (The same error as already shown
for USE statements with ONLY.) Before the message was a plain "not found".

The test case now contains tests for the found issues and the updated
error strings.

Build and regtested on x86-64-linux. OK for the trunk? (It does not
affect any 4.x branch.)


2010-04-08  Tobias Burnus  <burnus@net-b.de>

	* module.c (use_iso_fortran_env_module): Fix standard check.

2010-04-08  Tobias Burnus  <burnus@net-b.de>

	* gfortran.dg/iso_fortran_env_6.f90: Add more checks.

Index: gcc/fortran/module.c
===================================================================
--- gcc/fortran/module.c	(revision 158110)
+++ gcc/fortran/module.c	(working copy)
@@ -5431,9 +5431,6 @@ use_iso_fortran_env_module (void)
 	{
 	  local_name = NULL;
 
-	  if ((gfc_option.allow_std & symbol[i].standard) == 0)
-	    break;
-
 	  for (u = gfc_rename_list; u; u = u->next)
 	    {
 	      if (strcmp (symbol[i].name, u->use_name) == 0)
@@ -5444,6 +5441,13 @@ use_iso_fortran_env_module (void)
 		}
 	    }
 
+	  if (u && gfc_notify_std (symbol[i].standard, "The symbol '%s', "
+				   "referrenced at %C, is not in the selected "
+				   "standard", symbol[i].name) == FAILURE)
+	    continue;
+	  else if ((gfc_option.allow_std & symbol[i].standard) == 0)
+	    continue;
+
 	  if ((gfc_option.flag_default_integer || gfc_option.flag_default_real)
 	      && symbol[i].id == ISOFORTRANENV_NUMERIC_STORAGE_SIZE)
 	    gfc_warning_now ("Use of the NUMERIC_STORAGE_SIZE named constant "
Index: gcc/testsuite/gfortran.dg/iso_fortran_env_6.f90
===================================================================
--- gcc/testsuite/gfortran.dg/iso_fortran_env_6.f90	(revision 158110)
+++ gcc/testsuite/gfortran.dg/iso_fortran_env_6.f90	(working copy)
@@ -10,6 +10,8 @@ implicit none
 integer(kind=ATOMIC_INT_KIND) :: atomic_int ! { dg-error "has no IMPLICIT type" }
 logical(kind=ATOMIC_LOGICAL_KIND) :: atomic_bool ! { dg-error "has no IMPLICIT type" }
 
+print *, OUTPUT_UNIT
+
 if (IOSTAT_INQUIRE_INTERNAL_UNIT <= 0) call abort() ! { dg-error "has no IMPLICIT type" }
 print *,STAT_STOPPED_IMAGE ! { dg-error "has no IMPLICIT type" }
 print *, STAT_LOCKED_OTHER_IMAGE ! { dg-error "has no IMPLICIT type" }
@@ -18,6 +20,7 @@ print *, STAT_UNLOCKED ! { dg-error "has
 end
 
 module m
+USE iso_fortran_env, only: INPUT_UNIT
 USE iso_fortran_env, only: ATOMIC_INT_KIND ! { dg-error "is not in the selected standard" }
 implicit none
 end module m
@@ -28,6 +31,6 @@ implicit none
 end module m2
 
 module m3
-USE iso_fortran_env, foo => IOSTAT_INQUIRE_INTERNAL_UNIT ! { dg-error "not found" }
+USE iso_fortran_env, foo => IOSTAT_INQUIRE_INTERNAL_UNIT ! { dg-error "not in the selected standard" }
 implicit none
 end module m3

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