Bug 34659 - [4.3 Regression] corner case continuation line
Summary: [4.3 Regression] corner case continuation line
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: ---
Assignee: Jerry DeLisle
URL:
Keywords: accepts-invalid
Depends on:
Blocks:
 
Reported: 2008-01-03 20:13 UTC by Joost VandeVondele
Modified: 2008-01-07 03:17 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2008-01-04 23:56:49


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joost VandeVondele 2008-01-03 20:13:39 UTC
The following is non-standard and the compiler should probably generate a
warning/error with '-pedantic -std=f95', but does not do so with
gcc version 4.3.0 20080103 (experimental) [trunk revision 131300] (GCC)

 &

end
Comment 1 Tobias Burnus 2008-01-04 07:24:26 UTC
ifort:
Warning: Continuation character illegal as first non_blank in statement

NAG f95:
Error: Invalid continuation
Comment 2 Jerry DeLisle 2008-01-04 23:56:49 UTC
I will have a go on this one.
Comment 3 Jerry DeLisle 2008-01-06 19:24:28 UTC
This is a regression.  I thought in the back of my mind that I had this working right before.  Sure enough, 4.2 gives a warning.

gfc42 -static pr34659.f90 
Warning: '&' not allowed by itself in line 1


Comment 4 Jerry DeLisle 2008-01-06 23:11:24 UTC
This trivial patch fixes this:

Index: scanner.c
===================================================================
--- scanner.c	(revision 131355)
+++ scanner.c	(working copy)
@@ -1176,7 +1176,7 @@ load_line (FILE *input, char **pbuf, int
 	    seen_ampersand = 1;
 	}
 
-      if ((c != '&' && c != '!') || (c == '!' && !seen_ampersand))
+      if ((c != '&' && c != '!' && c != ' ') || (c == '!' && !seen_ampersand))
 	seen_printable = 1;
 
       /* Is this a fixed-form comment?  */

I will commit as such and add a test case.  I may refine on this a bit. :)
Comment 5 Jerry DeLisle 2008-01-07 02:53:49 UTC
Subject: Bug 34659

Author: jvdelisle
Date: Mon Jan  7 02:53:04 2008
New Revision: 131371

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=131371
Log:
2008-01-06  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/34659
	* scanner.c (load_line): Do not count ' ' as printable when checking for
	continuations.

Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/scanner.c

Comment 6 Jerry DeLisle 2008-01-07 03:17:52 UTC
Fixed on trunk.
Comment 7 Jerry DeLisle 2008-01-20 06:49:27 UTC
Subject: Bug 34659

Author: jvdelisle
Date: Sun Jan 20 06:48:39 2008
New Revision: 131673

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=131673
Log:
2008-01-20  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/34795
	* gfortran.dg/inquire_13.f90: New test.
	
	PR libfortran/34659
	* gfortran.dg/continuation_9.f90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/continuation_9.f90
    trunk/gcc/testsuite/gfortran.dg/inquire_13.f90
Modified:
    trunk/gcc/testsuite/ChangeLog