[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1057635: Fix gcc-13 test failures during package build



Package: gcc-13
Version: 13.2.0-7

The gcc-ice-dump.diff patch causes the GCC driver to test for the
DEB_BUILD_OPTIONS environment variable and generate extra debug output
when an ICE occurs, for instance. This is an interesting feature,
while building other packages, but not while building GCC itself IMHO.
Dejagnu would consider that as excess errors.

I suggest to add variables to DEB_BUILD_OPTIONS to disable that
feature, and use them accordingly for the gcc-13 package itself.
Patches attached. Regression tested on x86_64-linux-gnu for
--enable-languages=c,c++ on bullseye and bookworm. Not essential, but
interesting to have for testing / trixie.

gcc-ice=norepro

   FAIL: gcc.dg/plugin/crash-test-ice-sarif.c
-fplugin=./crash_test_plugin.so (test for excess errors)
    FAIL: gcc.dg/plugin/crash-test-ice-stderr.c
-fplugin=./crash_test_plugin.so (test for excess errors)
    FAIL: gcc.dg/plugin/crash-test-write-though-null-sarif.c
-fplugin=./crash_test_plugin.so (test for excess errors)
    FAIL: gcc.dg/plugin/crash-test-write-though-null-stderr.c
-fplugin=./crash_test_plugin.so (test for excess errors)

gcc-ice=nodump

    FAIL: c-c++-common/goacc/kernels-decompose-pr100400-1-3.c
-std=c++14 (test for excess errors)
    FAIL: c-c++-common/goacc/kernels-decompose-pr100400-1-3.c
-std=c++17 (test for excess errors)
    FAIL: c-c++-common/goacc/kernels-decompose-pr100400-1-3.c
-std=c++20 (test for excess errors)
    FAIL: c-c++-common/goacc/kernels-decompose-pr100400-1-3.c
-std=c++98 (test for excess errors)
    FAIL: c-c++-common/goacc/kernels-decompose-pr100400-1-4.c
-std=c++14 (test for excess errors)
    FAIL: c-c++-common/goacc/kernels-decompose-pr100400-1-4.c
-std=c++17 (test for excess errors)
    FAIL: c-c++-common/goacc/kernels-decompose-pr100400-1-4.c
-std=c++20 (test for excess errors)
    FAIL: c-c++-common/goacc/kernels-decompose-pr100400-1-4.c
-std=c++98 (test for excess errors)
    FAIL: g++.dg/cpp0x/vt-88982.C  -std=c++14 (test for excess errors)
    FAIL: g++.dg/cpp0x/vt-88982.C  -std=c++17 (test for excess errors)
    FAIL: g++.dg/cpp0x/vt-88982.C  -std=c++20 (test for excess errors)
    FAIL: g++.dg/cpp1y/auto-fn61.C  -std=c++14 (test for excess errors)
    FAIL: g++.dg/cpp1y/auto-fn61.C  -std=c++17 (test for excess errors)
    FAIL: g++.dg/cpp1y/auto-fn61.C  -std=c++20 (test for excess errors)
From c046ddaa942288ba15816a94d697b0f45a702424 Mon Sep 17 00:00:00 2001
From: Gwenole Beauchesne <gb.devel@gmail.com>
Date: Sat, 2 Dec 2023 08:02:10 +0100
Subject: [PATCH 2/2] gcc: no ICE repro if DEB_BUILD_OPTIONS contains
 gcc-ice=norepro.

Don't try to reproduce the ICE if DEB_BUILD_OPTIONS environment variable
contains gcc-ice=norepro. This fixes the following testsuite failures:

FAIL: gcc.dg/plugin/crash-test-ice-sarif.c -fplugin=./crash_test_plugin.so (test for excess errors)
FAIL: gcc.dg/plugin/crash-test-ice-stderr.c -fplugin=./crash_test_plugin.so (test for excess errors)
FAIL: gcc.dg/plugin/crash-test-write-though-null-sarif.c -fplugin=./crash_test_plugin.so (test for excess errors)
FAIL: gcc.dg/plugin/crash-test-write-though-null-stderr.c -fplugin=./crash_test_plugin.so (test for excess errors)

Signed-off-by: Gwenole Beauchesne <gb.devel@gmail.com>
---
 gcc/gcc.cc | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index 28164c83c8f..691cf81007b 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -3108,6 +3108,21 @@ access_check (const char *name, int mode)
   return access (name, mode);
 }
 
+/* Check whether DEB_BUILD_OPTIONS environment variable is set, and
+   that it does not contain the specified exclusion keyword.  */
+
+static bool
+has_deb_build_options (const char *exclude_str = nullptr)
+{
+  const char *const deb_build_options = env.get ("DEB_BUILD_OPTIONS");
+  if (!deb_build_options)
+    return false;
+
+  if (exclude_str && strstr (deb_build_options, exclude_str))
+    return false;
+  return true;
+}
+
 /* Callback for find_a_file.  Appends the file name to the directory
    path.  If the resulting file exists in the right mode, return the
    full pathname to the file.  */
