]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/30452 ([4.2, 4.1 only] Strange syntax error with high-value character)
authorThomas Koenig <Thomas.Koenig@online.de>
Sun, 14 Jan 2007 11:01:20 +0000 (11:01 +0000)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Sun, 14 Jan 2007 11:01:20 +0000 (11:01 +0000)
2007-01-14  Thomas Koenig  <Thomas.Koenig@online.de>

PR fortran/30452
* scanner.c(next_char):  Cast next character to unsigned
to avoid confusion with error return codes.

2007-01-14  Thomas Koenig  <Thomas.Koenig@online.de>

PR fortran/30452
* gfortran.dg/string_0xfe_0xff_1.f90:  New test.

From-SVN: r120768

gcc/fortran/scanner.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/string_0xfe_0xff_1.f90 [new file with mode: 0644]

index d97d5851a36dda34506c5fb94e23e78e1b15baad..4949fe605728e7b45ba5e2ad2a55c6fab1da7a6f 100644 (file)
@@ -345,7 +345,7 @@ next_char (void)
   if (gfc_current_locus.nextc == NULL)
     return '\n';
 
-  c = *gfc_current_locus.nextc++;
+  c = (unsigned char) *gfc_current_locus.nextc++;
   if (c == '\0')
     {
       gfc_current_locus.nextc--; /* Remain on this line.  */
index 7c3b7698730cd4e88a8fa5602c759213e544cabb..ce42aaa2f5bf0af8ccf79d60e4397f294bdbc51e 100644 (file)
@@ -1,3 +1,8 @@
+2007-01-14  Thomas Koenig  <Thomas.Koenig@online.de>
+
+       PR fortran/30452
+       * gfortran.dg/string_0xfe_0xff_1.f90:  New test.
+
 2007-01-13  Zdenek Dvorak <dvorakz@suse.cz>
 
        * gcc.dg/20070112-1.c: New test.
diff --git a/gcc/testsuite/gfortran.dg/string_0xfe_0xff_1.f90 b/gcc/testsuite/gfortran.dg/string_0xfe_0xff_1.f90
new file mode 100644 (file)
index 0000000..e3ea042
--- /dev/null
@@ -0,0 +1,7 @@
+! { dg-do compile }
+! PR 30452 - this used to cause syntax errors due to the presence,
+!            as characters, of bytes 0xfe and 0xff.
+program main
+  if (char (254) /= "þ") call abort
+  if (achar (255) /= "ÿ") call abort
+end program main