This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[patch, fortran] PR30532 ^Z marks EOF
- From: Jerry DeLisle <jvdelisle at verizon dot net>
- To: Fortran List <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 22 Jan 2007 19:52:50 -0800
- Subject: [patch, fortran] PR30532 ^Z marks EOF
:ADDPATCH fortran:
Hi,
The attached patch removes the check for ctrl-Z when reading in a line from a
source file. Previously, gfortran was skipping everything after a ctrl-Z until
the actual EOF condition.
From F95 standard: Additional characters may be representable in the
processor, but may appear only in comments(3.3.1.1, 3.3.2.1), character
constants (4.3.2.1), input/output records (9.1.1), and character string edit
descriptors (10.2.1).
This patch also gives consistent behavior with g77 and ifort. Test case attached.
Regression tested on x86-64-linux-gnu.
I plan to commit this to trunk and then 4.2 in a few days.
Regards,
Jerry
2007-01-22 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/30532
* scanner.c (load_line): Remove check fot ctrl-z and don't gobble.
Index: scanner.c
===================================================================
*** scanner.c (revision 121074)
--- scanner.c (working copy)
*************** load_line (FILE *input, char **pbuf, int
*** 1064,1076 ****
if (c == '\0')
continue;
- if (c == '\032')
- {
- /* Ctrl-Z ends the file. */
- while (fgetc (input) != EOF);
- break;
- }
-
/* Check for illegal use of ampersand. See F95 Standard 3.3.1.3. */
if (c == '&')
seen_ampersand = 1;
--- 1064,1069 ----
! { dg-do compile }
! PR 30532 Ctrl-Z in source file
! Test case from PR. Submitted by Jerry DeLisle <jvdelisle@gcc.gnu.org>
print *,""
end