@@ -3634,7 +3649,8 @@ execute (void)
 	    /* For ICEs in cc1, cc1obj, cc1plus see if it is
 	       reproducible or not.  */
 	    const char *p;
-	    const char *deb_build_options = env.get("DEB_BUILD_OPTIONS");
+	    const bool deb_build_options
+	      = has_deb_build_options ("gcc-ice=norepro");
 	    if ((flag_report_bug || deb_build_options)
 		&& WEXITSTATUS (status) == ICE_EXIT_CODE
 		&& i == 0
@@ -7895,9 +7911,7 @@ do_report_bug (const char **new_argv, const int nargs,
 
   if (status == ATTEMPT_STATUS_SUCCESS)
     {
-      const char *deb_build_options = env.get("DEB_BUILD_OPTIONS");
-      const bool gcc_dump = deb_build_options &&
-	!strstr (deb_build_options, "gcc-ice=nodump");
+      const bool gcc_dump = has_deb_build_options ("gcc-ice=nodump");
       const bool gcc_apport = !env.get ("GCC_NOAPPORT") &&
 	!access ("/usr/share/apport/gcc_ice_hook", R_OK | X_OK);
 
-- 
2.39.2

From a2fa3b638c3e1acd58b16eb7079d8402e9dec958 Mon Sep 17 00:00:00 2001
From: Gwenole Beauchesne <gb.devel@gmail.com>
Date: Fri, 1 Dec 2023 22:01:48 +0100
Subject: [PATCH 1/2] gcc: no GCC dump if DEB_BUILD_OPTIONS contains
 gcc-ice=nodump.

Don't output GCC dump if the DEB_BUILD_OPTIONS environment variable
contains gcc-ice=nodump. This allows for the testsuite to run XFAIL
tests gracefully for dg-ice.

FAIL: c-c++-common/goacc/kernels-decompose-pr100400-1-3.c  -std=c++14 (test for excess errors)
FAIL: c-c++-common/goacc/kernels-decompose-pr100400-1-3.c  -std=c++17 (test for excess errors)
FAIL: c-c++-common/goacc/kernels-decompose-pr100400-1-3.c  -std=c++20 (test for excess errors)
FAIL: c-c++-common/goacc/kernels-decompose-pr100400-1-3.c  -std=c++98 (test for excess errors)
FAIL: c-c++-common/goacc/kernels-decompose-pr100400-1-4.c  -std=c++14 (test for excess errors)
FAIL: c-c++-common/goacc/kernels-decompose-pr100400-1-4.c  -std=c++17 (test for excess errors)
FAIL: c-c++-common/goacc/kernels-decompose-pr100400-1-4.c  -std=c++20 (test for excess errors)
FAIL: c-c++-common/goacc/kernels-decompose-pr100400-1-4.c  -std=c++98 (test for excess errors)
FAIL: g++.dg/cpp0x/vt-88982.C  -std=c++14 (test for excess errors)
FAIL: g++.dg/cpp0x/vt-88982.C  -std=c++17 (test for excess errors)
FAIL: g++.dg/cpp0x/vt-88982.C  -std=c++20 (test for excess errors)
FAIL: g++.dg/cpp1y/auto-fn61.C  -std=c++14 (test for excess errors)
FAIL: g++.dg/cpp1y/auto-fn61.C  -std=c++17 (test for excess errors)
FAIL: g++.dg/cpp1y/auto-fn61.C  -std=c++20 (test for excess errors)

Signed-off-by: Gwenole Beauchesne <gb.devel@gmail.com>
---
 gcc/gcc.cc | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index 4345a7ec3d6..28164c83c8f 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -7896,10 +7896,15 @@ do_report_bug (const char **new_argv, const int nargs,
   if (status == ATTEMPT_STATUS_SUCCESS)
     {
       const char *deb_build_options = env.get("DEB_BUILD_OPTIONS");
+      const bool gcc_dump = deb_build_options &&
+	!strstr (deb_build_options, "gcc-ice=nodump");
+      const bool gcc_apport = !env.get ("GCC_NOAPPORT") &&
+	!access ("/usr/share/apport/gcc_ice_hook", R_OK | X_OK);
 
-      fnotice (stderr, "Preprocessed source stored into %s file,"
+      if (gcc_dump || gcc_apport)
+	fnotice (stderr, "Preprocessed source stored into %s file,"
 	       " please attach this to your bugreport.\n", *out_file);
-      if (deb_build_options)
+      if (gcc_dump)
 	{
 	  char *cmd = XNEWVEC (char, 50 + strlen (*out_file));
 
@@ -7912,8 +7917,7 @@ do_report_bug (const char **new_argv, const int nargs,
 	  fflush(stderr);
 	  free(cmd);
 	}
-      if (!env.get ("GCC_NOAPPORT")
-	  && !access ("/usr/share/apport/gcc_ice_hook", R_OK | X_OK))
+      if (gcc_apport)
 	{
 	  char *cmd = XNEWVEC (char, 50 + strlen (*out_file)
 			       + strlen (new_argv[0]));
-- 
2.39.2


Reply to: