https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69665
Bug ID: 69665 Summary: Internal error on #pragma push_macro("__FILE__") Product: gcc Version: 5.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: preprocessor Assignee: unassigned at gcc dot gnu.org Reporter: Keith.S.Thompson at gmail dot com Target Milestone: --- The line of code that causes the problem is from this answer on Stack Overflow, posted by Alain Totouom: http://stackoverflow.com/a/30799998/827263 The main problem, of course, is that cpp dies with an internal error. A minor secondary problem is that after reporting the internal error, cpp prints a tab character to stdout, not followed by a newline. I've manually added a newline to the following transcript so all the "$" prompts are left-justified. $ uname -a Linux bomb20 3.16.0-38-generic #52~14.04.1-Ubuntu SMP Fri May 8 09:43:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux $ cpp --version cpp (GCC) 5.3.0 Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ gcc --version gcc (GCC) 5.3.0 Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ cat gcc-push_macro-bug.c #pragma push_macro("__FILE__") $ cpp gcc-push_macro-bug.c gcc-push_macro-bug.c:1:31: internal compiler error: invalid hash type 1 in cpp_macro_definition 0x644ff8 c_cpp_error(cpp_reader*, int, int, unsigned int, unsigned int, char const*, __va_list_tag (*) [1]) /home/kst/src/gcc/gcc-5.3.0/gcc/c-family/c-common.c:10029 0xf6b03a cpp_diagnostic /home/kst/src/gcc/gcc-5.3.0/libcpp/errors.c:60 0xf6b166 cpp_error(cpp_reader*, int, char const*, ...) /home/kst/src/gcc/gcc-5.3.0/libcpp/errors.c:75 0xf7bc14 cpp_macro_definition(cpp_reader*, cpp_hashnode*) /home/kst/src/gcc/gcc-5.3.0/libcpp/macro.c:3330 0xf68c62 do_pragma_push_macro /home/kst/src/gcc/gcc-5.3.0/libcpp/directives.c:1517 0xf679e5 do_pragma /home/kst/src/gcc/gcc-5.3.0/libcpp/directives.c:1432 0xf69451 _cpp_handle_directive /home/kst/src/gcc/gcc-5.3.0/libcpp/directives.c:509 0xf76314 _cpp_lex_token /home/kst/src/gcc/gcc-5.3.0/libcpp/lex.c:2188 0xf7ad67 cpp_get_token_1 /home/kst/src/gcc/gcc-5.3.0/libcpp/macro.c:2442 0x65895f scan_translation_unit /home/kst/src/gcc/gcc-5.3.0/gcc/c-family/c-ppoutput.c:192 0x65895f preprocess_file(cpp_reader*) /home/kst/src/gcc/gcc-5.3.0/gcc/c-family/c-ppoutput.c:113 0x6572d0 c_common_init() /home/kst/src/gcc/gcc-5.3.0/gcc/c-family/c-opts.c:1033 0x5cb7d3 lang_dependent_init /home/kst/src/gcc/gcc-5.3.0/gcc/toplev.c:1836 0x5cb7d3 do_compile /home/kst/src/gcc/gcc-5.3.0/gcc/toplev.c:2053 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions. # 1 "gcc-push_macro-bug.c" # 1 "<built-in>" # 1 "<command-line>" # 1 "/usr/include/stdc-predef.h" 1 3 4 # 1 "<command-line>" 2 # 1 "gcc-push_macro-bug.c" $ gcc -c gcc-push_macro-bug.c gcc-push_macro-bug.c:1:31: internal compiler error: invalid hash type 1 in cpp_macro_definition 0x644ff8 c_cpp_error(cpp_reader*, int, int, unsigned int, unsigned int, char const*, __va_list_tag (*) [1]) /home/kst/src/gcc/gcc-5.3.0/gcc/c-family/c-common.c:10029 0xf6b03a cpp_diagnostic /home/kst/src/gcc/gcc-5.3.0/libcpp/errors.c:60 0xf6b166 cpp_error(cpp_reader*, int, char const*, ...) /home/kst/src/gcc/gcc-5.3.0/libcpp/errors.c:75 0xf7bc14 cpp_macro_definition(cpp_reader*, cpp_hashnode*) /home/kst/src/gcc/gcc-5.3.0/libcpp/macro.c:3330 0xf68c62 do_pragma_push_macro /home/kst/src/gcc/gcc-5.3.0/libcpp/directives.c:1517 0xf679e5 do_pragma /home/kst/src/gcc/gcc-5.3.0/libcpp/directives.c:1432 0xf69451 _cpp_handle_directive /home/kst/src/gcc/gcc-5.3.0/libcpp/directives.c:509 0xf76314 _cpp_lex_token /home/kst/src/gcc/gcc-5.3.0/libcpp/lex.c:2188 0xf7ad67 cpp_get_token_1 /home/kst/src/gcc/gcc-5.3.0/libcpp/macro.c:2442 0x65269c c_lex_with_flags(tree_node**, unsigned int*, unsigned char*, int) /home/kst/src/gcc/gcc-5.3.0/gcc/c-family/c-lex.c:408 0x5fd4ff c_lex_one_token /home/kst/src/gcc/gcc-5.3.0/gcc/c/c-parser.c:258 0x61a9dd c_parser_peek_token /home/kst/src/gcc/gcc-5.3.0/gcc/c/c-parser.c:440 0x61a9dd c_parse_file() /home/kst/src/gcc/gcc-5.3.0/gcc/c/c-parser.c:15443 0x657422 c_common_parse_file() /home/kst/src/gcc/gcc-5.3.0/gcc/c-family/c-opts.c:1057 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions.