public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Thomas Schwinge <thomas@codesourcery.com>
To: David Malcolm <dmalcolm@redhat.com>, <gcc-patches@gcc.gnu.org>
Subject: Re: testsuite: Be more informative for ICEs
Date: Wed, 15 Dec 2021 23:55:13 +0100	[thread overview]
Message-ID: <87ilvptr5a.fsf@dirichlet.schwinge.homeip.net> (raw)
In-Reply-To: <fdd43e34a4a9c8e363328ae522407f9c52a7702e.camel@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 2337 bytes --]

Hi!

On 2021-12-13T14:12:26-0500, David Malcolm <dmalcolm@redhat.com> wrote:
> On Mon, 2021-12-13 at 10:53 -0700, Martin Sebor via Gcc-patches wrote:
>> On 12/10/21 3:42 PM, Thomas Schwinge wrote:
>> > OK to push the attached "testsuite: Be more informative for ICEs"?
>>
>> Adding more detail here seems like a useful improvement to me.
>
> Agreed.

Thanks, and given Jeff's approval, now pushed to master branch in
commit 45b768cb80930c0beeb735727349c44ec66f7dd2
"testsuite: Be more informative for ICEs", see attached.

> I don't think I can formally approve this patch, but it looks
> like a big improvement to me, too.

Well, for some meaning of "big improvement" anyway...  ;-) But yes,
certainly useful when you've (that is: I've) been comparing for a while
DejaGnu '*.sum' files before/after a source code change, wondering why
ICEs don't go away and only eventually realized that ICEs indeed do go
away -- but just to be replaced with other ICEs.  That's now becoming
obvious.

> Does it identify assertion failures, BTW?

Some of the examples I have in the commit log actually are that, for
example, for 'gcc/cp/constexpr.c':

    6954            gcc_checking_assert (ctx->quiet || errorcount);

... we get:

    [...]/source-gcc/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda26.C: In lambda function:
    [...]/source-gcc/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda26.C:14:35: internal compiler error: in cxx_eval_constant_expression, at cp/constexpr.c:6954
    0x675604 cxx_eval_constant_expression
            [...]/source-gcc/gcc/cp/constexpr.c:6954
    0xdfcfb5 cxx_eval_call_expression
            [...]/source-gcc/gcc/cp/constexpr.c:2398
    [...]

..., and my simple patch just captures the
'internal compiler error: [...]' part and uses it as follows:

    -XFAIL: g++.dg/cpp1z/constexpr-lambda26.C  -std=c++17 (internal compiler error)
    +XFAIL: g++.dg/cpp1z/constexpr-lambda26.C  -std=c++17 (internal compiler error: in cxx_eval_constant_expression, at cp/constexpr.c:6954)


Grüße
 Thomas


-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-testsuite-Be-more-informative-for-ICEs.patch --]
[-- Type: text/x-diff, Size: 5380 bytes --]

From 45b768cb80930c0beeb735727349c44ec66f7dd2 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Fri, 10 Dec 2021 19:08:26 +0100
Subject: [PATCH] testsuite: Be more informative for ICEs

For example, for the two (FAIL, XFAIL)
'gcc/testsuite/lib/gcc-dg.exp:gcc-dg-test-1' cases:

    -FAIL: g++.dg/modules/xtreme-header-3_a.H -std=c++17 (internal compiler error)
    +FAIL: g++.dg/modules/xtreme-header-3_a.H -std=c++17 (internal compiler error: tree check: expected var_decl or function_decl or field_decl or type_decl or concept_decl or template_decl, have namespace_decl in get_merge_kind, at cp/module.cc:10072)

    -FAIL: gfortran.dg/gomp/clauses-1.f90   -O  (internal compiler error)
    +FAIL: gfortran.dg/gomp/clauses-1.f90   -O  (internal compiler error: Segmentation fault)

    -XFAIL: c-c++-common/goacc/kernels-decompose-ice-1.c (internal compiler error)
    +XFAIL: c-c++-common/goacc/kernels-decompose-ice-1.c (internal compiler error: in lower_omp_target, at omp-low.c:13147)

    -XFAIL: g++.dg/cpp1z/constexpr-lambda26.C  -std=c++17 (internal compiler error)
    +XFAIL: g++.dg/cpp1z/constexpr-lambda26.C  -std=c++17 (internal compiler error: in cxx_eval_constant_expression, at cp/constexpr.c:6954)

That allows for more easily spotting when during development you're trading one
ICE for another.

	gcc/testsuite/
	* lib/fortran-torture.exp (fortran-torture-compile)
	(fortran-torture-execute): Be more informative for ICEs.
	* lib/gcc-defs.exp (${tool}_check_compile): Likewise.
	* lib/gcc-dg.exp (gcc-dg-test-1): Likewise.
	* lib/go-torture.exp (go-torture-compile, go-torture-execute):
	Likewise.
