https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96935
Bug ID: 96935 Summary: ICE in subspan, at input.h:69 Product: gcc Version: 10.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: preprocessor Assignee: unassigned at gcc dot gnu.org Reporter: jan.smets at nokia dot com Target Milestone: --- Following ICE is seen : x.cpp: In function 'void a()': x.cpp:3: internal compiler error: in subspan, at input.h:69 3 | #define DB_PRINTF(str, fmt, args...) db_printf(indent_len, 50, fmt, str, ##args) | x.cpp:7: note: in expansion of macro 'DB_PRINTF' 7 | DB_PRINTF("", "%llu", 0); | Target: x86_64-linux-gnu Configured with: /usr/src/gcc/configure --build=x86_64-linux-gnu --disable-multilib --enable-languages=c,c++,fortran,go Compiled with: -O2 -Wformat Reproduces with 10.2, 10.1 9.3, 9.1 Works with 8.4 7.5 The reduced testcase is : #include "x.h" #define DB_PRINTF(str, fmt, args...) db_printf(indent_len, 50, fmt, str, ##args) extern "C" void db_printf(unsigned indent_len, unsigned column_split, const char * fmt, const char * str, ...) __attribute__ ((format (printf, 3, 5))); void a() { unsigned int indent_len = 0; DB_PRINTF("", "%llu", 0); // preprocesses to: db_printf(indent_len, 50, "%llu", ""); } But I suspect the testcase is just garbage. I tried various ways trying to reduce x.h, but even the slightest change makes the problem go away. "x.h" recursively includes about 200 other header files. A "flat" x.h (700k lines) (-fdirectives-only) does not reproduce the issue. This ICE occurs on couple of dozen files in my project. Some print "during GIMPLE pass: strlen". Goes away with --enable-checking=no, but then other problems show up (ICE in linemap_compare_locations, at libcpp/line-map.c:1359 - which may or may not be related) I suppose my next best option is start a bisect between 8.x and 9.x ? Thanks