re PR fortran/34997 (Mention -fdollar-ok option in error message for symbol names...
authorTobias Burnus <burnus@net-b.de>
Wed, 20 Feb 2008 18:21:14 +0000 (19:21 +0100)
committerTobias Burnus <burnus@gcc.gnu.org>
Wed, 20 Feb 2008 18:21:14 +0000 (19:21 +0100)
2008-02-20  Tobias Burnus  <burnus@net-b.de>

        PR fortran/34997
        * match.c (gfc_match_name): Improve error message for '$'.

2008-02-20  Tobias Burnus  <burnus@net-b.de>

        PR fortran/34997
        * gfortran.dg/dollar_sym_1.f90: New.
        * gfortran.dg/dollar_sym_2.f90: New.

From-SVN: r132488

gcc/fortran/ChangeLog
gcc/fortran/match.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/dollar_sym_1.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/dollar_sym_2.f90 [new file with mode: 0644]

index ea74958f3f9243d8def60d526ef96d1377c8f705..cdce2802b296410cb0372990f6f49d130590646a 100644 (file)
@@ -1,3 +1,8 @@
+2008-02-20  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/34997
+       * match.c (gfc_match_name): Improve error message for '$'.
+
 2008-02-19  Daniel Franke  <franke.daniel@gmail.com>
 
        PR fortran/35030
index 324e52ecee042d532c5acb6985c25d104dc54043..c1920ff9d58163d58de29c9876285de5dc793410 100644 (file)
@@ -519,6 +519,13 @@ gfc_match_name (char *buffer)
     }
   while (ISALNUM (c) || c == '_' || (gfc_option.flag_dollar_ok && c == '$'));
 
+  if (c == '$' && !gfc_option.flag_dollar_ok)
+    {
+      gfc_error ("Invalid character '$' at %C. Use -fdollar-ok to allow it as an extension");
+      return MATCH_ERROR;
+    }
+
+
   buffer[i] = '\0';
   gfc_current_locus = old_loc;
 
index 04c799fe178e8a579439ee56f5822b0b90e8699d..34ccb964a48dbeaaa764adb56ab47dbc69a72361 100644 (file)
@@ -1,3 +1,9 @@
+2008-02-20  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/34997
+       * gfortran.dg/dollar_sym_1.f90: New.
+       * gfortran.dg/dollar_sym_2.f90: New.
+
 2008-02-20  Richard Guenther  <rguenther@suse.de>
 
        PR middle-end/35265
diff --git a/gcc/testsuite/gfortran.dg/dollar_sym_1.f90 b/gcc/testsuite/gfortran.dg/dollar_sym_1.f90
new file mode 100644 (file)
index 0000000..37f0f88
--- /dev/null
@@ -0,0 +1,9 @@
+! { dg-do compile }
+! PR fortran/34997
+! Variable names containing $ signs
+! 
+      REAL*4 PLT$C_HOUSTPIX   ! { dg-error "Invalid character '\\$'" }
+      INTEGER PLT$C_COMMAND   ! { dg-error "Invalid character '\\$'" }
+      PARAMETER (PLT$B_OPC=0) ! { dg-error "Invalid character '\\$'" }
+      common /abc$def/ PLT$C_HOUSTPIX, PLT$C_COMMAND ! { dg-error "Invalid character '\\$'" }
+      end
diff --git a/gcc/testsuite/gfortran.dg/dollar_sym_2.f90 b/gcc/testsuite/gfortran.dg/dollar_sym_2.f90
new file mode 100644 (file)
index 0000000..800a728
--- /dev/null
@@ -0,0 +1,11 @@
+! { dg-do compile }
+! { dg-options "-fdollar-ok" }
+!
+! PR fortran/34997
+! Variable names containing $ signs
+! 
+      REAL*4 PLT$C_HOUSTPIX
+      INTEGER PLT$C_COMMAND
+      PARAMETER (PLT$B_OPC=0)
+      common /abc$def/ PLT$C_HOUSTPIX, PLT$C_COMMAND
+      end