---
 gcc/testsuite/lib/fortran-torture.exp | 8 ++++----
 gcc/testsuite/lib/gcc-defs.exp        | 4 ++--
 gcc/testsuite/lib/gcc-dg.exp          | 6 +++---
 gcc/testsuite/lib/go-torture.exp      | 8 ++++----
 4 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/gcc/testsuite/lib/fortran-torture.exp b/gcc/testsuite/lib/fortran-torture.exp
index d6759aa0b4b..11d73d9f1f7 100644
--- a/gcc/testsuite/lib/fortran-torture.exp
+++ b/gcc/testsuite/lib/fortran-torture.exp
@@ -138,8 +138,8 @@ proc fortran-torture-compile { src option } {
 	return
     }
 
-    if [string match "*internal compiler error*" $comp_output] then {
-	gfortran_fail $testcase "$option (internal compiler error)"
+    if [regexp -line -- "internal compiler error.*" $comp_output ice] then {
+	gfortran_fail $testcase "$option ($ice)"
 	catch { remote_file build delete $output }
 	return
     }
@@ -263,8 +263,8 @@ proc fortran-torture-execute { src } {
 	    continue
 	}
 
-	if [string match "*internal compiler error*" $comp_output] then {
-	    gfortran_fail $testcase "$option (internal compiler error)"
+	if [regexp -line -- "internal compiler error.*" $comp_output ice] then {
+	    gfortran_fail $testcase "$option ($ice)"
 	    catch { remote_file build delete $executable }
 	    continue
 	}
diff --git a/gcc/testsuite/lib/gcc-defs.exp b/gcc/testsuite/lib/gcc-defs.exp
index d17308d0f86..66df4e1c6aa 100644
--- a/gcc/testsuite/lib/gcc-defs.exp
+++ b/gcc/testsuite/lib/gcc-defs.exp
@@ -38,8 +38,8 @@ proc ${tool}_check_compile {testcase option objname gcc_output} {
 	return 0
     }
 
-    if [string match "*internal compiler error*" $gcc_output] then {
-	${tool}_fail $testcase "$option (internal compiler error)"
+    if [regexp -line -- "internal compiler error.*" $gcc_output ice] then {
+	${tool}_fail $testcase "$option ($ice)"
 	return 0
     }
 
diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp
index 78a6c3651ef..464059608b8 100644
--- a/gcc/testsuite/lib/gcc-dg.exp
+++ b/gcc/testsuite/lib/gcc-dg.exp
@@ -315,13 +315,13 @@ proc gcc-dg-test-1 { target_compile prog do_what extra_tool_flags } {
     # to avoid a second failure for excess errors.
     # "Error reporting routines re-entered" ICE says "Internal" rather than
     # "internal", so match that too.
-    if [string match {*[Ii]nternal compiler error*} $comp_output] {
+    if [regexp -line -- {[Ii]nternal compiler error.*} $comp_output ice] {
 	upvar 2 name name
 	if { $expect_ice == 0 } {
-	  fail "$name (internal compiler error)"
+	  fail "$name ($ice)"
 	} else {
 	  # We expected an ICE and we got it.
-	  xfail "$name (internal compiler error)"
+	  xfail "$name ($ice)"
 	  # Prune the ICE from the output.
 	  set comp_output [prune_ices $comp_output]
 	}
diff --git a/gcc/testsuite/lib/go-torture.exp b/gcc/testsuite/lib/go-torture.exp
index 28247a1902d..adeae36f916 100644
--- a/gcc/testsuite/lib/go-torture.exp
+++ b/gcc/testsuite/lib/go-torture.exp
@@ -88,8 +88,8 @@ proc go-torture-compile { src option } {
 	return
     }
 
-    if [string match "*internal compiler error*" $comp_output] then {
-	go_fail $testcase "$option (internal compiler error)"
+    if [regexp -line -- "internal compiler error.*" $comp_output ice] then {
+	go_fail $testcase "$option ($ice)"
 	catch { remote_file build delete $output }
 	return
     }
@@ -224,8 +224,8 @@ proc go-torture-execute { src } {
 	    continue
 	}
 
-	if [string match "*internal compiler error*" $comp_output] then {
-	    go_fail $testcase "$option (internal compiler error)"
+	if [regexp -line -- "internal compiler error.*" $comp_output ice] then {
+	    go_fail $testcase "$option ($ice)"
 	    catch { remote_file build delete $executable }
 	    continue
 	}
-- 
2.33.0


  reply	other threads:[~2021-12-15 22:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-10 22:42 Thomas Schwinge
2021-12-13 17:53 ` Martin Sebor
2021-12-13 19:12   ` David Malcolm
2021-12-15 22:55     ` Thomas Schwinge [this message]
2021-12-14 22:58 ` Jeff Law

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ilvptr5a.fsf@dirichlet.schwinge.homeip.net \
    --to=thomas@codesourcery.com \
    --cc=dmalcolm@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).