https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95889
Bug ID: 95889 Summary: corrupt size vs. prev_size and hang when using __has_include with -traditional-cpp Product: gcc Version: 10.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: preprocessor Assignee: unassigned at gcc dot gnu.org Reporter: dev-zero at gentoo dot org Target Milestone: --- Part of my testing for issues like https://github.com/evaleev/libint/issues/173 with GCC 10.1 I came up with a silly test header: ****snip**** #if defined __has_include # if __has_include(<stdio.h>) hello there # endif #endif ****snip**** which works as expected with `cpp test.h`: ****snip**** # 1 "test.h" # 1 "<built-in>" # 1 "<command-line>" # 31 "<command-line>" # 1 "/usr/include/stdc-predef.h" 1 3 4 # 32 "<command-line>" 2 # 1 "test.h" hello there ****snip**** But gives the following and hangs when running with `cpp -traditional-cpp test.h`: ****snip**** # 1 "test.h" # 1 "<built-in>" # 1 "<command-line>" # 31 "<command-line>" # 1 "/usr/include/stdc-predef.h" 1 3 4 # 17 "/usr/include/stdc-predef.h" 3 4 [...] # 32 "<command-line>" 2 # 1 "test.h" test.h:3: error: missing '(' before "__has_include" operand 3 | # if __has_include(<stdio.h>) | test.h:3: error: operator "__has_include" requires a header-name test.h:3: warning: null character(s) ignored test.h:3: error: missing binary operator before token "q" *** Error in `/data/tiziano/cp2k/tools/toolchain/install/gcc-10.1.0/lib/gcc/x86_64-pc-linux-gnu/10.1.0/cc1': corrupted size vs. prev_size: 0x0000000002a517a0 *** test.h:1: confused by earlier errors, bailing out ****snip**** Besides this issue with the compiler itself, I wonder what the correct invocation of `__has_include` in traditional mode is (because it seems to be defined).