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

--- Comment #6 from Romain Geissler <romain.geissler at amadeus dot com> ---
Hi,

Tried to apply this patch on top of current trunk. During my build process, I
bootstrap a complete Linux/binutils/glibc/gcc toolchain following the Linux
From Scratch guidelines.

Without the patch, the bootstrap works fine. With the patch, the bootstrap
fails when using a newly built gcc 8, I try to build the Linux headers. Here
are the logs I have:

+ cd /workdir/src/linux-2.6.32.23
+ make mrproper
+ make INSTALL_HDR_PATH=dest headers_install
  CHK     include/linux/version.h
  UPD     include/linux/version.h
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/basic/docproc
  HOSTCC  scripts/basic/hash
  HOSTCC  scripts/unifdef
In file included from
/home/jenkins/workspace/OTF_Toolchain_release_4.0-YQJ6EBM33XTPWHNNQSFSZFEGBOIWUEOX32S2OZLINN43UBSUZTJA/output/build/temporary-system/install/include/string.h:630,
                 from scripts/unifdef.c:72:
scripts/unifdef.c: In function 'Mpass':
scripts/unifdef.c:377:28: internal compiler error: Segmentation fault
 static void Mpass (void) { strncpy(keyword, "if  ", 4); Pelif(); }

                            ^~~~~~~

scripts/unifdef.c:377:28: internal compiler error: Aborted
gcc: internal compiler error: Aborted signal terminated program cc1
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
scripts/Makefile.host:118: recipe for target 'scripts/unifdef' failed
make[1]: *** [scripts/unifdef] Error 4
Makefile:1089: recipe for target '__headers' failed
make: *** [__headers] Error 2


I expect that you would be able to reproduce the same error by downloading the
Linux headers
(https://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.32.23.tar.gz) and then:

make mrproper
make INSTALL_HDR_PATH=dest headers_install


This file is actually pretty simple. See
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/tree/scripts/unifdef.c?h=v2.6.32.23#n377

...
static void Pelif (void) { print(); ignoreoff(); state(IS_PASS_MIDDLE); }
...
static void Mpass (void) { strncpy(keyword, "if  ", 4); Pelif(); }
...

Maybe the fact that the instruction that follows strncpy is a function call
makes gcc seg faults ?

Cheers,
Romain

Reply via email to