public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug preprocessor/58381] New: crash in diagnostic_report_current_module when a fatal_error happens during PCH processing on NetBSD/spa64rc
@ 2013-09-10 10:51 martin at netbsd dot org
  2013-09-10 14:52 ` [Bug preprocessor/58381] " martin at netbsd dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: martin at netbsd dot org @ 2013-09-10 10:51 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58381

            Bug ID: 58381
           Summary: crash in diagnostic_report_current_module when a
                    fatal_error happens during PCH processing on
                    NetBSD/spa64rc
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: martin at netbsd dot org

In toplev_main variable line_table is initialized and becomes 0x417dc000,
however, when invoking diagnostic_report_current_module with this backtrace it
is different:

#0  diagnostic_report_current_module (context=0x17b28d0, where=19) at
../../gcc-4.8.1/gcc/diagnostic.c:468
#1  0x00000000003a6368 in cp_diagnostic_starter (context=0x17b28d0,
diagnostic=0xffffffffffffa3e8)
    at ../../gcc-4.8.1/gcc/cp/error.c:2907
#2  0x00000000012d5e44 in diagnostic_report_diagnostic (context=0x17b28d0,
diagnostic=0xffffffffffffa3e8)
    at ../../gcc-4.8.1/gcc/diagnostic.c:756
#3  0x00000000012d6b90 in fatal_error (gmsgid=0x13e1230 "had to relocate PCH")
at ../../gcc-4.8.1/gcc/diagnostic.c:1076
#4  0x00000000008e83dc in gt_pch_restore (f=0x424a0738) at
../../gcc-4.8.1/gcc/ggc-common.c:704
#5  0x00000000005c575c in c_common_read_pch (pfile=0x42765800, name=0x4275dbc0
"conftest.h.gch", fd=4, 
    orig_name=0x4275dbb0 "conftest.h") at
../../gcc-4.8.1/gcc/c-family/c-pch.c:370
#6  0x00000000012f05f8 in should_stack_file (pfile=0x42765800, file=0x42788130,
import=false)
    at ../../gcc-4.8.1/libcpp/files.c:787
#7  0x00000000012f097c in _cpp_stack_file (pfile=0x42765800, file=0x42788130,
import=false)
    at ../../gcc-4.8.1/libcpp/files.c:872
#8  0x00000000012f0fe4 in _cpp_stack_include (pfile=0x42765800,
fname=0x4275db90 "conftest.h", angle_brackets=0, 
    type=IT_INCLUDE) at ../../gcc-4.8.1/libcpp/files.c:1008
#9  0x00000000012e1fc4 in do_include_common (pfile=0x42765800, type=IT_INCLUDE)
    at ../../gcc-4.8.1/libcpp/directives.c:793
#10 0x00000000012e2024 in do_include (pfile=0x42765800) at
../../gcc-4.8.1/libcpp/directives.c:804
#11 0x00000000012e13dc in _cpp_handle_directive (pfile=0x42765800, indented=0)
    at ../../gcc-4.8.1/libcpp/directives.c:492
#12 0x00000000012f9dc4 in _cpp_lex_token (pfile=0x42765800) at
../../gcc-4.8.1/libcpp/lex.c:1990
#13 0x0000000001306cec in cpp_get_token_1 (pfile=0x42765800,
location=0xffffffffffffb0b8)
    at ../../gcc-4.8.1/libcpp/macro.c:2355
#14 0x0000000001307330 in cpp_get_token_with_location (pfile=0x42765800,
loc=0xffffffffffffb0b8)
    at ../../gcc-4.8.1/libcpp/macro.c:2537
#15 0x00000000005b9484 in c_lex_with_flags (value=0xffffffffffffb0c0,
loc=0xffffffffffffb0b8, 
    cpp_flags=0xffffffffffffb0b2 "", lex_flags=0) at
../../gcc-4.8.1/gcc/c-family/c-lex.c:300
#16 0x00000000003b225c in cp_lexer_get_preprocessor_token (lexer=0x0,
token=0xffffffffffffb0b0)
    at ../../gcc-4.8.1/gcc/cp/parser.c:715
#17 0x00000000003f64e8 in cp_parser_initial_pragma
(first_token=0xffffffffffffb0b0)
    at ../../gcc-4.8.1/gcc/cp/parser.c:28139
#18 0x00000000003b1d98 in cp_lexer_new_main () at
../../gcc-4.8.1/gcc/cp/parser.c:585
#19 0x00000000003b6604 in cp_parser_new () at
../../gcc-4.8.1/gcc/cp/parser.c:3253
#20 0x00000000003f6b78 in c_parse_file () at
../../gcc-4.8.1/gcc/cp/parser.c:28335
#21 0x00000000005c30a0 in c_common_parse_file () at
../../gcc-4.8.1/gcc/c-family/c-opts.c:1046
#22 0x0000000000c5f230 in compile_file () at ../../gcc-4.8.1/gcc/toplev.c:543
#23 0x0000000000c62540 in do_compile () at ../../gcc-4.8.1/gcc/toplev.c:1864
#24 0x0000000000c62788 in toplev_main (argc=24, argv=0xffffffffffffb718) at
../../gcc-4.8.1/gcc/toplev.c:1940
#25 0x00000000012bc2c0 in main (argc=24, argv=0xffffffffffffb718) at
../../gcc-4.8.1/gcc/main.c:36

(gdb) print line_table
$6 = (line_maps *) 0x42e70000

(gdb) print *line_table
$16 = {info_ordinary = {maps = 0x114000000, allocated = 1, used = 1115871712,
cache = 0}, info_macro = {
    maps = 0x105000000, allocated = 0, used = 1117049688, cache = 0}, depth =
1, trace_includes = 55, 
  highest_location = 3, highest_line = 1117048808, max_column_hint = 0,
reallocator = 0x115000000, 
  round_alloc_size = 0, location_adhoc_data_map = {htab = 0x0, curr_loc = 1,
allocated = 335544320, data = 0x24282d9e0}}

The "used" fields look strange. Later in the same call it crashes:

Program received signal SIGSEGV, Segmentation fault.
0x00000000012fff88 in linemap_location_from_macro_expansion_p (set=0x42e70000,
location=19)
    at ../../gcc-4.8.1/libcpp/line-map.c:948
948       linemap_assert (location <= MAX_SOURCE_LOCATION
(gdb) bt
#0  0x00000000012fff88 in linemap_location_from_macro_expansion_p
(set=0x42e70000, location=19)
    at ../../gcc-4.8.1/libcpp/line-map.c:948
#1  0x00000000012ff31c in linemap_lookup (set=0x42e70000, line=19) at
../../gcc-4.8.1/libcpp/line-map.c:642
#2  0x000000000130065c in linemap_macro_loc_to_def_point (set=0x42e70000,
location=19, original_map=0xffffffffffffa1a8)
    at ../../gcc-4.8.1/libcpp/line-map.c:1134
#3  0x0000000001300934 in linemap_resolve_location (set=0x42e70000, loc=19,
lrk=LRK_MACRO_DEFINITION_LOCATION, 
    map=0xffffffffffffa1a8) at ../../gcc-4.8.1/libcpp/line-map.c:1263
#4  0x00000000012d4ab8 in diagnostic_report_current_module (context=0x17b28d0,
where=19)
    at ../../gcc-4.8.1/gcc/diagnostic.c:481


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-08-06  9:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-10 10:51 [Bug preprocessor/58381] New: crash in diagnostic_report_current_module when a fatal_error happens during PCH processing on NetBSD/spa64rc martin at netbsd dot org
2013-09-10 14:52 ` [Bug preprocessor/58381] " martin at netbsd dot org
2013-09-10 15:29 ` martin at netbsd dot org
2015-08-06  7:36 ` martin at netbsd dot org
2015-08-06  9:29 ` manu 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).