Module Name:    src
Committed By:   rin
Date:           Thu Oct  8 08:31:37 UTC 2020

Modified Files:
        src/doc: HACKS
        src/external/gpl3/gdb.old/lib/libgdb: Makefile

Log Message:
GCC 9.3 miscompiles dwarf2{expr,loc}.c with -O2 for earmv5hf{,eb}
(-O1 is fine). This is a new regression introduced in GCC9.

For everyone's safety, extend -O0 hack to dwarf2{expr,loc}.c for
all arm variants with GCC >= 8.


To generate a diff of this commit:
cvs rdiff -u -r1.213 -r1.214 src/doc/HACKS
cvs rdiff -u -r1.10 -r1.11 src/external/gpl3/gdb.old/lib/libgdb/Makefile

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.213 src/doc/HACKS:1.214
--- src/doc/HACKS:1.213	Wed Oct  7 07:35:28 2020
+++ src/doc/HACKS	Thu Oct  8 08:31:37 2020
@@ -1,4 +1,4 @@
-# $NetBSD: HACKS,v 1.213 2020/10/07 07:35:28 rin Exp $
+# $NetBSD: HACKS,v 1.214 2020/10/08 08:31:37 rin Exp $
 #
 # This file is intended to document workarounds for currently unsolved
 # (mostly) compiler bugs.
@@ -975,16 +975,17 @@ descr	Disable optimization on tc.c, loge
 	function "__int64_t llvm::MachineFrameInfo::getObjectOffset(int) const"
 kcah
 
-port	earmv7hf*
-hack	compile gdb/dwarf2expr.c with -O0 for GCC[89] (toolchain/54820, 54877)
+port	arm
+hack	compile gdb/dwarf2{expr,loc}.c with -O0 for GCC[89] (PR/54820, 54877)
 cdate	Wed Apr 29 11:04:58 UTC 2020
-mdate	Mon Oct  5 22:30:00 JST 2020
+mdate	Thu Oct  8 17:00:00 JST 2020
 who	rin
 file	src/external/gpl3/gdb/lib/libgdb/Makefile: 1.22
-descr	GCC 8.4 and 9.3 miscompile dwarf2expr.c with -O[21], which results in
-	crashes with 'gdb_exception_RETURN_MASK_ERROR'. Note that this occurs
-	only for earmv7hf{,eb} as far as I can see. Neither earmv6hf{,eb} nor
-	earmv7{,eb} (softfloat) are affected.
+descr	For earmv7hf{,eb}, GCC 8.4 and 9.3 miscompile dwarf2expr.c with -O[21].
+	For earmv5hf{,eb}, GCC 9.3 miscompiles dwarf2{expr,loc}.c with -O2
+	(GCC9 -O1 and GCC8 -O2 work fine). These result in GDB crash with
+	``gdb_exception_RETURN_MASK_ERROR''. For everyone's safety, compile
+	these files with -O0 for all arm variants with GCC >= 8.
 kcah
 
 port	m68k

Index: src/external/gpl3/gdb.old/lib/libgdb/Makefile
diff -u src/external/gpl3/gdb.old/lib/libgdb/Makefile:1.10 src/external/gpl3/gdb.old/lib/libgdb/Makefile:1.11
--- src/external/gpl3/gdb.old/lib/libgdb/Makefile:1.10	Mon Sep 14 00:40:43 2020
+++ src/external/gpl3/gdb.old/lib/libgdb/Makefile	Thu Oct  8 08:31:37 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.10 2020/09/14 00:40:43 christos Exp $
+#	$NetBSD: Makefile,v 1.11 2020/10/08 08:31:37 rin Exp $
 
 NOCTF=
 HOSTPROG_CXX=   1
@@ -54,12 +54,14 @@ CFLAGS:=		${CXXFLAGS} -std=gnu++11 -Wno-
 
 ada-exp.c: ada-lex.c
 
-.if defined(HAVE_GCC) && ${HAVE_GCC} >= 8 && ${ACTIVE_CC} == "gcc"
-.if !empty(MACHINE_ARCH:Mearmv7hf*)
-# GCC 8.4 miscompiles this with -O2 or -O1 for earmv7hf{,eb}.
-# Neither earmv6hf{,eb} nor earmv7{,eb} are affected.
-COPTS.dwarf2expr.c+=-O0
-.endif
+.if ${MACHINE_CPU} == "arm"
+. if ${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 8
+# GCC 8.4/9.3 miscompile this with -O[21] for earmv7hf{,eb}.
+# GCC 9.3 miscompile this with -O2 for earmv5hf{,eb}.
+COPTS.dwarf2expr.c+=	-O0
+# GCC 9.3 miscompile this with -O2 for earmv5hf{,eb}.
+COPTS.dwarf2loc.c+=	-O0
+. endif
 .endif
 
 # These are generated by implicit rules and are not easy to generate

Reply via email to