PR port-alpha/54307

GCC 9.3 seems to be able to compile rtree.c with -O2:

- No new regressions in ATF.
- System survives over a night, at least, under heavy loads.

On the other hand, unfortunately, GCC 9.3 still miscompiles tcache.c
with -O2 or -O1. For example, even ``gcc -g hello.c'' fails with ICE
if tcache.c is compiled with -O[12] in libc.
This commit is contained in:
rin 2020-10-07 07:35:28 +00:00
parent 7cbf2902dd
commit dbe4bf45a3
2 changed files with 9 additions and 7 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: HACKS,v 1.212 2020/10/05 13:32:31 rin Exp $
# $NetBSD: HACKS,v 1.213 2020/10/07 07:35:28 rin Exp $
#
# This file is intended to document workarounds for currently unsolved
# (mostly) compiler bugs.
@ -951,12 +951,14 @@ descr Disable optimization for rtld.c on the vax with gcc-7. Crashes on the
kcah
port alpha
hack GCC 7.4/8.3: userland binaries crash randomly (port-alpha/54307)
hack GCC 7.4/8.3/9.3: userland binaries crash randomly (port-alpha/54307)
cdate Fri Nov 1 20:43:35 UTC 2019
mdate Wed Oct 7 16:00:00 JST 2020
who rin
file src/external/bsd/jemalloc/lib/Makefile.inc: 1.11
descr rtree.c and tcache.c need to be compiled with -O0, alternatively,
you can compile whole jemalloc with -DJEMALLOC_DEBUG.
descr GCC miscompiles rtree.c (for 7.4 and 8.3) and tcache.c (for 7.4, 8.3,
and 9.3) with optimization levels -O[12]. Compile these files with -O0,
alternatively, compile whole jemalloc with -DJEMALLOC_DEBUG.
kcah
port powerpc

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile.inc,v 1.11 2019/11/01 20:53:10 rin Exp $
# $NetBSD: Makefile.inc,v 1.12 2020/10/07 07:35:28 rin Exp $
JEMALLOC:=${.PARSEDIR}/..
@ -51,11 +51,11 @@ COPTS.ctl.c+=-Wno-error=stack-protector
COPTS.stats.c+=-Wno-error=stack-protector
COPTS.tcache.c+=-Wno-error=stack-protector
.if ${MACHINE} == "alpha"
.if ${MACHINE} == "alpha" && ${ACTIVE_CC} == "gcc"
# These files need to be compiled with -O0, or build everything with
# -DJEMALLOC_DEBUG. Otherwise, userland binaries crash randomly, as
# reported in port-alpha/54307.
COPTS.rtree.c+=-O0
COPTS.rtree.c+= ${${HAVE_GCC:U0} < 9:? -O0 :}
COPTS.tcache.c+=-O0
.endif