http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58370
Bug ID: 58370 Summary: pre compiled headers failure on NetBSD/sparc64 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 Trying to configure gcc fails with an endless loop in one of the configure tests of libstc++. There are actually two errors in this: (1) a fatal error when reading a PCH file "had to relocate PCH" (2) a SIGSEGV when trying to resolve symbol information for the diagnostic message, which in turn leads to a SIGSEGV inside the SIGSEGV handler I don't know if (2) is only fallout from (1). I can provide more debug output if needed (not sure what part of this is NetBSD specific). The backtrace is: #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=0xffffffffffffa0c8) 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=0xffffffffffffa0c8) 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 #5 0x00000000003a6368 in cp_diagnostic_starter (context=0x17b28d0, diagnostic=0xffffffffffffa308) at ../../gcc-4.8.1/gcc/cp/error.c:2907 #6 0x00000000012d5e44 in diagnostic_report_diagnostic (context=0x17b28d0, diagnostic=0xffffffffffffa308) at ../../gcc-4.8.1/gcc/diagnostic.c:756 #7 0x00000000012d6b90 in fatal_error (gmsgid=0x13e1230 "had to relocate PCH") at ../../gcc-4.8.1/gcc/diagnostic.c:1076 #8 0x00000000008e83dc in gt_pch_restore (f=0x424a0738) at ../../gcc-4.8.1/gcc/ggc-common.c:704 #9 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 #10 0x00000000012f05f8 in should_stack_file (pfile=0x42765800, file=0x42788130, import=false) at ../../gcc-4.8.1/libcpp/files.c:787 #11 0x00000000012f097c in _cpp_stack_file (pfile=0x42765800, file=0x42788130, import=false) at ../../gcc-4.8.1/libcpp/files.c:872 #12 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 #13 0x00000000012e1fc4 in do_include_common (pfile=0x42765800, type=IT_INCLUDE) at ../../gcc-4.8.1/libcpp/directives.c:793 #14 0x00000000012e2024 in do_include (pfile=0x42765800) at ../../gcc-4.8.1/libcpp/directives.c:804 #15 0x00000000012e13dc in _cpp_handle_directive (pfile=0x42765800, indented=0) at ../../gcc-4.8.1/libcpp/directives.c:492 #16 0x00000000012f9dc4 in _cpp_lex_token (pfile=0x42765800) at ../../gcc-4.8.1/libcpp/lex.c:1990 #17 0x0000000001306cec in cpp_get_token_1 (pfile=0x42765800, location=0xffffffffffffafd8) at ../../gcc-4.8.1/libcpp/macro.c:2355 #18 0x0000000001307330 in cpp_get_token_with_location (pfile=0x42765800, loc=0xffffffffffffafd8) at ../../gcc-4.8.1/libcpp/macro.c:2537 #19 0x00000000005b9484 in c_lex_with_flags (value=0xffffffffffffafe0, loc=0xffffffffffffafd8, cpp_flags=0xffffffffffffafd2 "", lex_flags=0) at ../../gcc-4.8.1/gcc/c-family/c-lex.c:300 #20 0x00000000003b225c in cp_lexer_get_preprocessor_token (lexer=0x0, token=0xffffffffffffafd0) at ../../gcc-4.8.1/gcc/cp/parser.c:715 #21 0x00000000003f64e8 in cp_parser_initial_pragma ( first_token=0xffffffffffffafd0) at ../../gcc-4.8.1/gcc/cp/parser.c:28139 #22 0x00000000003b1d98 in cp_lexer_new_main () This can be reproduced like this: > cat conftest.h #include <math.h> > cat conftest.cc #include "conftest.h" > $BUILDDIR/stage1-gcc/xg++ -B $BUILDDIR/stage1-gcc -Werror -Winvalid-pch > -Wno-deprecated -x c++-header conftest.h -o conftest.h.gch > $BUILDDIR/stage1-gcc/xg++ -B $BUILDDIR/stage1-gcc -Werror -Winvalid-pch > -Wno-deprecated -c conftest.cc A bit of gdb output: Core was generated by `cc1plus'. Program terminated with signal 11, Segmentation fault. #0 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) list 943 { 944 if (IS_ADHOC_LOC (location)) 945 location = set->location_adhoc_data_map.data[ 946 location & MAX_SOURCE_LOCATION].locus; 947 948 linemap_assert (location <= MAX_SOURCE_LOCATION 949 && (set->highest_location 950 < LINEMAPS_MACRO_LOWEST_LOCATION (set))); 951 if (set == NULL) 952 return false; (gdb) print *set $1 = {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}}