Bug 149712

Summary: [build] -fno-builtin in CFLAGS will cause gcc(1) to segfault
Product: Base System Reporter: Alexander Best <arundel>
Component: gnuAssignee: freebsd-bugs mailing list <bugs>
Status: Closed Overcome By Events    
Severity: Affects Only Me CC: emaste
Priority: Normal    
Version: 9.0-CURRENT   
Hardware: Any   
OS: Any   

Description Alexander Best freebsd_committer 2010-08-16 19:10:04 UTC
with the following in my make.conf


CPUTYPE = native
COPTFLAGS = -O0 -pipe -fno-builtin -fno-strict-aliasing -funroll-loops
CFLAGS = -O2 -pipe -fno-strict-aliasing -funroll-loops -fno-builtin
CXXFLAGS += -fconserve-space


buildworld will fail:


stage 4.2: building libraries
--------------------------------------------------------------
cd /usr/src;  MAKEOBJDIRPREFIX=/usr/obj  MACHINE_ARCH=amd64  MACHINE=amd64  CPUTYPE=native  GROFF_BIN_PATH=/usr/obj/usr/src/tmp/legacy/usr/bin  GROFF_FONT_PATH=/usr/obj/usr/src/tmp/legacy/usr/share/groff_font  GROFF_TMAC_PATH=/usr/obj/usr/src/tmp/legacy/ usr/share/tmac  _SHLIBDIRPREFIX=/usr/obj/usr/src/tmp  VERSION="FreeBSD 9.0-CURRENT amd64 900016"  INSTALL="sh /usr/src/tools/install.sh"  PATH=/usr/obj/usr/src/tmp/legacy/usr/sbin:/usr/obj/usr/src/tmp/legacy/usr/bin:/usr/obj/usr/src/tmp/legacy/usr/games: /usr/obj/usr/src/tmp/usr/sbin:/usr/obj/usr/src/tmp/usr/bin:/usr/obj/usr/src/tmp/usr/games:/sbin:/bin:/usr/sbin:/usr/bin NO_CTF=1 /usr/obj/usr/src/make.amd64/make -f Makefile.inc1 DESTDIR=/usr/obj/usr/src/tmp -DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_ LINT  -DWITHOUT_MAN -DWITHOUT_PROFILE libraries
cd /usr/src;  /usr/obj/usr/src/make.amd64/make -f Makefile.inc1 _prereq_libs;  /usr/obj/usr/src/make.amd64/make -f Makefile.inc1 _startup_libs;  /usr/obj/usr/src/make.amd64/make -f Makefile.inc1 _prebuild_libs;  /usr/obj/usr/src/make.amd64/make -f Makefi le.inc1 _generic_libs;
===> gnu/lib/libssp/libssp_nonshared (obj,depend,all,install)
rm -f .depend
mkdep -f .depend -a    -DHAVE_CONFIG_H -I/usr/src/gnu/lib/libssp/libssp_nonshared/.. -I/usr/src/gnu/lib/libssp/libssp_nonshared/../../../../contrib/gcclibs/libssp -I/usr/src/gnu/lib/libssp/libssp_nonshared/../../../../contrib/gcclibs/include -DPIC /usr/s rc/gnu/lib/libssp/libssp_nonshared/../../../../contrib/gcclibs/libssp/ssp-local.c
cc -O2 -pipe -fno-strict-aliasing -funroll-loops -fno-builtin -march=native -DHAVE_CONFIG_H -I/usr/src/gnu/lib/libssp/libssp_nonshared/..  -I/usr/src/gnu/lib/libssp/libssp_nonshared/../../../../contrib/gcclibs/libssp  -I/usr/src/gnu/lib/libssp/libssp_non shared/../../../../contrib/gcclibs/include -fPIC -DPIC -fvisibility=hidden -g -std=gnu99 -fstack-protector  -c /usr/src/gnu/lib/libssp/libssp_nonshared/../../../../contrib/gcclibs/libssp/ssp-local.c
*** Signal 11

Stop in /usr/src/gnu/lib/libssp/libssp_nonshared.
*** Error code 1

Stop in /usr/src.
*** Error code 1

Stop in /usr/src.
*** Error code 1

Stop in /usr/src.
*** Error code 1

Stop in /usr/src.


with the following changes to make.conf buildworld succeeds:


--- make.conf-failure	2010-08-16 14:55:31.000000000 +0200
+++ make.conf	2010-08-16 16:04:21.000000000 +0200
@@ -17,7 +17,7 @@
 # compiler flags
 CPUTYPE = native
 COPTFLAGS = -O0 -pipe -fno-builtin -fno-strict-aliasing -funroll-loops
-CFLAGS = -O2 -pipe -fno-strict-aliasing -funroll-loops -fno-builtin
+CFLAGS = -O2 -pipe -fno-strict-aliasing -funroll-loops #-fno-builtin
 CXXFLAGS += -fconserve-space


this issue has been discussed beforehand in [1].

cheers.
alex

[1] http://www.mail-archive.com/freebsd-current@freebsd.org/msg67668.html

How-To-Repeat: cd /usr/src && make buildworld

(with CFLAGS = -O2 -pipe -fno-strict-aliasing -funroll-loops -fno-builtin)
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:59:36 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 2 Ed Maste freebsd_committer 2019-08-12 17:59:02 UTC
gcc 4.2.1 is no longer used on x86 or armv7/arm64 and is on the path for deprecation by FreeBSD 13