Just compile this line: # 31 "eval.c" 2 to get a segmentation fault. #0 fe_file_change (new_map=0x0) at ../../gcc/gcc/c-lex.c:205 #1 0x005618dd in cb_file_change (pfile=0xa069f48, new_map=0x0) at ../../gcc/gcc/c-opts.c:1415 #2 0x008b9870 in do_linemarker (pfile=0xa069f48) at ../../gcc/gcc/cpplib.c:873 #3 0x008b89c8 in _cpp_handle_directive (pfile=0xa069f48, indented=0) at ../../gcc/gcc/cpplib.c:424 #4 0x008bca59 in _cpp_lex_token (pfile=0xa069f48) at ../../gcc/gcc/cpplex.c:659 #5 0x008c37c0 in cpp_get_token (pfile=0xa069f48) at ../../gcc/gcc/cppmacro.c:1064 #6 0x0055446d in c_lex (value=0x22fcb4) at ../../gcc/gcc/c-lex.c:307 #7 0x004c29f8 in cp_lexer_get_preprocessor_token (lexer=0x0, token=0x22fcb0) at ../../gcc/gcc/cp/parser.c:632 #8 0x004c240a in cp_lexer_new_main () at ../../gcc/gcc/cp/parser.c:304
I can confirm this on the mainline (20030628) with the c++ and c frontends. With the FORTRAN frontend I get an error: [omni:~/src/gccPRs] pinskia% g77 pr11361.f eval.c:30: error: #-lines for entering and leaving files don't match Here is the backtrace for the c frontend (looks like pfile->map is not being initialized): #0 fe_file_change (new_map=0x0) at /Volumes/UFS_Partition/pinskia/src/fsf/gcc-clean/src/gcc/ c-lex.c:207 #1 0x00035610 in cb_file_change (pfile=0x0, new_map=0x0) at /Volumes/UFS_Partition/pinskia/ src/fsf/gcc-clean/src/gcc/c-opts.c:1415 #2 0x000485c8 in _cpp_do_file_change (pfile=0xc32c70, reason=LC_ENTER, to_file=0x35610 "\210\037", file_line=31, sysp=12803959) at /Volumes/UFS_Partition/pinskia/src/fsf/gcc-clean/ src/gcc/cpplib.c:889 #3 0x00048528 in do_linemarker (pfile=0xc32c70) at /Volumes/UFS_Partition/pinskia/src/fsf/ gcc-clean/src/gcc/cpplib.c:873 #4 0x00047850 in _cpp_handle_directive (pfile=0xc32c70, indented=0) at /Volumes/ UFS_Partition/pinskia/src/fsf/gcc-clean/src/gcc/cpplib.c:424 #5 0x00041fb8 in _cpp_lex_token (pfile=0xc32c70) at /Volumes/UFS_Partition/pinskia/src/fsf/ gcc-clean/src/gcc/cpplex.c:659 #6 0x0003fde0 in cpp_get_token (pfile=0xc32c70) at /Volumes/UFS_Partition/pinskia/src/fsf/ gcc-clean/src/gcc/cppmacro.c:1064 #7 0x0000ce2c in c_lex (value=0x3cb028) at /Volumes/UFS_Partition/pinskia/src/fsf/gcc-clean/ src/gcc/c-lex.c:307 #8 0x00007ac4 in _yylex () at c-parse.y:2966 #9 0x000078f4 in yylex () at c-parse.y:3074 #10 0x00002d28 in yyparse () at /usr/share/bison.simple:432 #11 0x00034dc0 in c_common_parse_file (set_yydebug=0) at /Volumes/UFS_Partition/pinskia/ src/fsf/gcc-clean/src/gcc/c-opts.c:1179 #12 0x0006fa3c in compile_file () at /Volumes/UFS_Partition/pinskia/src/fsf/gcc-clean/src/gcc/ toplev.c:2075 #13 0x00075448 in do_compile () at /Volumes/UFS_Partition/pinskia/src/fsf/gcc-clean/src/gcc/ toplev.c:5147 #14 0x000754d8 in toplev_main (argc=14, argv=0xbffffbdc) at /Volumes/UFS_Partition/pinskia/ src/fsf/gcc-clean/src/gcc/toplev.c:5176 #15 0x00001cb8 in _start (argc=14, argv=0xbffffbdc, envp=0xbffffc18) at /SourceCache/Csu/ Csu-45/crt.c:267 #16 0x00001b38 in start ()
Subject: Re: New: [3.4 regression] ICE (segfault) in c-lex.c with one-liner giovannibajo at libero dot it wrote:- > PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org. > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11361 > > Summary: [3.4 regression] ICE (segfault) in c-lex.c with one- > liner > Product: gcc > Version: 3.4 > Status: UNCONFIRMED > Keywords: ice-on-invalid-code > Severity: normal > Priority: P2 > Component: preprocessor > AssignedTo: unassigned at gcc dot gnu dot org > ReportedBy: giovannibajo at libero dot it > CC: gcc-bugs at gcc dot gnu dot org > GCC build triplet: i686-pc-cygwin > GCC host triplet: i686-pc-cygwin > GCC target triplet: i686-pc-cygwin > > Just compile this line: > > # 31 "eval.c" 2 > > to get a segmentation fault. Per, this was introduced by your line-map.c change of a few months ago. line-map.c used to guarantee to retain internal consistency even if the client gave it nonsense, and cpplib relies on that. After your patch, it no longer maintains internal consistency. Neil.
Neils says it's caused by this patch: 2003-03-18 Per Bothner <per at bothner dot com> Various cleanups to help compile server. http://gcc.gnu.org/ml/gcc-patches/2003-03/msg01716.html I'm assigning the bug to Per.
Created attachment 4324 [details] proposed fix I still need to run the test-suite, but its seems to fix the bug, and is compatible with the compile server.
This patch never went in.
Subject: Bug 11361 CVSROOT: /cvs/gcc Module name: gcc Changes by: bothner@gcc.gnu.org 2003-07-22 23:11:38 Modified files: gcc : line-map.c ChangeLog Log message: * line-map.c (add_line_map): Handle invalid LEAVE request. Fixes PR preprocessor/11361. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/line-map.c.diff?cvsroot=gcc&r1=1.13&r2=1.14 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.597&r2=2.598
Fixed by the patch.