This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/66909] New: Internal Compiler Error when #including files from /sys on Linux


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

            Bug ID: 66909
           Summary: Internal Compiler Error when #including files from
                    /sys on Linux
           Product: gcc
           Version: 5.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nate at natecraun dot net
  Target Milestone: ---

Hello,

I have encountered a bug where #including files from /sys causes gcc to have an
internal compiler error:

    In file included from bug.c:1:0:

    bug.c:1:0: internal compiler error: Aborted
     #include "/sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size"
     ^
    Please submit a full bug report,
    with preprocessed source if appropriate.
    See <http://bugzilla.redhat.com/bugzilla> for instructions.


Ths seems to cause an abort on gcc 5.1.1 and a segfault on gcc 4.8. Clang
manages to #include the file, but produces about 4000 some warnings about null
characters, so this might be a hint about what's going wrong.

Now of course I don't think there is any practical reason to #include files
from /sys. But it still shouldn't cause a compiler crash.

The bug can be reproduced with a source file #including any file from /sys

For example:

bug.c:

    #include "/sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size"


Here is the .i file.

bug.i:

    # 1 "bug.c"
    # 1 "<built-in>"
    # 1 "<command-line>"
    # 1 "/usr/include/stdc-predef.h" 1 3 4
    # 1 "<command-line>" 2
    # 1 "bug.c"

Here is gcc -v:

Using built-in specs.
COLLECT_GCC=/bin/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/5.1.1/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap
--enable-languages=c,c++,objc,obj-c++,fortran,ada,go,lto --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared
--enable-threads=posix --enable-checking=release --enable-multilib
--with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions
--enable-gnu-unique-object --enable-linker-build-id
--with-linker-hash-style=gnu --enable-plugin --enable-initfini-array
--disable-libgcj --with-default-libstdcxx-abi=c++98 --with-isl --enable-libmpx
--enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686
--build=x86_64-redhat-linux
Thread model: posix
gcc version 5.1.1 20150618 (Red Hat 5.1.1-4) (GCC) 


My uname -a:

Linux localhost.localdomain 4.0.6-300.fc22.x86_64 #1 SMP Tue Jun 23 13:58:53
UTC 2015 x86_64 x86_64 x86_64 GNU/Linux


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]