-
- Downloads
PR modula2/113730 Unexpected handling of mixed-precision integer arithmetic
This patch fixes a bug which occurs when an expression is created with
a ZType and an integer or cardinal. The resulting subexpression is
incorrecly given a ZType which allows compatibility with another
integer/cardinal type. The solution was to fix the subexpression
type. In turn this required a minor change to SArgs.mod.
gcc/m2/ChangeLog:
PR modula2/113730
* gm2-compiler/M2Base.mod (IsUserType): New procedure function.
(MixTypes): Use IsUserType instead of IsType before calling MixTypes.
* gm2-compiler/M2GenGCC.mod (GetTypeMode): Remove and import from
SymbolTable.
(CodeBinaryCheck): Replace call to MixTypes with MixTypesBinary.
(CodeBinary): Replace call to MixTypes with MixTypesBinary.
(CodeIfLess): Replace MixTypes with ComparisonMixTypes.
(CodeIfGre): Replace MixTypes with ComparisonMixTypes.
(CodeIfLessEqu): Replace MixTypes with ComparisonMixTypes.
(CodeIfGreEqu): Replace MixTypes with ComparisonMixTypes.
(CodeIfEqu): Replace MixTypes with ComparisonMixTypes.
(CodeIfNotEqu): Replace MixTypes with ComparisonMixTypes.
(ComparisonMixTypes): New procedure function.
* gm2-compiler/M2Quads.mod (BuildEndFor): Replace GenQuadO
with GenQuadOtok and pass tokenpos for the operands to the AddOp
and XIndrOp.
(CheckRangeIncDec): Check etype against NulSym and dtype for a
pointer and set etype to Address.
(BuildAddAdrFunction): New variable opa. Convert operand to an
address and save result in opa. Replace GenQuad with GenQuadOtok.
(BuildSubAdrFunction): New variable opa. Convert operand to an
address and save result in opa. Replace GenQuad with GenQuadOtok.
(BuildDiffAdrFunction): New variable opa. Convert operand to an
address and save result in opa. Replace GenQuad with GenQuadOtok.
(calculateMultipicand): Replace GenQuadO with GenQuadOtok.
(ConvertToAddress): New procedure function.
(BuildDynamicArray): Convert index to address before adding to
the base.
* gm2-compiler/SymbolTable.def (GetTypeMode): New procedure function.
* gm2-compiler/SymbolTable.mod (GetTypeMode): New procedure
function implemented (moved from M2GenGCC.mod).
* gm2-libs/SArgs.mod (GetArg): Replace cast to PtrToChar with ADDRESS.
gcc/testsuite/ChangeLog:
PR modula2/113730
* gm2/extensions/fail/arith1.mod: New test.
* gm2/extensions/fail/arith2.mod: New test.
* gm2/extensions/fail/arith3.mod: New test.
* gm2/extensions/fail/arith4.mod: New test.
* gm2/extensions/fail/arithpromote.mod: New test.
* gm2/extensions/fail/extensions-fail.exp: New test.
* gm2/linking/fail/badimp.def: New test.
* gm2/linking/fail/badimp.mod: New test.
* gm2/linking/fail/linking-fail.exp: New test.
* gm2/linking/fail/testbadimp.mod: New test.
Signed-off-by:
Gaius Mulley <gaiusmod2@gmail.com>
Showing
- gcc/m2/gm2-compiler/M2Base.mod 15 additions, 4 deletionsgcc/m2/gm2-compiler/M2Base.mod
- gcc/m2/gm2-compiler/M2GenGCC.mod 56 additions, 36 deletionsgcc/m2/gm2-compiler/M2GenGCC.mod
- gcc/m2/gm2-compiler/M2Quads.mod 61 additions, 11 deletionsgcc/m2/gm2-compiler/M2Quads.mod
- gcc/m2/gm2-compiler/SymbolTable.def 9 additions, 1 deletiongcc/m2/gm2-compiler/SymbolTable.def
- gcc/m2/gm2-compiler/SymbolTable.mod 30 additions, 0 deletionsgcc/m2/gm2-compiler/SymbolTable.mod
- gcc/m2/gm2-libs/SArgs.mod 1 addition, 3 deletionsgcc/m2/gm2-libs/SArgs.mod
- gcc/testsuite/gm2/extensions/fail/arith1.mod 36 additions, 0 deletionsgcc/testsuite/gm2/extensions/fail/arith1.mod
- gcc/testsuite/gm2/extensions/fail/arith2.mod 36 additions, 0 deletionsgcc/testsuite/gm2/extensions/fail/arith2.mod
- gcc/testsuite/gm2/extensions/fail/arith3.mod 36 additions, 0 deletionsgcc/testsuite/gm2/extensions/fail/arith3.mod
- gcc/testsuite/gm2/extensions/fail/arith4.mod 36 additions, 0 deletionsgcc/testsuite/gm2/extensions/fail/arith4.mod
- gcc/testsuite/gm2/extensions/fail/arithpromote.mod 55 additions, 0 deletionsgcc/testsuite/gm2/extensions/fail/arithpromote.mod
- gcc/testsuite/gm2/extensions/fail/extensions-fail.exp 36 additions, 0 deletionsgcc/testsuite/gm2/extensions/fail/extensions-fail.exp
- gcc/testsuite/gm2/linking/fail/badimp.def 4 additions, 0 deletionsgcc/testsuite/gm2/linking/fail/badimp.def
- gcc/testsuite/gm2/linking/fail/badimp.mod 8 additions, 0 deletionsgcc/testsuite/gm2/linking/fail/badimp.mod
- gcc/testsuite/gm2/linking/fail/linking-fail.exp 38 additions, 0 deletionsgcc/testsuite/gm2/linking/fail/linking-fail.exp
- gcc/testsuite/gm2/linking/fail/testbadimp.mod 6 additions, 0 deletionsgcc/testsuite/gm2/linking/fail/testbadimp.mod
Loading
Please register or sign in to comment