https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65238
Bug ID: 65238 Summary: [5 Regression] __has_attribute is not handled properly with -traditional-cpp. Product: gcc Version: 5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: iains at gcc dot gnu.org Created attachment 34890 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34890&action=edit trivial test-case. between r218893 and 218951 the handling of __has_attribute has regressed for -traditional-cpp (-E) (as an example) gcc.dg/cpp/trad/include.c has started to fail with excess errors - if run manually: $ ./gcc/xgcc -Bgcc /GCC/gcc-trunk/gcc/testsuite/gcc.dg/cpp/trad/include.c -traditional-cpp -E -m32 -o include.i In file included from /usr/include/Availability.h:145:0, from /usr/include/stdlib.h:62, from /GCC/gcc-trunk/gcc/testsuite/gcc.dg/cpp/trad/include.c:13: /usr/include/AvailabilityInternal.h:1036:0: error: missing '(' after "__has_attribute" #ifdef __has_attribute ^ /usr/include/AvailabilityInternal.h:1037:0: error: missing '(' after "__has_attribute" #if __has_attribute(availability) ^ ===== The trivial test-case compiles fine with: $ ./gcc/xgcc -Bgcc has-attr.c -E -o t.i and with : $ ./gcc/xgcc -Bgcc has-attr.c -E -traditional-cpp -o t.i has-attr.c:3:0: error: missing '(' after "__has_attribute" # if __has_attribute(__totally_non_existant__) ^ cc1(52597) malloc: *** error for object 0x1421194c8: incorrect checksum for freed object - object was probably modified after being freed. *** set a breakpoint in malloc_error_break to debug cc1(52597) malloc: *** error for object 0x142119438: incorrect checksum for freed object - object was probably modified after being freed. *** set a breakpoint in malloc_error_break to debug ==== Of course, it seems reasonable to exclude __has_attribute from traditional-cpp - but, in that case: (a) the testsuite needs amendment in some places, and (b) use of the tag should not cause the free error.