public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug preprocessor/61474] New: ICE (segfault) in preprocessor
@ 2014-06-11 12:39 doko at gcc dot gnu.org
2014-06-12 9:22 ` [Bug preprocessor/61474] " rguenth at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: doko at gcc dot gnu.org @ 2014-06-11 12:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61474
Bug ID: 61474
Summary: ICE (segfault) in preprocessor
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: preprocessor
Assignee: unassigned at gcc dot gnu.org
Reporter: doko at gcc dot gnu.org
seen on any version back to 4.4
$ cat a.c
#include "b.h"
#include "c.h"
$ cat b.h
# 1 "c.h" 1
$ gcc -E a.c
# 1 "a.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 1 "<command-line>" 2
# 1 "a.c"
# 1 "b.h" 1
# 1 "c.h" 1
# 1 "b.h" 2
In file included from a.c:1:0:
b.h:1:0: internal compiler error: Segmentation fault
# 1 "c.h" 1
^
Please submit a full bug report,
with preprocessed source if appropriate.
Program received signal SIGSEGV, Segmentation fault.
0x0000000000d990a8 in ?? ()
(gdb) bt
#0 0x0000000000d990a8 in ?? ()
#1 0x0000000000d997e8 in ?? ()
#2 0x0000000000d9a3ab in _cpp_stack_file ()
#3 0x0000000000d9a844 in _cpp_stack_include ()
#4 0x0000000000d92666 in ?? ()
#5 0x0000000000d931e8 in _cpp_handle_directive ()
#6 0x0000000000d9fa1d in _cpp_lex_token ()
#7 0x0000000000da42d0 in ?? ()
#8 0x00000000005d5af8 in preprocess_file(cpp_reader*) ()
#9 0x00000000005d4591 in c_common_init() ()
#10 0x000000000057faee in c_objc_common_init() ()
#11 0x00000000008b4fe7 in toplev_main(int, char**) ()
#12 0x00007ffff69e8ec5 in __libc_start_main (main=0x5526e0 <main>, argc=12,
argv=0x7fffffffe5e8,
init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>,
stack_end=0x7fffffffe5d8)
at libc-start.c:287
#13 0x0000000000552915 in _start ()
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug preprocessor/61474] ICE (segfault) in preprocessor
2014-06-11 12:39 [Bug preprocessor/61474] New: ICE (segfault) in preprocessor doko at gcc dot gnu.org
@ 2014-06-12 9:22 ` rguenth at gcc dot gnu.org
2021-03-09 17:04 ` doko at debian dot org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-06-12 9:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61474
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
I think we have a dup of this somewhere
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug preprocessor/61474] ICE (segfault) in preprocessor
2014-06-11 12:39 [Bug preprocessor/61474] New: ICE (segfault) in preprocessor doko at gcc dot gnu.org
2014-06-12 9:22 ` [Bug preprocessor/61474] " rguenth at gcc dot gnu.org
@ 2021-03-09 17:04 ` doko at debian dot org
2023-09-20 20:46 ` cvs-commit at gcc dot gnu.org
2023-09-20 20:49 ` lhyatt at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: doko at debian dot org @ 2021-03-09 17:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61474
Matthias Klose <doko at debian dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |doko at debian dot org
--- Comment #2 from Matthias Klose <doko at debian dot org> ---
seen with trunk 20210306
$ gcc-11 -E a.c
# 0 "a.c"
# 0 "<built-in>"
# 0 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 0 "<command-line>" 2
# 1 "a.c"
# 1 "b.h" 1
# 1 "c.h" 1
# 1 "b.h" 2
In file included from a.c:1:
b.h:1: internal compiler error: Segmentation fault
1 | # 1 "c.h" 1
|
0xd041a0 crash_signal
../../src/gcc/toplev.c:327
0x11e616c open_file
../libcpp/../../src/libcpp/files.c:225
0x165a9ba read_file
../libcpp/../../src/libcpp/files.c:770
0x11e62dc _cpp_stack_file
../libcpp/../../src/libcpp/files.c:942
0x1684cd2 do_include_common
../libcpp/../../src/libcpp/directives.c:853
0x120a24f _cpp_handle_directive
../libcpp/../../src/libcpp/directives.c:541
0x1204fa4 _cpp_lex_token
../libcpp/../../src/libcpp/lex.c:2809
0x120927f cpp_get_token_1
../libcpp/../../src/libcpp/macro.c:2839
0x16841c3 cpp_get_token_with_location(cpp_reader*, unsigned int*)
../libcpp/../../src/libcpp/macro.c:3108
0x16841c3 scan_translation_unit
../../src/gcc/c-family/c-ppoutput.c:320
0x16841c3 preprocess_file(cpp_reader*)
../../src/gcc/c-family/c-ppoutput.c:102
0x167e491 c_common_init()
../../src/gcc/c-family/c-opts.c:1195
0x163fb1b lang_dependent_init
../../src/gcc/toplev.c:1889
0x163fb1b do_compile
../../src/gcc/toplev.c:2186
Please submit a full bug report,
with preprocessed source if appropriate.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug preprocessor/61474] ICE (segfault) in preprocessor
2014-06-11 12:39 [Bug preprocessor/61474] New: ICE (segfault) in preprocessor doko at gcc dot gnu.org
2014-06-12 9:22 ` [Bug preprocessor/61474] " rguenth at gcc dot gnu.org
2021-03-09 17:04 ` doko at debian dot org
@ 2023-09-20 20:46 ` cvs-commit at gcc dot gnu.org
2023-09-20 20:49 ` lhyatt at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-09-20 20:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61474
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Lewis Hyatt <lhyatt@gcc.gnu.org>:
https://gcc.gnu.org/g:601dbf2a799f691688dfe78250b5bea2717b5b5e
commit r14-4185-g601dbf2a799f691688dfe78250b5bea2717b5b5e
Author: Lewis Hyatt <lhyatt@gmail.com>
Date: Fri Sep 15 13:31:51 2023 -0400
libcpp: Fix ICE on #include after a line marker directive [PR61474]
As noted in the PR, GCC will segfault if a file name is first seen in a
linemarker directive, and then later seen in a normal #include. This is
because the fake include process adds the file to the cache with a null
PATH
member. The normal #include finds this file in the cache and then attempts
to use the null PATH. Resolve by adding the file to the cache with a
unique
starting directory, so that the fake entry will only be found by a
subsequent fake include, not by a real one.
libcpp/ChangeLog:
PR preprocessor/61474
* files.cc (_cpp_find_file): Set DONT_READ to TRUE for fake
include files.
(_cpp_fake_include): Pass a unique cpp_dir* address so
the fake file will not be found when looked up for real.
gcc/testsuite/ChangeLog:
PR preprocessor/61474
* c-c++-common/cpp/pr61474-2.h: New test.
* c-c++-common/cpp/pr61474.c: New test.
* c-c++-common/cpp/pr61474.h: New test.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug preprocessor/61474] ICE (segfault) in preprocessor
2014-06-11 12:39 [Bug preprocessor/61474] New: ICE (segfault) in preprocessor doko at gcc dot gnu.org
` (2 preceding siblings ...)
2023-09-20 20:46 ` cvs-commit at gcc dot gnu.org
@ 2023-09-20 20:49 ` lhyatt at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: lhyatt at gcc dot gnu.org @ 2023-09-20 20:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61474
Lewis Hyatt <lhyatt at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |lhyatt at gcc dot gnu.org
Status|UNCONFIRMED |RESOLVED
Resolution|--- |FIXED
Target Milestone|--- |14.0
--- Comment #4 from Lewis Hyatt <lhyatt at gcc dot gnu.org> ---
Thanks for the testcase, this is fixed for GCC 14.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-09-20 20:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-11 12:39 [Bug preprocessor/61474] New: ICE (segfault) in preprocessor doko at gcc dot gnu.org
2014-06-12 9:22 ` [Bug preprocessor/61474] " rguenth at gcc dot gnu.org
2021-03-09 17:04 ` doko at debian dot org
2023-09-20 20:46 ` cvs-commit at gcc dot gnu.org
2023-09-20 20:49 ` lhyatt at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).