Module Name:    src
Committed By:   rin
Date:           Wed Oct  7 07:35:28 UTC 2020

Modified Files:
        src/doc: HACKS
        src/external/bsd/jemalloc/lib: Makefile.inc

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.212 -r1.213 src/doc/HACKS
cvs rdiff -u -r1.11 -r1.12 src/external/bsd/jemalloc/lib/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/HACKS
diff -u src/doc/HACKS:1.212 src/doc/HACKS:1.213
--- src/doc/HACKS:1.212	Mon Oct  5 13:32:31 2020
+++ src/doc/HACKS	Wed Oct  7 07:35:28 2020
@@ -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
 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

Index: src/external/bsd/jemalloc/lib/Makefile.inc
diff -u src/external/bsd/jemalloc/lib/Makefile.inc:1.11 src/external/bsd/jemalloc/lib/Makefile.inc:1.12
--- src/external/bsd/jemalloc/lib/Makefile.inc:1.11	Fri Nov  1 20:53:10 2019
+++ src/external/bsd/jemalloc/lib/Makefile.inc	Wed Oct  7 07:35:28 2020
@@ -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
 

Reply via email to