[Bug preprocessor/101864] New: Segmentation fault with -Wtraditional + glibc 2.34

harald at gigawatt dot nl gcc-bugzilla@gcc.gnu.org
Wed Aug 11 17:02:13 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101864

            Bug ID: 101864
           Summary: Segmentation fault with -Wtraditional + glibc 2.34
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: harald at gigawatt dot nl
  Target Milestone: ---

This testcase comes from glibc 2.34's sys/cdefs.h, so this is a problem showing
up for any program that uses any of glibc's headers with -Wtraditional.

$ cat test.c
#define __glibc_has_attribute(attr) __has_attribute(attr)
#if __glibc_has_attribute(__deprecated__)
#endif

$ gcc -Wtraditional -E test.c
# 0 "test.c"
# 0 "<built-in>"
# 0 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 0 "<command-line>" 2
# 1 "test.c"
test.c:1: internal compiler error: Segmentation fault
    1 | #define __glibc_has_attribute(attr) __has_attribute(attr)
      | 
0x1542e3f internal_error(char const*, ...)
        ???:0
0x156fa80 cpp_sys_macro_p(cpp_reader*)
        ???:0
0x155f868 cpp_classify_number(cpp_reader*, cpp_token const*, char const**,
unsigned int)
        ???:0
0x1561509 _cpp_parse_expr
        ???:0
0x155bf8f _cpp_handle_directive
        ???:0
0x156ace1 _cpp_lex_token
        ???:0
0x6aece2 preprocess_file(cpp_reader*)
        ???:0
0x6ad33f c_common_init()
        ???:0
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-linux-gnux32/11.2.0/lto-wrapper
Target: x86_64-linux-gnux32
Configured with: /h/gcc-11.2.0/configure --prefix=/usr
--datadir=/usr/share/gcc-11.2.0 --infodir=/usr/share/info
--mandir=/usr/share/man --build=x86_64-linux-gnux32 --host=x86_64-linux-gnux32
--enable-languages=c,c++,d,objc,obj-c++,fortran,ada,go --disable-libstdcxx-pch
--enable-version-specific-runtime-libs --with-abi=x32
--with-multilib-list=mx32,m64,m32 --with-system-zlib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.2.0 (GCC)


More information about the Gcc-bugs mailing list