public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Gaius Mulley <gaius@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r14-10080] PR modula2/114811 string set incl ICE bugfix
Date: Mon, 22 Apr 2024 19:34:46 +0000 (GMT)	[thread overview]
Message-ID: <20240422193446.75825384AB74@sourceware.org> (raw)

https://gcc.gnu.org/g:b909daa5b67317e46543a7b2ed76e82298645cf6

commit r14-10080-gb909daa5b67317e46543a7b2ed76e82298645cf6
Author: Gaius Mulley <gaiusmod2@gmail.com>
Date:   Mon Apr 22 20:34:11 2024 +0100

    PR modula2/114811 string set incl ICE bugfix
    
    This patch corrects gm2-torture.exp to recognize an ICE
    in the fail case as a negative result.  The patch also fixes
    FoldBinarySet so that the types are only checked once the operands
    have been resolved.  Without this patch
    gcc/testsuite/gm2/iso/fail/badexpression2.mod would cause an ICE.
    
    gcc/m2/ChangeLog:
    
            PR modula2/114811
            * gm2-compiler/M2GenGCC.mod (FoldBinarySet): Add condition
            checking to ensure op2 and op3 are fully resolved before
            type checking is performed.
    
    gcc/testsuite/ChangeLog:
    
            PR modula2/114811
            * lib/gm2-torture.exp: Correct regexp checking for internal
            compiler error strings in compiler output.
    
    Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>

Diff:
---
 gcc/m2/gm2-compiler/M2GenGCC.mod  | 43 +++++++++++++++++++++------------------
 gcc/testsuite/lib/gm2-torture.exp |  7 ++++---
 2 files changed, 27 insertions(+), 23 deletions(-)

diff --git a/gcc/m2/gm2-compiler/M2GenGCC.mod b/gcc/m2/gm2-compiler/M2GenGCC.mod
index da52c924974..26ed399b24c 100644
--- a/gcc/m2/gm2-compiler/M2GenGCC.mod
+++ b/gcc/m2/gm2-compiler/M2GenGCC.mod
@@ -5000,29 +5000,32 @@ BEGIN
    TryDeclareConstant(tokenno, op3) ;
    location := TokenToLocation(tokenno) ;
 
-   IF CheckBinaryExpressionTypes (quad, p)
+   IF GccKnowsAbout(op2) AND GccKnowsAbout(op3)
    THEN
-      IF IsConst(op2) AND IsConstSet(op2) AND
-         IsConst(op3) AND IsConstSet(op3) AND
-         IsConst(op1)
+      IF CheckBinaryExpressionTypes (quad, p)
       THEN
-         IF IsValueSolved(op2) AND IsValueSolved(op3)
+         IF IsConst(op2) AND IsConstSet(op2) AND
+            IsConst(op3) AND IsConstSet(op3) AND
+            IsConst(op1)
          THEN
-            Assert(MixTypes(FindType(op3), FindType(op2), tokenno)#NulSym) ;
-            PutConst(op1, MixTypes(FindType(op3), FindType(op2), tokenno)) ;
-            PushValue(op2) ;
-            PushValue(op3) ;
-            op(tokenno) ;
-            PopValue(op1) ;
-            PushValue(op1) ;
-            PutConstSet(op1) ;
-            AddModGcc(op1,
-                      DeclareKnownConstant(location,
-                                           Mod2Gcc(GetType(op3)),
-                                           PopSetTree(tokenno))) ;
-            p(op1) ;
-            NoChange := FALSE ;
-            SubQuad(quad)
+            IF IsValueSolved(op2) AND IsValueSolved(op3)
+            THEN
+               Assert(MixTypes(FindType(op3), FindType(op2), tokenno)#NulSym) ;
+               PutConst(op1, MixTypes(FindType(op3), FindType(op2), tokenno)) ;
+               PushValue(op2) ;
+               PushValue(op3) ;
+               op(tokenno) ;
+               PopValue(op1) ;
+               PushValue(op1) ;
+               PutConstSet(op1) ;
+               AddModGcc(op1,
+                         DeclareKnownConstant(location,
+                                              Mod2Gcc(GetType(op3)),
+                                              PopSetTree(tokenno))) ;
+               p(op1) ;
+               NoChange := FALSE ;
+               SubQuad(quad)
+            END
          END
       END
    END
diff --git a/gcc/testsuite/lib/gm2-torture.exp b/gcc/testsuite/lib/gm2-torture.exp
index 090929954ca..c29b0b4d1a0 100644
--- a/gcc/testsuite/lib/gm2-torture.exp
+++ b/gcc/testsuite/lib/gm2-torture.exp
@@ -138,7 +138,7 @@ proc gm2-torture-compile { src option } {
 
 proc gm2_check_compile_fail {testcase option objname gcc_output} {
     global tool;
-    set fatal_signal "*cc: Internal compiler error: program*got fatal signal"
+    set fatal_signal "*nternal compiler error: program*got fatal signal"
 
     if [string match "$fatal_signal 6" $gcc_output] then {
 	${tool}_fail $testcase "Got Signal 6, $option"
@@ -170,8 +170,9 @@ proc gm2_check_compile_fail {testcase option objname gcc_output} {
     regsub -all -- "\[\r\n\]*" $gcc_output "" gcc_output
 
     # check for any internal error
-    if { [string match "internal error" $gcc_output] ||
-	 [string match "internal compiler error" $gcc_output] } then {
+    if { [string match "*internal error*" $gcc_output] ||
+	 [string match "*internal compiler error*" $gcc_output] } then {
+	puts stderr "ICE: "
 	${tool}_fail $testcase $option
 	return 0
     }

                 reply	other threads:[~2024-04-22 19:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20240422193446.75825384AB74@sourceware.org \
    --to=gaius@gcc.gnu.org \
    --cc=gcc-cvs@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).