aboutsummaryrefslogtreecommitdiff
path: root/gcc/m2
diff options
context:
space:
mode:
authorGaius Mulley <gaiusmod2@gmail.com>2024-04-22 20:34:11 +0100
committerGaius Mulley <gaiusmod2@gmail.com>2024-04-22 20:34:11 +0100
commitb909daa5b67317e46543a7b2ed76e82298645cf6 (patch)
tree3afe1bcf3f85d1b4294236e30519389809e93b3d /gcc/m2
parent7ef139146a8923a8719873ca3fdae175668e8d63 (diff)
downloadgcc-b909daa5b67317e46543a7b2ed76e82298645cf6.zip
gcc-b909daa5b67317e46543a7b2ed76e82298645cf6.tar.gz
gcc-b909daa5b67317e46543a7b2ed76e82298645cf6.tar.bz2
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>
Diffstat (limited to 'gcc/m2')
-rw-r--r--gcc/m2/gm2-compiler/M2GenGCC.mod43
1 files changed, 23 insertions, 20 deletions
diff --git a/gcc/m2/gm2-compiler/M2GenGCC.mod b/gcc/m2/gm2-compiler/M2GenGCC.mod
index da52c92..26ed399 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