Bug 11141 - [3.4 Regression] Pre-Proccessed Source causes segmentation fault
Summary: [3.4 Regression] Pre-Proccessed Source causes segmentation fault
Status: RESOLVED DUPLICATE of bug 11124
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 3.4.0
: P2 normal
Target Milestone: 3.4.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-06-10 02:48 UTC by bdavis9659
Modified: 2004-01-17 04:22 UTC (History)
1 user (show)

See Also:
Host: i386/gnu/linux
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2003-06-10 19:27:46


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description bdavis9659 2003-06-10 02:48:27 UTC
The following example (minimized to 3 total lines) no longer compiles with g77:

C file    "demo.F"
#include "a.h"
       end

C file     "a.h"
#define PI 3.1415

Here is the output:
[bdavis@rh bin]$ /usr/local/bin/g77 demo.F
a.h:0: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.


And the compiler version:

[bdavis@rh bin]$ /usr/local/bin/g77 -v
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.4/specs
Configured with: ../gcc/configure --enable-languages=f77,c --enable-checking
Thread model: posix
gcc version 3.4 20030610 (experimental)
Comment 1 Andrew Pinski 2003-06-10 19:27:45 UTC
confirmed on the mainline (20030610):
Here is the preprocessed source that causes the problem:
# 1 "pr11141.F"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "pr11141.F"
# 1 "pr11141.h" 1
# 2 "pr11141.F" 2
       end


ffelex_file_push_ (old_lineno=1, filename=0x40076494 "pr11141.h") at /home/gates/
pinskia/src/gnu/gcc/src/gcc/f/lex.c:816
816       input_file_stack->location.line = old_lineno;
(gdb) p input_file_stack
$1 = (struct file_stack *) 0x0
(gdb) bt
#0  ffelex_file_push_ (old_lineno=1, filename=0x40076494 "pr11141.h") at /home/gates/
pinskia/src/gnu/gcc/src/gcc/f/lex.c:816
#1  0x0809482b in ffelex_hash_ (finput=0x8546188) at /home/gates/pinskia/src/gnu/gcc/
src/gcc/f/lex.c:1237
#2  0x08095394 in ffelex_file_fixed (wf=0x1, f=0x8546188) at /home/gates/pinskia/src/
gnu/gcc/src/gcc/f/lex.c:1794
#3  0x080e13bf in ffe_file (wf=0x40076460, f=0x8546188) at /home/gates/pinskia/src/
gnu/gcc/src/gcc/f/top.c:619
#4  0x08098741 in ffe_parse_file (set_yydebug=0) at /home/gates/pinskia/src/gnu/gcc/
src/gcc/f/parse.c:44
#5  0x082ebffa in compile_file () at /home/gates/pinskia/src/gnu/gcc/src/gcc/toplev.c:2214
#6  0x082f2127 in do_compile () at /home/gates/pinskia/src/gnu/gcc/src/gcc/
toplev.c:5742
#7  0x082f2199 in toplev_main (argc=139778712, argv=0x0) at /home/gates/pinskia/src/
gnu/gcc/src/gcc/toplev.c:5771
#8  0x080e239b in main (argc=139778712, argv=0x854da98) at /home/gates/pinskia/
src/gnu/gcc/src/gcc/main.c:37
Comment 2 Neil Booth 2003-06-10 20:18:17 UTC
Subject: Re:  [3.4 Regression] Pre-Proccessed Source causes segmentation fault

pinskia@physics.uc.edu wrote:-

> ffelex_file_push_ (old_lineno=1, filename=0x40076494 "pr11141.h") at /home/gates/
> pinskia/src/gnu/gcc/src/gcc/f/lex.c:816
> 816       input_file_stack->location.line = old_lineno;
> (gdb) p input_file_stack
> $1 = (struct file_stack *) 0x0
> (gdb) bt
> #0  ffelex_file_push_ (old_lineno=1, filename=0x40076494 "pr11141.h") at /home/gates/
> pinskia/src/gnu/gcc/src/gcc/f/lex.c:816
> #1  0x0809482b in ffelex_hash_ (finput=0x8546188) at /home/gates/pinskia/src/gnu/gcc/
> src/gcc/f/lex.c:1237

This might mean it's caused by Per's recent toplev.c file stack patch.
I recall another very recent bug report which looked like having this
as a common culprit.

Neil.
Comment 3 Andrew Pinski 2003-06-16 18:13:46 UTC
This is the same problem as bug 11124 with same backtrace and stuff and that one has 
identified the patch which caused this regression.

*** This bug has been marked as a duplicate of 11124 ***