https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80717
Bug ID: 80717 Summary: LTO wrappers segfault if run with absolute path Product: gcc Version: 7.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto Assignee: unassigned at gcc dot gnu.org Reporter: theivorytower at gmail dot com Target Milestone: --- When I run any of the LTO wrappers (gcc-ar, gcc-nm, gcc-ranlib) with absolute path (e.g. /usr/bin/gcc-ar), the program segfaults immediately. I tried to run some debugging, and I found the culprit is in line 197-204 of gcc-ar.c. Basically gcc-ar was trying to find ar, and "/usr/bin/" was removed from the list of path to search for ar in line 203 of gcc-ar.c. As a result ar cannot be found and the program segfaults. I'm using Arch Linux and my gcc version info is as follows: Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/7.1.1/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /home/hao/code/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++,lto --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 --disable-multilib --disable-werror --enable-checking=release Thread model: posix gcc version 7.1.1 20170508 (GCC)