[Bug preprocessor/58381] crash in diagnostic_report_current_module when a fatal_error happens during PCH processing on NetBSD/spa64rc
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58381 --- Comment #2 from Martin Husemann --- Created attachment 30790 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30790&action=edit Restore line_table and input_location before calling fatal_error when failing a pch load With this patch, the fatal_error is properly reported: > $BUILDDIR/stage1-gcc/xg++ -B $BUILDDIR/stage1-gcc -Werror -Winvalid-pch > -Wno-deprecated -c conftest.cc conftest.cc:1:0: fatal error: had to relocate PCH #include "conftest.h" ^ compilation terminated.
[Bug preprocessor/58381] crash in diagnostic_report_current_module when a fatal_error happens during PCH processing on NetBSD/spa64rc
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58381 --- Comment #1 from Martin Husemann --- The global pointer "line_table" is changed to the contents of the precompiled header file in gt_pch_restore in this loop: /* Read in all the global pointers, in 6 easy loops. */ for (rt = gt_ggc_rtab; *rt; rt++) for (rti = *rt; rti->base != NULL; rti++) for (i = 0; i < rti->nelt; i++) if (fread ((char *)rti->base + rti->stride * i, sizeof (void *), 1, f) != 1) fatal_error ("can%'t read PCH file: %m"); but not reset to the previous values when the compiler decides to not use the pch contents (for example because the address of the mmap differs). We probably need to save at least line_table (and maybe input_location) at the start of this function and restore it before invoking fatal_error.
[Bug preprocessor/58381] crash in diagnostic_report_current_module when a fatal_error happens during PCH processing on NetBSD/spa64rc
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58381 Martin Husemann changed: What|Removed |Added Version|4.8.1 |5.2.0 --- Comment #3 from Martin Husemann --- This still applies to recent versions and is an obvious fix. Please apply!
[Bug preprocessor/58381] crash in diagnostic_report_current_module when a fatal_error happens during PCH processing on NetBSD/spa64rc
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58381 Manuel López-Ibáñez changed: What|Removed |Added CC||manu at gcc dot gnu.org --- Comment #4 from Manuel López-Ibáñez --- (In reply to Martin Husemann from comment #3) > This still applies to recent versions and is an obvious fix. Please apply! I personally would prefer to factor out all that repeated code into a function pch_read_fatal_error() or to an exit label and use goto pch_read_fatal_error; In any case, patches need to be submitted to gcc-patc...@gcc.gnu.org. Reviewers rarely look for patches in bugzilla. See point #8 in https://gcc.gnu.org/wiki/GettingStarted#Basics:_Contributing_to_GCC_in_10_easy_steps You should perhaps include the name of the file being patched in the subject. I'm not sure we have a maintainer for ggc anymore.
[Bug preprocessor/58381] crash in diagnostic_report_current_module when a fatal_error happens during PCH processing on NetBSD/spa64rc
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58381 --- Comment #5 from Manuel López-Ibáñez --- (In reply to Martin Husemann from comment #3) > This still applies to recent versions and is an obvious fix. Please apply! Points #7 and #8 in https://gcc.gnu.org/wiki/Community can help you to get your patch through.