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

            Bug ID: 90034
           Summary: gcc hangs on wait4 after vfork after opening tmp file
           Product: gcc
           Version: 8.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: todd.freed at gmail dot com
  Target Milestone: ---

Created attachment 46123
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46123&action=edit
causes the hang

Here is the command:

> dd if=bug_input.c bs=1 count=3051 2>/dev/null | gcc -xc - # hangs

The hang seems to be specific to this input somehow.

If I pass any count < 3051, it does not hang. For any count >= 3051, it hangs.

If I pass an offset of any kind, it does not hang.

If I take those 3050 bytes and put them in a file instead of passing then to
stdin via pipe, it still hangs.

> gcc -bug_input_0_3050.c # hangs

I've attached the entire file anyway, for context. The file was generated by
GNU bison.

-----------------------------------

strace snippet from the hang

 . . .
getpid()                                = 16236
openat(AT_FDCWD, "/tmp/ccPYKe6J.s", O_RDWR|O_CREAT|O_EXCL, 0600) = 3
close(3)                                = 0
stat("/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1/cc1", {st_mode=S_IFREG|0755,
st_size=26001000, ...}) = 0
access("/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1/cc1", X_OK) = 0
vfork()                                 = 16237
wait4(16237, 

-----------------------------------

strace snippet from a non-hang

 . . .
getpid()                                = 16578
openat(AT_FDCWD, "/tmp/ccBrWed1.s", O_RDWR|O_CREAT|O_EXCL, 0600) = 3
close(3)                                = 0
stat("/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1/cc1", {st_mode=S_IFREG|0755,
st_size=26001000, ...}) = 0
access("/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1/cc1", X_OK) = 0
vfork()                                 = 16579
wait4(16579, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 16579
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=16579, si_uid=1000,
si_status=0, si_utime=0, si_stime=0} ---
getpid()                                = 16578
openat(AT_FDCWD, "/tmp/ccXHF56n.o", O_RDWR|O_CREAT|O_EXCL, 0600) = 3
close(3)                                = 0
 . . .

-----------------------------------

Version Info:

todd@euclid ~/bison
0 master % uname -a
Linux euclid 5.0.4-arch1-1-ARCH #1 SMP PREEMPT Sat Mar 23 21:00:33 UTC 2019
x86_64 GNU/Linux

todd@euclid ~/bison
0 master % pacman -Q gcc
gcc 8.2.1+20181127-1

todd@euclid ~/bison
0 master % gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib
--libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared
--enable-threads=posix --enable-libmpx --with-system-zlib --with-isl
--enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu
--disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object
--enable-linker-build-id --enable-lto --enable-plugin
--enable-install-libiberty --with-linker-hash-style=gnu
--enable-gnu-indirect-function --enable-multilib --disable-werror
--enable-checking=release --enable-default-pie --enable-default-ssp
--enable-cet=auto
Thread model: posix
gcc version 8.2.1 20181127 (GCC)


NOTE : This also repro's on another of my dev machines, with gcc version 8.2.1
20180831 (GCC)

Reply via email to