aboutsummaryrefslogtreecommitdiff
path: root/gcc/m2
AgeCommit message (Collapse)AuthorFilesLines
2025-07-02Daily bump.GCC Administrator1-0/+6
2025-07-01PR modula2/120912: Request for a procedure to obtain a file from an IOChanGaius Mulley2-1/+19
This patch introduces the procedure GetFile into the supplementary ISO style library IOChanUtils. gcc/m2/ChangeLog: PR modula2/120912 * gm2-libs-iso/IOChanUtils.def (GetFile): New procedure function. * gm2-libs-iso/IOChanUtils.mod (GetFile): New procedure function. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2025-06-30Daily bump.GCC Administrator1-0/+14
2025-06-30[PR modula2/117203] Followup add Delete procedure functionGaius Mulley6-13/+120
This patch provides GetFileName procedure function for FIO.File, FileSystem.File and IOChan.ChanId. The return result from these procedures can be passed into StringFileSysOp.Unlink to complete the required delete. gcc/m2/ChangeLog: PR modula2/117203 * gm2-libs-log/FileSystem.def (GetFileName): New procedure function. (WriteString): New procedure. * gm2-libs-log/FileSystem.mod (GetFileName): New procedure function. (WriteString): New procedure. * gm2-libs/SFIO.def (GetFileName): New procedure function. * gm2-libs/SFIO.mod (GetFileName): New procedure function. * gm2-libs-iso/IOChanUtils.def: New file. * gm2-libs-iso/IOChanUtils.mod: New file. libgm2/ChangeLog: PR modula2/117203 * libm2iso/Makefile.am (M2DEFS): Add IOChanUtils.def. (M2MODS): Add IOChanUtils.mod. * libm2iso/Makefile.in: Regenerate. gcc/testsuite/ChangeLog: PR modula2/117203 * gm2/isolib/run/pass/testdelete2.mod: New test. * gm2/pimlib/logitech/run/pass/testdelete2.mod: New test. * gm2/pimlib/run/pass/testdelete.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2025-06-23Daily bump.GCC Administrator1-0/+7
2025-06-22[PR modula2/120731] error in Strings.Pos causing sigsegvGaius Mulley2-28/+53
This patch corrects the m2log library procedure function Strings.Pos which incorrectly sliced the wrong component of the source string. The incorrect slice could cause a sigsegv if negative slice indices were generated. gcc/m2/ChangeLog: PR modula2/120731 * gm2-libs-log/Strings.def (Delete): Rewrite comment. * gm2-libs-log/Strings.mod (Pos): Rewrite. (PosLower): New procedure function. gcc/testsuite/ChangeLog: PR modula2/120731 * gm2/pimlib/logitech/run/pass/teststrings.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2025-06-22Daily bump.GCC Administrator1-0/+6
2025-06-21[modula2] Comment tidyup in gm2-compiler/M2GCCDeclare.modGaius Mulley1-10/+6
This patch reformats three comments in the GNU GCC style. gcc/m2/ChangeLog: * gm2-compiler/M2GCCDeclare.mod (StartDeclareModuleScopeSeparate): Reformat statement comments. (StartDeclareModuleScopeWholeProgram): Ditto. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2025-06-18Daily bump.GCC Administrator1-0/+22
2025-06-17PR modula2/120673: Mutually dependent types crash the compilerGaius Mulley3-64/+98
This patch fixes an ICE which will occur if cyclic dependent types are used when declaring a variable. This patch detects the cyclic dependency and issues an error message for each outstanding component. gcc/m2/ChangeLog: PR modula2/120673 * gm2-compiler/M2GCCDeclare.mod (ErrorDepList): New global variable set containing every errant dependency symbol. (mystop): Remove. (EmitCircularDependancyError): Replace with ... (EmitCircularDependencyError): ... this. (AssertAllTypesDeclared): Rewrite. (DoVariableDeclaration): Ditto. (TypeDependentsDeclared): New procedure function. (PrepareGCCVarDeclaration): Ditto. (DeclareVariable): Remove assert. (DeclareLocalVariable): Ditto. (Constructor): Initialize ErrorDepList. * gm2-compiler/M2MetaError.mod (doErrorScopeProc): Rewrite and ensure that a symbol with a module scope does not lookup from a definition module. * gm2-compiler/P2SymBuild.mod (BuildType): Rewrite so that a synonym type is created using the token refering to the name on the lhs. gcc/testsuite/ChangeLog: PR modula2/120673 * gm2/pim/fail/badmodvar.mod: New test. * gm2/pim/fail/cyclictypes.mod: New test. * gm2/pim/fail/cyclictypes2.mod: New test. * gm2/pim/fail/cyclictypes4.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2025-06-12Daily bump.GCC Administrator1-0/+10
2025-06-12PR modula2/119650: Regenerate target independent documentationGaius Mulley5-29/+363
This patch regenerates the target independent documentation triggered by the additional library modules. gcc/m2/ChangeLog: PR modula2/119650 * gm2-libs/ARRAYOFCHAR.def: Remove comment about non existent read. * target-independent/m2/Builtins.texi: Regenerate. * target-independent/m2/SYSTEM-iso.texi: Ditto. * target-independent/m2/SYSTEM-pim.texi: Ditto. * target-independent/m2/gm2-libs.texi: Ditto. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2025-06-10Daily bump.GCC Administrator1-0/+6
2025-06-09PR modula2/120606: FOR loop ICE if the last expression uses an arrayGaius Mulley1-0/+2
This patch fixes the ICE which occurs if the last expression is an array. It ensures that the start and end values of the for loop expressions are dereferenced. gcc/m2/ChangeLog: PR modula2/120606 * gm2-compiler/M2Quads.mod (ForLoopLastIterator): Dereference start and end expressions e1 and e2 respectively. gcc/testsuite/ChangeLog: PR modula2/120606 * gm2/pim/pass/forarray.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2025-06-08Daily bump.GCC Administrator1-0/+28
2025-06-07[PR modula2/119650, PR modula2/117203]: WriteString and Delete are missing ↵Gaius Mulley15-105/+828
from base libraries This patch introduces a Write procedure for an array of char, the string and char datatype. It uses the m2r10 style of naming the module on the datatype. This uncovered a bug in the import handling inside Quadident. It also includes an Unlink procedure from a new module FileSysOp and a String interface to this module. gcc/m2/ChangeLog: PR modula2/119650 PR modula2/117203 * gm2-compiler/P2Build.bnf (CheckModuleQualident): New procedure. (Qualident): Rewrite. * gm2-compiler/P3Build.bnf (PushTFQualident): New procedure. (CheckModuleQualident): Ditto. (Qualident): Rewrite. * gm2-compiler/PCBuild.bnf (PushTFQualident): New procedure. (CheckModuleQualident): Ditto. (Qualident): Rewrite. * gm2-compiler/PHBuild.bnf (PushTFQualident): New procedure. (CheckModuleQualident): Ditto. (Qualident): Rewrite. * gm2-libs/ARRAYOFCHAR.def: New file. * gm2-libs/ARRAYOFCHAR.mod: New file. * gm2-libs/CFileSysOp.def: New file. * gm2-libs/CHAR.def: New file. * gm2-libs/CHAR.mod: New file. * gm2-libs/FileSysOp.def: New file. * gm2-libs/FileSysOp.mod: New file. * gm2-libs/String.def: New file. * gm2-libs/String.mod: New file. * gm2-libs/StringFileSysOp.def: New file. * gm2-libs/StringFileSysOp.mod: New file. libgm2/ChangeLog: PR modula2/119650 PR modula2/117203 * libm2pim/Makefile.am (M2MODS): Add ARRAYOFCHAR, CHAR.mod, StringFileSysOp.mod and String.mod. (M2DEFS): Add ARRAYOFCHAR, CHAR.mod, StringFileSysOp.mod and String.mod. (libm2pim_la_SOURCES): Add CFileSysOp.c. * libm2pim/Makefile.in: Regenerate. * libm2pim/CFileSysOp.cc: New file. gcc/testsuite/ChangeLog: PR modula2/119650 * gm2/iso/fail/CHAR.mod: New test. * gm2/iso/run/pass/CHAR.mod: New test. * gm2/iso/run/pass/importself.mod: New test. * gm2/pimlib/run/pass/testwrite.mod: New test. * gm2/pimlib/run/pass/testwritechar.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2025-06-07Daily bump.GCC Administrator1-0/+9
2025-06-06PR modula2/120542: Return statement in the main procedure crashes the compilerGaius Mulley1-20/+40
The patch checks whether a return statement is allowed. It also checks to see that a return expression is allowed. gcc/m2/ChangeLog: PR modula2/120542 * gm2-compiler/M2Quads.mod (BuildReturnLower): New procedure. (BuildReturn): Allow return without an expression from module initialization blocks. Generate an error if an expression is provided. Call BuildReturnLower if no error was seen. gcc/testsuite/ChangeLog: PR modula2/120542 * gm2/iso/fail/badreturn.mod: New test. * gm2/iso/fail/badreturn2.mod: New test. * gm2/iso/pass/modulereturn.mod: New test. * gm2/iso/pass/modulereturn2.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2025-06-02Daily bump.GCC Administrator1-0/+5
2025-06-01PR modula2/120474: InOut buffering should flush the WriteLn before the ReadGaius Mulley1-10/+2
This patch adds a BufferFlush to InOut.mod:LocalWrite. gcc/m2/ChangeLog: PR modula2/120474 * gm2-libs-log/InOut.mod (LocalWrite): Call FIO.FlushBuffer. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2025-06-01Daily bump.GCC Administrator1-0/+97
2025-06-01PR modula2/120497: error is generated for good code when returning a pointer ↵Gaius Mulley1-18/+46
var variable The return type checking needs to skip over the Lvalue part of the VAR parameter or variable. gcc/m2/ChangeLog: PR modula2/120497 * gm2-compiler/M2Range.mod (IsAssignmentCompatible): Remove from import list. (FoldTypeReturnFunc): Rewrite to skip the Lvalue of a var variable. (CodeTypeReturnFunc): Ditto. (CodeTypeIndrX): Call AssignmentTypeCompatible rather than IsAssignmentCompatible. (FoldTypeIndrX): Ditto. gcc/testsuite/ChangeLog: PR modula2/120497 * gm2/pim/pass/ReturnType.mod: New test. * gm2/pim/pass/ReturnType2.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2025-05-31PR modula2/120389 Assigning wrong type to an array causes an ICEGaius Mulley12-281/+792
This patch provides follow on fixes for undetected type violations which can occur then Lvalues are generated during assignment. For example array accesses and with statements. The type checker M2Check.mod has been overhauled and cleaned up. gcc/ChangeLog: PR modula2/120389 * doc/gm2.texi (-fm2-strict-type-reason): Document new flag. gcc/m2/ChangeLog: PR modula2/120389 * gm2-compiler/M2Check.def (AssignmentTypeCompatible): Add new parameter enableReason. * gm2-compiler/M2Check.mod (EquivalenceProcedure): New type. (falseReason2): New procedure function. (falseReason1): Ditto. (falseReason0): Ditto. (checkTypeEquivalence): Rewrite. (checkUnboundedArray): Ditto. (checkUnbounded): Ditto. (checkArrayTypeEquivalence): Ditto. (checkCharStringTypeEquivalence): Ditto. (buildError4): Add false reason. (buildError2): Ditto. (IsTyped): Use GetDType. (IsTypeEquivalence): New procedure function. (checkVarTypeEquivalence): Ditto. (checkVarEquivalence ): Rewrite. (checkConstMeta): Ditto. (checkEnumField): New procedure function. (checkEnumFieldEquivalence): Ditto. (checkSubrangeTypeEquivalence): Rewrite. (checkSystemEquivalence): Ditto. (checkTypeKindViolation): Ditto. (doCheckPair): Ditto. (InitEquivalenceArray): New procedure. (addEquivalence): Ditto. (checkProcType): Rewrite. (deconstruct): Deallocate reason string. (AssignmentTypeCompatible): Initialize reason and reasonEnable fields. (ParameterTypeCompatible): Ditto. (doExpressionTypeCompatible): Ditto. * gm2-compiler/M2GenGCC.mod (CodeIndrX) Rewrite. (CheckBinaryExpressionTypes): Rewrite and simplify now that the type checker is more robust. (CheckElementSetTypes): Ditto. (CodeXIndr): Add new range assignment type check. * gm2-compiler/M2MetaError.def: Correct comments. * gm2-compiler/M2Options.def (SetStrictTypeAssignment): New procedure. (SetStrictTypeReason): Ditto. * gm2-compiler/M2Options.mod: (SetStrictTypeAssignment): New procedure. (SetStrictTypeReason): Ditto. (StrictTypeReason): Initialize. (StrictTypeAssignment): Ditto. * gm2-compiler/M2Quads.mod (CheckBreak): Delete. (BreakQuad): New global variable. (BreakAtQuad): Delete. (gdbhook): New procedure. (BreakWhenQuadCreated): Ditto. (CheckBreak): Ditto. (Init): Call BreakWhenQuadCreated and gdbhook. (doBuildAssignment): Add type assignment range check. (CheckProcTypeAndProcedure): Only check if the procedure types differ. (doIndrX): Add type IndrX range check. (CheckReturnType): Add range return type check. * gm2-compiler/M2Range.def (InitTypesIndrXCheck): New procedure function. (InitTypesReturnTypeCheck): Ditto. * gm2-compiler/M2Range.mod (InitTypesIndrXCheck): New procedure function. (InitTypesReturnTypeCheck): Ditto. (HandlerExists): Add new clauses. (FoldAssignment): Pass extra FALSE parameter to AssignmentTypeCompatible. (FoldTypeReturnFunc): New procedure. (FoldTypeAssign): Ditto. (FoldTypeIndrX): Ditto. (CodeTypeAssign): Rewrite. (CodeTypeIndrX): New procedure. (CodeTypeReturnFunc): Ditto. (FoldTypeCheck): Add new case clauses. (CodeTypeCheck): Ditto. (FoldRangeCheckLower): Ditto. (IssueWarning): Ditto. * gm2-gcc/m2options.h (M2Options_SetStrictTypeAssignment): New function prototype. (M2Options_SetStrictTypeReason): Ditto. * gm2-lang.cc (gm2_langhook_handle_option): New case clause OPT_fm2_strict_type_reason. * lang.opt (-fm2-strict-type-reason): New option. gcc/testsuite/ChangeLog: PR modula2/120389 * gm2/pim/fail/testcharint.mod: New test. * gm2/pim/fail/testindrx.mod: New test. * gm2/pim/pass/testxindr.mod: New test. * gm2/pim/pass/testxindr2.mod: New test. * gm2/pim/pass/testxindr3.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2025-05-23Daily bump.GCC Administrator1-0/+7
2025-05-22PR modula2/120389 ICE if assigning a constant char to an integer arrayGaius Mulley1-0/+8
This patch fixes an ICE which occurs if a constant char is assigned into an integer array. The fix it to introduce type checking in M2GenGCC.mod:CodeXIndr. gcc/m2/ChangeLog: PR modula2/120389 * gm2-compiler/M2GenGCC.mod (CodeXIndr): Check to see that the type of left is assignment compatible with the type of right. gcc/testsuite/ChangeLog: PR modula2/120389 * gm2/iso/fail/badarray3.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2025-05-14Daily bump.GCC Administrator1-0/+11
2025-05-13PR modula2/120253: Error message column numbers should start at 1 not 0Gaius Mulley1-12/+13
This patch ensures that column numbers start at 1 rather than 0. gcc/m2/ChangeLog: PR modula2/120253 * m2.flex (FIRST_COLUMN): New define. (updatepos): Remove commented code. (consumeLine): Assign column to FIRST_COLUMN. (initLine): Ditto. (m2flex_GetColumnNo): Return FIRST_COLUMN if currentLine is NULL. (m2flex_GetLineNo): Rewrite for positive logic. (m2flex_GetLocation): Ditto. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2025-05-06Daily bump.GCC Administrator1-0/+12
2025-05-05PR modula2/120117: ICE when attempting to obtain the MAX of an aliased set typeGaius Mulley3-9/+8
The ICE occurred because of a bug in M2GenGCC.mod:FoldBecomes which attempted to remove the same quadruple twice. Thereafter cc1gm2 generated an erroneous error type error as PCSymBuild did not skip an aliased set type. The type of the const was set incorrectly (as a set type) rather than the type of the set element. gcc/m2/ChangeLog: PR modula2/120117 * gm2-compiler/M2GenGCC.mod (FoldBecomes): Remove the call to RemoveQuad since this is performed by TypeCheckBecomes. * gm2-compiler/PCSymBuild.mod (buildConstFunction): Rewrite header comment. Check for a set or a type aliased set and appropriately skip type equivalences and obtain the element type. * gm2-compiler/SymbolTable.mod (PutConst): Add call to CheckBreak. gcc/testsuite/ChangeLog: PR modula2/120117 * gm2/pim/pass/highbit.mod: New test. * gm2/pim/pass/highbit2.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2025-04-25Daily bump.GCC Administrator1-0/+36
2025-04-24PR modula2/119915: Sprintf1 repeats the entire format string if it starts ↵Gaius Mulley1-2/+2
with a directive This bugfix is for FormatStrings to ensure that in the case of %x, %u the procedure function PerformFormatString uses Copy rather than Slice to avoid the case on an upper bound of zero in Slice. Oddly the %d case had the correct code. gcc/m2/ChangeLog: PR modula2/119915 * gm2-libs/FormatStrings.mod (PerformFormatString): Handle the %u and %x format specifiers in a similar way to the %d specifier. Avoid using Slice and use Copy instead. gcc/testsuite/ChangeLog: PR modula2/119915 * gm2/pimlib/run/pass/format2.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2025-04-24PR modula2/119914 No error message generated when passing a Ztype to an ↵Gaius Mulley5-20/+207
unbounded array This patch detects constants ZType, RType, CType being passed to unbounded arrays and generates an error message highlighting the formal and actual parameters in error. gcc/m2/ChangeLog: PR modula2/119914 * gm2-compiler/M2Check.mod (checkConstMeta): Add check for Ztype, Rtype and Ctype and unbounded arrays. (IsZRCType): New procedure function. (isZRC): Add comment. * gm2-compiler/M2Quads.mod: * gm2-compiler/M2Range.mod (gdbinit): New procedure. (BreakWhenRangeCreated): Ditto. (CheckBreak): Ditto. (InitRange): Call CheckBreak. (Init): Add gdbhook and initialize interactive watch point. * gm2-compiler/SymbolTable.def (GetNthParamAnyClosest): New procedure function. * gm2-compiler/SymbolTable.mod (BreakSym): Remove constant. (BreakSym): Add Variable. (stop): Remove. (gdbhook): New procedure. (BreakWhenSymCreated): Ditto. (CheckBreak): Ditto. (NewSym): Call CheckBreak. (Init): Add gdbhook and initialize interactive watch point. (MakeProcedure): Replace guarded call to stop with CheckBreak. (GetNthParamChoice): New procedure function. (GetNthParamOrdered): Ditto. (GetNthParamAnyClosest): Ditto. (GetOuterModuleScope): Ditto. gcc/testsuite/ChangeLog: PR modula2/119914 * gm2/pim/fail/constintarraybyte.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2025-04-12Daily bump.GCC Administrator1-0/+15
2025-04-11PR modula2/119735: Remove single quotes from m2 source code comments.Gaius Mulley9-19/+20
Removing ' from all m2 comments so that make gcc.pot does not generate any warnings. Also hide %n from comments. gcc/m2/ChangeLog: PR modula2/119735 * gm2-compiler/M2MetaError.def: Hide %n from comment. * gm2-compiler/SymbolTable.def (PutIncludedByDefinition): Remove ' from comment. * gm2-gcc/m2expr.def (init): Ditto. * gm2-libiberty/pexecute.def: Ditto. * gm2-libs-coroutines/Executive.def (InitSemaphore): Ditto. (Wait): Ditto. * gm2-libs-iso/ClientSocket.def: Ditto. * gm2-libs-log/BlockOps.def (BlockMoveBackward): Ditto. * gm2-libs-log/InOut.def: Ditto. * mc/mcFileName.def: Ditto. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2025-04-10Daily bump.GCC Administrator1-0/+4
2025-04-09modula2: FIx a comment typoJakub Jelinek1-1/+2
During make gcc.pot I've noticed among tons of other warnings (e.g. because can't appears in non-C/C++ style comment and so gettext considers it unterminated) a warning where the lack of " looked unintentional. 2025-04-09 Jakub Jelinek <jakub@redhat.com> * gm2-compiler/M2MetaError.def: Fix comment typo, range" -> "range2".
2025-03-31Daily bump.GCC Administrator1-0/+4
2025-03-30Docs: make regenerate-opt-urlsSandra Loosemore1-1/+1
gcc/c-family/ChangeLog * c.opt.urls: Regenerate. gcc/d/ChangeLog * lang.opt.urls: Regenerate. gcc/m2/ChangeLog * lang.opt.urls: Regenerate.
2025-03-29Daily bump.GCC Administrator1-0/+9
2025-03-28PR modula2/119504: ICE when attempting to access an element of a constant stringGaius Mulley1-10/+41
This patch prevents an ICE and generates an error if an array access to a constant string is attempted. The patch also allows HIGH ("string"). gcc/m2/ChangeLog: PR modula2/119504 * gm2-compiler/M2Quads.mod (BuildHighFunction): Defend against Type = NulSym and fall into BuildConstHighFromSym. (BuildDesignatorArray): Rewrite to detect an array access to a constant string. (BuildDesignatorArrayStaticDynamic): New procedure. gcc/testsuite/ChangeLog: PR modula2/119504 * gm2/iso/fail/conststrarray2.mod: New test. * gm2/iso/run/pass/constarray2.mod: New test. * gm2/pim/pass/hexstring.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2025-03-26Daily bump.GCC Administrator1-0/+30
2025-03-25PR modula2/119449 MAX of SYSTEM.REAL64 cause an ICEGaius Mulley8-89/+143
This bugfix implements MAX(REAL64) and MIN(REAL64) etc for REAL64, REAL96 and REAL128. gcc/m2/ChangeLog: PR modula2/119449 * gm2-compiler/M2GCCDeclare.def (TryDeclareType): Remove tokenno parameter. * gm2-compiler/M2GCCDeclare.mod (TryDeclareType): Ditto. * gm2-compiler/M2GenGCC.mod (FoldTBitsize): Remove op2 and rename op1 as res and op3 as type. (FoldStandardFunction): Call FoldTBitsize omitting op2. * gm2-compiler/M2Quads.mod (GetTypeMin): Rewrite. (GetTypeMinLower): New procedure function. (GetTypeMax): Rewrite. (GetTypeMaxLower): New procedure function. * gm2-compiler/M2Range.mod (CheckCancelled): Comment out. * gm2-compiler/M2System.mod (CreateMinMaxFor): Add realtype parameter. (MapType): Rewrite to use realtype. (CreateType): Ditto. (AttemptToCreateType): Ditto. (MakeFixedSizedTypes): Add realtype boolean. (InitPIMTypes): Ditto. (InitISOTypes): Ditto. (MakeExtraSystemTypes): Ditto. * gm2-gcc/m2pp.cc (m2pp_nop_expr): Remove code. * gm2-gcc/m2type.cc (IsGccRealType): New function. (m2type_GetMinFrom): Rewrite. (m2type_GetMaxFrom): Ditto. (do_min_real): Declare static. (do_max_real): Declare static. gcc/testsuite/ChangeLog: PR modula2/119449 * gm2/pim/pass/minmaxreal.mod: New test. * gm2/pim/pass/minmaxreal2.mod: New test. * gm2/pim/pass/minmaxreal3.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2025-03-21Daily bump.GCC Administrator1-0/+29
2025-03-20PR modula2/118600 Assigning to a record causes alignment exceptionGaius Mulley10-20/+255
This patch recursively tests every assignment (of a constructor to a designator) to ensure the types are GCC equivalent. If they are equivalent then it uses gimple assignment and if not then it copies a structure by field and uses __builtin_strncpy to copy a string cst into an array. Unions are copied by __builtin_memcpy. gcc/m2/ChangeLog: PR modula2/118600 * gm2-compiler/M2GenGCC.mod (PerformCodeBecomes): New procedure. (CodeBecomes): Refactor and call PerformCodeBecomes. * gm2-gcc/m2builtins.cc (gm2_strncpy_node): New global variable. (DoBuiltinStrNCopy): New function. (m2builtins_BuiltinStrNCopy): New function. (m2builtins_init): Initialize gm2_strncpy_node. * gm2-gcc/m2builtins.def (BuiltinStrNCopy): New procedure function. * gm2-gcc/m2builtins.h (m2builtins_BuiltinStrNCopy): New function. * gm2-gcc/m2statement.cc (copy_record_fields): New function. (copy_array): Ditto. (copy_strncpy): Ditto. (copy_memcpy): Ditto. (CopyByField_Lower): Ditto. (m2statement_CopyByField): Ditto. * gm2-gcc/m2statement.def (CopyByField): New procedure function. * gm2-gcc/m2statement.h (m2statement_CopyByField): New function. * gm2-gcc/m2type.cc (check_record_fields): Ditto. (check_array_types): Ditto. (m2type_IsGccStrictTypeEquivalent): Ditto. * gm2-gcc/m2type.def (IsGccStrictTypeEquivalent): New procedure function. * gm2-gcc/m2type.h (m2type_IsAddress): Replace return type int with bool. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2025-03-17Daily bump.GCC Administrator1-0/+14
2025-03-16PR modula2/115111 Incorrect line debugging locations at the end of the WHILE ↵Gaius Mulley6-25/+34
loop This fix corrects the END token position used during the GotoOp at the bottom of the WHILE loop. The fix is to pass the relative token position down to M2Quads. This method should be replicated for the other loops END or UNTIL keywords and possibly the END statements for conditional statements. gcc/m2/ChangeLog: PR modula2/115111 * gm2-compiler/M2GenGCC.mod (CodeStatementNote): Add debugging. * gm2-compiler/M2Quads.def (BuildEndWhile): New parameter reltokpos. * gm2-compiler/M2Quads.mod (BuildEndWhile): Reimplement using new parameter. * gm2-compiler/P3Build.bnf (WhileStatement): Call BuildEndWhile with -1 relative position. * gm2-gcc/m2block.cc (do_add_stmt): Tidy comment. (GetGlobals): Ditto. (flush_pending_note): Remove #if 0 code. * gm2-gcc/m2pp.cc (m2pp_nop_expr): New function. (m2pp_statement): New case clause call m2pp_nop_expr. gcc/testsuite/ChangeLog: PR modula2/115111 * gm2/pim/pass/whilestep.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2025-03-11Daily bump.GCC Administrator1-0/+15
2025-03-10PR modula2/119192 ICE if TBITSIZE is used in an expressionGaius Mulley6-12/+94
This patch fixes an ICE which will occur is TBITSIZE is used within an expression. gcc/m2/ChangeLog: PR modula2/119192 * gm2-compiler/M2GCCDeclare.def (TryDeclareType): New procedure. * gm2-compiler/M2GCCDeclare.mod (IsAnyType): New procedure. (TryDeclareType): Ditto. * gm2-compiler/M2GenGCC.mod (FoldTBitsize): New procedure. (FoldStandardFunction): Call FoldTBitsize. * gm2-gcc/m2expr.cc (BuildTBitSize): Improve comment. (m2expr_BuildSystemTBitSize): New function. * gm2-gcc/m2expr.def (BuildSystemTBitSize): New procedure function. * gm2-gcc/m2expr.h (m2expr_BuildSystemTBitSize): New function prototype. gcc/testsuite/ChangeLog: PR modula2/119192 * gm2/sets/run/pass/simplepacked.mod: Uncomment asserts. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2025-03-06Daily bump.GCC Administrator1-0/+15
2025-03-05PR modula2/118998 Rotate of a packetset causes different types to binary ↵Gaius Mulley2-6/+39
operator error This patch allow a packedset to be rotated by the system module intrinsic procedure function. It ensures that both operands to the tree rotate are of the same type. In turn the result will be the same type and the assignment into the designator (of the same set type) will succeed. gcc/m2/ChangeLog: PR modula2/118998 * gm2-gcc/m2expr.cc (m2expr_BuildLRotate): Convert nBits to the return type. (m2expr_BuildRRotate): Ditto. (m2expr_BuildLogicalRotate): Convert op3 to an integer type. Replace op3 aith rotateCount. Negate rotateCount if it is negative and call rotate right. * gm2-gcc/m2pp.cc (m2pp_bit_and_expr): New function. (m2pp_binary_function): Ditto. (m2pp_simple_expression): BIT_AND_EXPR new case clause. LROTATE_EXPR ditto. RROTATE_EXPR ditto. gcc/testsuite/ChangeLog: PR modula2/118998 * gm2/iso/pass/testrotate.mod: New test. * gm2/pim/fail/tinyconst.mod: New test. * gm2/sets/run/pass/simplepacked.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>