On 9/17/20 2:07 PM, Jeffrey Walton wrote:

One failure on Ubuntu 18.04 x86_64 under UBsan (-fsanitize=undefined
-fno-sanitize-recover=all).

FAIL: test-c-stack2.sh

That's a Gnulib test failure caused by -fsanitize=undefined getting in the way of a test harness self-test. I installed the attached Gnulib patch to work around the glitch.
>From d4fdfe40ab297fc095b542b6f257c1947ba21067 Mon Sep 17 00:00:00 2001
From: Paul Eggert <egg...@cs.ucla.edu>
Date: Fri, 18 Sep 2020 10:33:02 -0700
Subject: [PATCH] c-stack-tests: fix -fsanitize=undefined false alarm
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* tests/test-c-stack2.sh: Skip the test-harness self-test
if ‘gcc -fsanitize=undefined’ is in use.
---
 ChangeLog              | 6 ++++++
 tests/test-c-stack2.sh | 7 +++++++
 2 files changed, 13 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index dc585078c..703da6058 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2020-09-18  Paul Eggert  <egg...@cs.ucla.edu>
+
+	c-stack-tests: fix -fsanitize=undefined false alarm
+	* tests/test-c-stack2.sh: Skip the test-harness self-test
+	if ‘gcc -fsanitize=undefined’ is in use.
+
 2020-09-17  Paul Eggert  <egg...@cs.ucla.edu>
 
 	signalblocking: simplify and remove gl_SILENT
diff --git a/tests/test-c-stack2.sh b/tests/test-c-stack2.sh
index 2944ff5ba..7f035933f 100755
--- a/tests/test-c-stack2.sh
+++ b/tests/test-c-stack2.sh
@@ -23,6 +23,13 @@ case $? in
         exit 77
       fi
       ;;
+  1)
+      # Dereferencing NULL exits the program with status 1,
+      # so this test doesn't check the c-stack testing harness like it should.
+      # https://lists.gnu.org/r/grep-devel/2020-09/msg00034.html
+      cat t-c-stack2.tmp >&2
+      echo 'skipping test (perhaps gcc -fsanitize=undefined is in use?)'
+      exit 77;;
   0) (exit 1); exit 1 ;;
 esac
 if grep 'program error' t-c-stack2.tmp >/dev/null ; then
-- 
2.17.1

Reply via email to