GCC Bugzilla will be upgraded from version 4.4.9 to 5.0rc3 on Saturday, April 25, starting around 17:00 UTC. The upgrade process should only last a few minutes. Check bug 64968 for details.
Bug 34084 - [4.3 regression] Error in November 9 version of gfortran when the first line in a source file is an INCLUDE statement
[4.3 regression] Error in November 9 version of gfortran when the first line ...
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: fortran
4.3.0
: P3 normal
: 4.3.0
Assigned To: Francois-Xavier Coudert
: ice-on-valid-code
Depends on:
Blocks: 32834
  Show dependency treegraph
 
Reported: 2007-11-13 16:36 UTC by Michael Richmond
Modified: 2007-11-16 22:24 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2007-11-13 21:18:22


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Richmond 2007-11-13 16:36:45 UTC
The following error occurs in the November 9 snapshot version of gfortran. It applies to all platforms. I compile the following program:

INCLUDE 'anything'
PROGRAM test_cg
END PROGRAM test_cg

The INCLUDE file can contain anything. I get the message:

f951: internal compiler error: in end_source_file, at fortran/scanner.c:327
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

The error does not occur if I change the program to:

INCLUDE 'anything'
INCLUDE 'anything_2'
PROGRAM test_cg
END PROGRAM test_cg
Comment 1 Tobias Burnus 2007-11-13 19:51:09 UTC
I can reproduce this (if the included file is not empty).

FX, can you have a look? I would not be surprised if one of your debug patches caused the regression:

anything:1: internal compiler error: in end_source_file, at fortran/scanner.c:327


Comment 2 Francois-Xavier Coudert 2007-11-13 21:18:22 UTC
(In reply to comment #1)
> FX, can you have a look? I would not be surprised if one of your debug patches
> caused the regression

Me neither. A simple workaround is to simply add a blank line before the INCLUDE statement. This problem is the exact inverse of the one I solved previously (which was about include statements on the last line), but it can't be fixed with the same hack. I'll revert my previous patch, and we'll need to fix this one straight in the scanner, when we read the file for the first time.
Comment 3 Francois-Xavier Coudert 2007-11-16 22:20:55 UTC
Subject: Bug 34084

Author: fxcoudert
Date: Fri Nov 16 22:20:44 2007
New Revision: 130244

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=130244
Log:
	PR fortran/33739
	PR fortran/34084
	* scanner.c (start_source_file, end_source_file,
	exit_remaining_files, gfc_advance_line): Revert rev. 130016.

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

Comment 4 Francois-Xavier Coudert 2007-11-16 22:24:55 UTC
Regression fixed by reverting the patch, sorry for the breakage.