aboutsummaryrefslogtreecommitdiff
path: root/gcc/m2
AgeCommit message (Collapse)AuthorFilesLines
2023-11-02Daily bump.GCC Administrator1-0/+16
2023-11-01PR modula2/102989: reimplement overflow detection in ztype though ↵Gaius Mulley7-38/+92
WIDE_INT_MAX_PRECISION The ZTYPE in iso modula2 is used to denote intemediate ordinal type const expressions and these are always converted into the approriate language or user ordinal type prior to code generation. The increase of bits supported by _BitInt causes the modula2 largeconst.mod regression failure tests to pass. The largeconst.mod test has been increased to fail, however the char at a time overflow check is now too slow to detect failure. The overflow detection for the ZTYPE has been rewritten to check against exceeding WIDE_INT_MAX_PRECISION (many orders of magnitude faster). gcc/m2/ChangeLog: PR modula2/102989 * gm2-compiler/SymbolTable.mod (OverflowZType): Import from m2expr. (ConstantStringExceedsZType): Remove import. (GetConstLitType): Replace ConstantStringExceedsZType with OverflowZType. * gm2-gcc/m2decl.cc (m2decl_ConstantStringExceedsZType): Remove. (m2decl_BuildConstLiteralNumber): Re-write. * gm2-gcc/m2decl.def (ConstantStringExceedsZType): Remove. * gm2-gcc/m2decl.h (m2decl_ConstantStringExceedsZType): Remove. * gm2-gcc/m2expr.cc (m2expr_StrToWideInt): Rewrite to check overflow. (m2expr_OverflowZType): New function. (ToWideInt): New function. * gm2-gcc/m2expr.def (OverflowZType): New procedure function declaration. * gm2-gcc/m2expr.h (m2expr_OverflowZType): New prototype. gcc/testsuite/ChangeLog: PR modula2/102989 * gm2/pim/fail/largeconst.mod: Updated foo to an outrageous value. * gm2/pim/fail/largeconst2.mod: Duplicate test removed. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-10-28Daily bump.GCC Administrator1-0/+15
2023-10-27PR modula2/111530: Build failure on BSD due to getopt_long_only GNU ↵Gaius Mulley4-86/+24
extension dependency This patch uses the libiberty getopt long functions (wrapped up inside libgm2/libm2pim/cgetopt.cc) and only enables this implementation if libgm2/configure.ac detects no getopt_long and friends on the target. gcc/m2/ChangeLog: PR modula2/111530 * gm2-libs-ch/cgetopt.c (cgetopt_cgetopt_long): Re-format. (cgetopt_cgetopt_long_only): Re-format. (cgetopt_SetOption): Re-format and assign flag to NULL if name is also NULL. * gm2-libs/GetOpt.def (AddLongOption): Add index parameter and change flag to be a VAR parameter rather than a pointer. (GetOptLong): Re-format. (GetOpt): Correct comment. * gm2-libs/GetOpt.mod: Re-write to rely on cgetopt rather than implement long option creation in GetOpt. * gm2-libs/cgetopt.def (SetOption): has_arg type is INTEGER. libgm2/ChangeLog: PR modula2/111530 * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * config.h.in: Regenerate. * configure: Regenerate. * configure.ac (AC_CHECK_HEADERS): Include getopt.h. (GM2_CHECK_LIB): getopt_long check. (GM2_CHECK_LIB): getopt_long_only check. * libm2cor/Makefile.in: Regenerate. * libm2iso/Makefile.in: Regenerate. * libm2log/Makefile.in: Regenerate. * libm2min/Makefile.in: Regenerate. * libm2pim/Makefile.in: Regenerate. * libm2pim/cgetopt.cc: Re-write using conditional on configure and long function code from libiberty/getopt.c. gcc/testsuite/ChangeLog: PR modula2/111530 * gm2/pimlib/run/pass/testgetopt.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-10-26Daily bump.GCC Administrator1-0/+19
2023-10-25PR modula2/111955 introduce isnan support to Builtins.defGaius Mulley5-5/+96
This patch introduces isnan, isnanf and isnanl to Builtins.def. It requires fallback functions isnan, isnanf, isnanl to be implemented in libgm2/libm2pim/wrapc.cc and gm2-libs-ch/wrapc.c. Access to the GCC builtin isnan tree is provided by adding an isnan definition and support functions to gm2-gcc/m2builtins.cc. gcc/m2/ChangeLog: PR modula2/111955 * gm2-gcc/m2builtins.cc (gm2_isnan_node): New tree. (DoBuiltinIsnan): New function. (m2builtins_BuiltInIsnan): New function. (m2builtins_init): Initialize gm2_isnan_node. (list_of_builtins): Add define for __builtin_isnan. * gm2-libs-ch/wrapc.c (wrapc_isnan): New function. (wrapc_isnanf): New function. (wrapc_isnanl): New function. * gm2-libs/Builtins.def (isnanf): New procedure function. (isnan): New procedure function. (isnanl): New procedure function. * gm2-libs/Builtins.mod: * gm2-libs/wrapc.def (isnan): New function. (isnanf): New function. (isnanl): New function. libgm2/ChangeLog: PR modula2/111955 * libm2pim/wrapc.cc (isnan): Export new function. (isnanf): Export new function. (isnanl): Export new function. gcc/testsuite/ChangeLog: PR modula2/111955 * gm2/pimlib/run/pass/testnan.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-10-25Daily bump.GCC Administrator1-0/+12
2023-10-24modula2: tidyup M2Dependent.modGaius Mulley1-5/+16
This patch tidies up M2Dependent.mod by introducing a new procedure to initialize all fields of DependencyList. gcc/m2/ChangeLog: * gm2-libs/M2Dependent.mod (InitDependencyList): New procedure. (CreateModule): Call InitDependencyList to initialize all fields of DependencyList. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-10-24modula2: gcc/m2/gm2-libs/M2Dependent.mod initialize all record fields.Gaius Mulley1-0/+3
Initialize all sub fields within mptr. Valgrind detected uninitialized fields in M2Dependent.mod. CreateModule must ensure all sub fields are initialized. gcc/m2/ChangeLog: * gm2-libs/M2Dependent.mod (CreateModule): Initialize all dependency fields for DependencyList. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-10-18Daily bump.GCC Administrator1-0/+183
2023-10-17PR modula2/111756: Re-building all-gcc after source changes fails to linkGaius Mulley13-505/+1382
When having modula-2 enabled in a development tree and there are any changes that trigger rebuilds in m2/ doing a 'make all-gcc' in the build directory might fail due to lack of dependency tracking. This patch introduces build dependencies into gcc/m2/Make-lang.in using -M* options. The patch also introduces all -M* options to cc1gm2 and gm2. gcc/m2/ChangeLog: PR modula2/111756 * Make-lang.in (CM2DEP): New define conditionally set if ($(CXXDEPMODE),depmode=gcc3). (GM2_1): Use $(CM2DEP). (m2/gm2-gcc/%.o): Ensure $(@D)/$(DEPDIR) is created. Add $(CM2DEP) to the $(COMPILER) command and use $(POSTCOMPILE). (m2/gm2-gcc/m2configure.o): Ditto. (m2/gm2-lang.o): Ditto. (m2/m2pp.o): Ditto. (m2/gm2-gcc/rtegraph.o): Ditto. (m2/mc-boot/$(SRC_PREFIX)%.o): Ditto. (m2/mc-boot-ch/$(SRC_PREFIX)%.o): Ditto. (m2/mc-boot-ch/$(SRC_PREFIX)%.o): Ditto. (m2/mc-boot/main.o): Ditto. (mcflex.o): Ditto. (m2/gm2-libs-boot/M2RTS.o): Ditto. (m2/gm2-libs-boot/%.o): Ditto. (m2/gm2-libs-boot/%.o): Ditto. (m2/gm2-libs-boot/RTcodummy.o): Ditto. (m2/gm2-libs-boot/RTintdummy.o): Ditto. (m2/gm2-libs-boot/wrapc.o): Ditto. (m2/gm2-libs-boot/UnixArgs.o): Ditto. (m2/gm2-libs-boot/choosetemp.o): Ditto. (m2/gm2-libs-boot/errno.o): Ditto. (m2/gm2-libs-boot/dtoa.o): Ditto. (m2/gm2-libs-boot/ldtoa.o): Ditto. (m2/gm2-libs-boot/termios.o): Ditto. (m2/gm2-libs-boot/SysExceptions.o): Ditto. (m2/gm2-libs-boot/SysStorage.o): Ditto. (m2/gm2-compiler-boot/M2GCCDeclare.o): Ditto. (m2/gm2-compiler-boot/M2Error.o): Ditto. (m2/gm2-compiler-boot/%.o): Ditto. (m2/gm2-compiler-boot/%.o): Ditto. (m2/gm2-compiler-boot/m2flex.o): Ditto. (m2/gm2-compiler/%.o): Ditto. (m2/gm2-compiler/m2flex.o): Ditto. (m2/gm2-libs-iso/%.o): Ditto. (m2/gm2-libs/%.o): Ditto. (m2/gm2-libs/%.o): Ditto. (m2/gm2-libs/choosetemp.o): Ditto. (m2/boot-bin/mklink$(exeext)): Ditto. (m2/pge-boot/%.o): Ditto. (m2/pge-boot/%.o): Ditto. (m2/gm2-compiler/%.o): Ensure $(@D)/$(DEPDIR) is created and use $(POSTCOMPILE). (m2/gm2-compiler/%.o): Ditto. (m2/gm2-libs-iso/%.o): Ditto. (m2/gm2-libs/%.o): Ditto. * README: Purge out of date info. * gm2-compiler/M2Comp.mod (MakeSaveTempsFileNameExt): Import. (OnExitDelete): Import. (GetModuleDefImportStatementList): Import. (GetModuleModImportStatementList): Import. (GetImportModule): Import. (IsImportStatement): Import. (IsImport): Import. (GetImportStatementList): Import. (File): Import. (Close): Import. (EOF): Import. (IsNoError): Import. (WriteLine): Import. (WriteChar): Import. (FlushOutErr): Import. (WriteS): Import. (OpenToRead): Import. (OpenToWrite): Import. (ReadS): Import. (WriteS): Import. (GetM): Import. (GetMM): Import. (GetDepTarget): Import. (GetMF): Import. (GetMP): Import. (GetObj): Import. (GetMD): Import. (GetMMD): Import. (GenerateDefDependency): New procedure. (GenerateDependenciesFromImport): New procedure. (GenerateDependenciesFromList): New procedure. (GenerateDependencies): New procedure. (Compile): Re-write. (compile): Re-format. (CreateFileStem): New procedure function. (DoPass0): Re-write. (IsLibrary): New procedure function. (IsUnique): New procedure function. (Append): New procedure. (MergeDep): New procedure. (GetRuleTarget): New procedure function. (ReadDepContents): New procedure function. (WriteDep): New procedure. (WritePhonyDep): New procedure. (WriteDepContents): New procedure. (CreateDepFilename): New procedure function. (Pass0CheckDef): New procedure function. (Pass0CheckMod): New procedure function. (DoPass0): Re-write. (DepContent): New variable. (DepOutput): New variable. (BaseName): New procedure function. * gm2-compiler/M2GCCDeclare.mod (PrintTerse): Handle IsImport. Replace IsGnuAsmVolatile with IsGnuAsm. * gm2-compiler/M2Options.def (EXPORT QUALIFIED): Remove list. (SetM): New procedure. (GetM): New procedure function. (SetMM): New procedure. (GetMM): New procedure function. (SetMF): New procedure. (GetMF): New procedure function. (SetPPOnly): New procedure. (GetB): New procedure function. (SetMD): New procedure. (GetMD): New procedure function. (SetMMD): New procedure. (GetMMD): New procedure function. (SetMQ): New procedure. (SetMT): New procedure. (GetMT): New procedure function. (GetDepTarget): New procedure function. (SetMP): New procedure. (GetMP): New procedure function. (SetObj): New procedure. (SetSaveTempsDir): New procedure. * gm2-compiler/M2Options.mod (SetM): New procedure. (GetM): New procedure function. (SetMM): New procedure. (GetMM): New procedure function. (SetMF): New procedure. (GetMF): New procedure function. (SetPPOnly): New procedure. (GetB): New procedure function. (SetMD): New procedure. (GetMD): New procedure function. (SetMMD): New procedure. (GetMMD): New procedure function. (SetMQ): New procedure. (SetMT): New procedure. (GetMT): New procedure function. (GetDepTarget): New procedure function. (SetMP): New procedure. (GetMP): New procedure function. (SetObj): New procedure. (SetSaveTempsDir): New procedure. * gm2-compiler/M2Preprocess.def (PreprocessModule): New parameters topSource and outputDep. Re-write. (MakeSaveTempsFileNameExt): New procedure function. (OnExitDelete): New procedure function. * gm2-compiler/M2Preprocess.mod (GetM): Import. (GetMM): Import. (OnExitDelete): Add debugging message. (RemoveFile): Add debugging message. (BaseName): Remove. (BuildCommandLineExecute): New procedure function. * gm2-compiler/M2Search.def (SetDefExtension): Remove unnecessary spacing. * gm2-compiler/SymbolTable.mod (GetSymName): Handle ImportSym and ImportStatementSym. * gm2-gcc/m2options.h (M2Options_SetMD): New function. (M2Options_GetMD): New function. (M2Options_SetMMD): New function. (M2Options_GetMMD): New function. (M2Options_SetM): New function. (M2Options_GetM): New function. (M2Options_SetMM): New function. (M2Options_GetMM): New function. (M2Options_GetMQ): New function. (M2Options_SetMF): New function. (M2Options_GetMF): New function. (M2Options_SetMT): New function. (M2Options_SetMP): New function. (M2Options_GetMP): New function. (M2Options_GetDepTarget): New function. * gm2-lang.cc (gm2_langhook_init): Correct comment case. (gm2_langhook_init_options): Add case OPT_M and OPT_MM. (gm2_langhook_post_options): Add case OPT_MF, OPT_MT, OPT_MD and OPT_MMD. * lang-specs.h (M2CPP): Pass though MF option. (MDMMD): New define. Add MDMMD to "@modula-2". Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-10-16Daily bump.GCC Administrator1-0/+4
2023-10-15modula2: Add m2.etags rule to gcc/m2/Make-lang.inGaius Mulley1-0/+6
This patch adds the m2.etags rule to gcc/m2/Make-lang.in which generates etags for the .cc .c .h files within gcc/m2. gcc/m2/ChangeLog: * Make-lang.in (m2.tags): New rule. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-10-12Daily bump.GCC Administrator1-0/+35
2023-10-11modula2: Narrow subranges to int or unsigned int if ZTYPE is the base type.Gaius Mulley1-15/+54
This patch narrows the subrange base type to INTEGER or CARDINAL providing the range is satisfied. It only does this when the subrange base type is the ZTYPE. gcc/m2/ChangeLog: * gm2-compiler/M2GCCDeclare.mod (DeclareSubrange): Check the base type of the subrange against the ZTYPE and call DeclareSubrangeNarrow if necessary. (DeclareSubrangeNarrow): New procedure function. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-10-11PR modula2/111675 Incorrect packed record field value passed to a procedureGaius Mulley9-54/+69
This patch allows a packed field to be extracted and passed to a procedure. It ensures that the subrange type is the same for both the procedure and record field. It also extends the <* bytealignment (0) *> to cover packed subrange types. gcc/m2/ChangeLog: PR modula2/111675 * gm2-compiler/M2CaseList.mod (appendTree): Replace InitStringCharStar with InitString. * gm2-compiler/M2GCCDeclare.mod: Import AreConstantsEqual. (DeclareSubrange): Add zero alignment test and call BuildSmallestTypeRange if necessary. (WalkSubrangeDependants): Walk the align expression. (IsSubrangeDependants): Test the align expression. * gm2-compiler/M2Quads.mod (BuildStringAdrParam): Correct end name. * gm2-compiler/P2SymBuild.mod (BuildTypeAlignment): Allow subranges to be zero aligned (packed). * gm2-compiler/SymbolTable.mod (Subrange): Add Align field. (MakeSubrange): Set Align to NulSym. (PutAlignment): Assign Subrange.Align to align. (GetAlignment): Return Subrange.Align. * gm2-gcc/m2expr.cc (noBitsRequired): Rewrite. (calcNbits): Rename ... (m2expr_calcNbits): ... to this and test for negative values. (m2expr_BuildTBitSize): Replace calcNBits with m2expr_calcNbits. * gm2-gcc/m2expr.def (calcNbits): Export. * gm2-gcc/m2expr.h (m2expr_calcNbits): New prototype. * gm2-gcc/m2type.cc (noBitsRequired): Remove. (m2type_BuildSmallestTypeRange): Call m2expr_calcNbits. (m2type_BuildSubrangeType): Create range_type from build_range_type (type, lowval, highval). gcc/testsuite/ChangeLog: PR modula2/111675 * gm2/extensions/run/pass/packedrecord3.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-09-30Daily bump.GCC Administrator1-0/+7
2023-09-29modula2: iso library SysClock.mod and wrapclock.cc fixes.Gaius Mulley2-11/+15
This patch corrects the C equivalent of m2 LONGINT parameters in wrapclock.cc and corrects the SysClock.mod module. wrapclock.cc uses a typedef long long int longint_t to match m2 LONGINT (rather than unsigned long). These fixes prevent calls to SysClock hanging spinning on an (incorrect) large day count from the epoch. gcc/m2/ChangeLog: * gm2-compiler/M2Quads.mod (EndBuildFor): Improve block comments. * gm2-libs-iso/SysClock.mod (ExtractDate): Replace testDays with yearOfDays. New local variable monthOfDays. libgm2/ChangeLog: * libm2iso/wrapclock.cc (longint_t): New declaration. (GetTimespec): Replace types for sec and nano with longint_t. (SetTimespec): Replace types for sec and nano with longint_t. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-09-28Daily bump.GCC Administrator1-0/+11
2023-09-26PR modula2/111510 runtime ICE findChildAndParent has caused internal runtime ↵Gaius Mulley3-19/+23
error This patch fixes the runtime bug above. The full runtime message is: findChildAndParent has caused internal runtime error, RTentity is either corrupt or the module storage has not been initialized yet. The bug is due to a non nul terminated string determining the module initialization order. This results in modules being uninitialized and the above crash. The bug manifests itself on 32 bit systems - but obviously is latent on all targets and the fix should be applied to both gcc-14 and gcc-13. gcc/m2/ChangeLog: PR modula2/111510 * gm2-compiler/M2GenGCC.mod (IsExportedGcc): Minor spacing changes. (BuildTrashTreeFromInterface): Minor spacing changes. * gm2-compiler/M2Options.mod (GetRuntimeModuleOverride): Call string to generate a nul terminated C style string. * gm2-compiler/M2Quads.mod (BuildStringAdrParam): New procedure. (BuildM2InitFunction): Replace inline parameter generation with calls to BuildStringAdrParam. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-09-20Daily bump.GCC Administrator1-0/+153
2023-09-19PR 108143/modula2 LONGREAL and powerpc64le-linuxGaius Mulley49-474/+1443
This patch introduces a configure for LONGREAL as float128 when targetting or hosting cc1gm2 on ppc64le. It fixes calls to builtins and fixes the -fdebug-builtins option. gcc/ChangeLog: * doc/gm2.texi (fdebug-builtins): Correct description. gcc/m2/ChangeLog: * Make-lang.in (host_mc_longreal): Detect hosting on powerpc64le and if so use __float128 for longreal in mc. (MC_ARGS): Append host_mc_longreal. * config-make.in (TEST_TARGET_CPU_DEFAULT): New variable. (TEST_HOST_CPU_DEFAULT): New variable. * configure: Regenerate. * configure.ac (M2C_LONGREAL_FLOAT128): New define set if target is powerpc64le. (M2C_LONGREAL_PPC64LE): New define set if target is powerpc64le. * gm2-compiler/M2GCCDeclare.mod: Correct comment case. * gm2-compiler/M2GenGCC.mod (MaybeDebugBuiltinAlloca): Call SetLastFunction for the builtin function call. (MaybeDebugBuiltinMemcpy): Call SetLastFunction for the builtin function call. (MaybeDebugBuiltinMemset): New procedure function. (MakeCopyUse): Use GNU formatting. (UseBuiltin): Rewrite to check BuiltinExists. (CodeDirectCall): Rewrite to check BuiltinExists and call SetLastFunction. (CodeMakeAdr): Re-format. * gm2-compiler/M2Options.def (SetDebugBuiltins): New procedure. * gm2-compiler/M2Options.mod (SetUninitVariableChecking): Allow "cond" to switch UninitVariableConditionalChecking separately. (SetDebugBuiltins): New procedure. * gm2-compiler/M2Quads.def (BuildFunctionCall): Add parameter ConstExpr. * gm2-compiler/M2Quads.mod (BuildRealProcedureCall): Add parameter to BuildRealFuncProcCall. (BuildRealFuncProcCall): Add ConstExpr parameter. Pass ConstExpr to BuildFunctionCall. (BuildFunctionCall): Add parameter ConstExpr. Pass ConstExpr to BuildRealFunctionCall. (BuildConstFunctionCall): Add parameter ConstExpr. Pass ConstExpr to BuildFunctionCall. (BuildRealFunctionCall): Add parameter ConstExpr. Pass ConstExpr to BuildRealFuncProcCall. * gm2-compiler/P3Build.bnf (SetOrDesignatorOrFunction): Pass FALSE to BuildFunctionCall. (AssignmentOrProcedureCall): Pass FALSE to BuildFunctionCall. * gm2-compiler/SymbolTable.def (IsProcedureBuiltinAvailable): New procedure function. * gm2-compiler/SymbolTable.mod (CanUseBuiltin): New procedure function. (IsProcedureBuiltinAvailable): New procedure function. * gm2-gcc/m2builtins.cc (DEBUGGING): Undef. (bf_category): New enum type. (struct builtin_function_entry): New field function_avail. (m2builtins_BuiltInMemCopy): Rename from ... (m2builtins_BuiltinMemCopy): ... this. (DoBuiltinMemSet): New function. (m2builtins_BuiltinMemSet): New function. (do_target_support_exists): New function. (target_support_exists): New function. (m2builtins_BuiltinExists): Return true or false. (m2builtins_BuildBuiltinTree): Rename local variables. Replace long_double_type_node with GetM2LongRealType. (m2builtins_init): Use GetM2LongRealType rather than long_double_type_node. * gm2-gcc/m2builtins.def (BuiltInMemCopy): Rename to ... (BuiltinMemCopy): ... this. (BuiltinMemSet): New procedure function. * gm2-gcc/m2builtins.h (m2builtins_BuiltInMemCopy): Rename to ... (m2builtins_BuiltinMemCopy): ... this. (m2builtins_BuiltinMemSet): New procedure function. * gm2-gcc/m2configure.cc (m2configure_M2CLongRealFloat128): New procedure function. (m2configure_M2CLongRealIBM128): New procedure function. (m2configure_M2CLongRealLongDouble): New procedure function. (m2configure_M2CLongRealLongDoublePPC64LE): New procedure function. * gm2-gcc/m2configure.def (M2CLongRealFloat128): New procedure function. (M2CLongRealIBM128): New procedure function. (M2CLongRealLongDouble): New procedure function. (M2CLongRealLongDoublePPC64LE): New procedure function. * gm2-gcc/m2configure.h (m2configure_FullPathCPP): New procedure function. (m2configure_M2CLongRealFloat128): New procedure function. (m2configure_M2CLongRealIBM128): New procedure function. (m2configure_M2CLongRealLongDouble): New procedure function. (m2configure_M2CLongRealLongDoublePPC64LE): New procedure function. * gm2-gcc/m2convert.cc (m2convert_BuildConvert): Use convert_loc. * gm2-gcc/m2options.h (M2Options_SetDebugBuiltins): New function. * gm2-gcc/m2statement.cc (m2statement_BuildAssignmentTree): Set TREE_USED to true. (m2statement_BuildGoto):Set TREE_USED to true. (m2statement_BuildParam): Set TREE_USED to true. (m2statement_BuildBuiltinCallTree): New function. (m2statement_BuildFunctValue): Set TREE_USED to true. * gm2-gcc/m2statement.def (BuildBuiltinCallTree): New procedure function. * gm2-gcc/m2statement.h (m2statement_BuildBuiltinCallTree): New procedure function. * gm2-gcc/m2treelib.cc (m2treelib_DoCall0): Remove spacing. (m2treelib_DoCall1): Remove spacing. (m2treelib_DoCall2): Remove spacing. (m2treelib_DoCall3): Remove spacing. (add_stmt): Rename parameter. * gm2-gcc/m2type.cc (build_set_type): Remove spacing. (build_m2_specific_size_type): Remove spacing. (finish_build_pointer_type): Remove spacing. (m2type_BuildVariableArrayAndDeclare): Remove spacing. (build_m2_short_real_node): Remove spacing. (build_m2_real_node): Remove spacing. (build_m2_long_real_node): Use float128_type_node if M2CLongRealFloat128 is set. (build_m2_ztype_node): Remove spacing. (build_m2_long_int_node): Remove spacing. (build_m2_long_card_node): Remove spacing. (build_m2_short_int_node): Remove spacing. (build_m2_short_card_node): Remove spacing. (build_m2_iso_loc_node): Remove spacing. (m2type_SameRealType): New function. (m2type_InitBaseTypes): Create m2_c_type_node using m2_long_complex_type_node. (m2type_SetAlignment): Tidy up comment. * gm2-gcc/m2type.def (SameRealType): New procedure function. * gm2-gcc/m2type.h (m2type_SameRealType): New procedure function. * gm2-lang.cc (gm2_langhook_type_for_mode): Build long complex node from m2 language specific long double node. * gm2-libs-log/RealConversions.mod (IsNan): New procedure function. (doPowerOfTen): Re-implement. * gm2-libs/Builtins.mod: Add newline. * gm2-libs/DynamicStrings.def (ReplaceChar): New procedure function. * gm2-libs/DynamicStrings.mod (ReplaceChar): New procedure function. * gm2config.aci.in (M2C_LONGREAL_FLOAT128): New config value. (M2C_LONGREAL_PPC64LE): New config value. * gm2spec.cc (lang_specific_driver): New local variable need_default_mabi set to default value depending upon M2C_LONGREAL_PPC64LE and M2C_LONGREAL_FLOAT128. * lang.opt (Wcase-enum): Moved to correct section. * m2pp.cc (m2pp_real_type): New function. (m2pp_type): Call m2pp_real_type. (m2pp_print_mode): New function. (m2pp_simple_type): Call m2pp_simple_type. (m2pp_float): New function. (m2pp_expression): Call m2pp_float. * mc-boot/GDynamicStrings.cc: Rebuild. * mc-boot/GDynamicStrings.h: Rebuild. * mc-boot/GFIO.cc: Rebuild. * mc-boot/GFIO.h: Rebuild. * mc-boot/GIO.cc: Rebuild. * mc-boot/GRTint.cc: Rebuild. * mc-boot/Gdecl.cc: Rebuild. * mc-boot/GmcOptions.cc: Rebuild. * mc-boot/GmcOptions.h: Rebuild. * mc/decl.mod: Rebuild. * mc/mcOptions.def (getCRealType): New procedure function. (getCLongRealType): New procedure function. (getCShortRealType): New procedure function. * mc/mcOptions.mod (getCRealType): New procedure function. (getCLongRealType): New procedure function. (getCShortRealType): New procedure function. libgm2/ChangeLog: * Makefile.am (TARGET_LONGDOUBLE_ABI): New variable set to -mabi=ieeelongdouble if the target is powerpc64le. (AM_MAKEFLAGS): Append TARGET_LONGDOUBLE_ABI. * Makefile.in: Rebuild. * libm2cor/Makefile.am (AM_MAKEFLAGS): Add CFLAGS_LONGDOUBLE and TARGET_LONGDOUBLE_ABI. (libm2cor_la_CFLAGS): Add TARGET_LONGDOUBLE_ABI. (libm2cor_la_M2FLAGS): Add TARGET_LONGDOUBLE_ABI. * libm2cor/Makefile.in: Rebuild. * libm2iso/Makefile.am (AM_MAKEFLAGS): Add CFLAGS_LONGDOUBLE and TARGET_LONGDOUBLE_ABI. (libm2iso_la_CFLAGS): Add TARGET_LONGDOUBLE_ABI. (libm2iso_la_M2FLAGS): Add TARGET_LONGDOUBLE_ABI. * libm2iso/Makefile.in: Rebuild. * libm2log/Makefile.am (AM_MAKEFLAGS): Add CFLAGS_LONGDOUBLE and TARGET_LONGDOUBLE_ABI. (libm2log_la_CFLAGS): Add TARGET_LONGDOUBLE_ABI. (libm2log_la_M2FLAGS): Add TARGET_LONGDOUBLE_ABI. * libm2log/Makefile.in: Rebuild. * libm2min/Makefile.am (AM_MAKEFLAGS): Add CFLAGS_LONGDOUBLE and TARGET_LONGDOUBLE_ABI. (libm2min_la_CFLAGS): Add TARGET_LONGDOUBLE_ABI. (libm2min_la_M2FLAGS): Add TARGET_LONGDOUBLE_ABI. * libm2min/Makefile.in: Rebuild. * libm2pim/Makefile.am (AM_MAKEFLAGS): Add CFLAGS_LONGDOUBLE and TARGET_LONGDOUBLE_ABI. (libm2pim_la_CFLAGS): Add TARGET_LONGDOUBLE_ABI. (libm2pim_la_M2FLAGS): Add TARGET_LONGDOUBLE_ABI. * libm2pim/Makefile.in: Rebuild. gcc/testsuite/ChangeLog: * gm2/extensions/pass/libc.def: Add spacing. * gm2/pimlib/logitech/run/pass/realconv.mod: Add debugging print. * gm2/switches/uninit-variable-checking/cascade/fail/switches-uninit-variable-checking-cascade-fail.exp: Add -fdebug-builtins flag. * lib/gm2.exp (gm2_target_compile_default): Add -mabi=ieeelongdouble if the target is powerpc. (gm2_link_flags): Add -mabi=ieeelongdouble if the target is powerpc. * gm2/pim/intrinsic/run/pass/cstub.c: New test. * gm2/pim/intrinsic/run/pass/cstub.def: New test. * gm2/pim/intrinsic/run/pass/pim-intrinsic-run-pass.exp: New test. * gm2/pim/intrinsic/run/pass/test.mod: New test. * gm2/pim/run/pass/builtins.mod: New test. * gm2/pim/run/pass/convert1.mod: New test. * gm2/pim/run/pass/longint1.mod: New test. * gm2/pim/run/pass/longint2.mod: New test. * gm2/pim/run/pass/longint3.mod: New test. * gm2/pim/run/pass/longint4.mod: New test. * gm2/pim/run/pass/longint5.mod: New test. * gm2/pim/run/pass/longint6.mod: New test. * gm2/pim/run/pass/longint7.mod: New test. * gm2/pim/run/pass/longint8.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-09-15Daily bump.GCC Administrator1-0/+44
2023-09-14modula2: Add missing comments to M2CaseList.mod and add testcasesGaius Mulley1-11/+13
This patch adds procedure block comments to M2CaseList.mod, changes date values to use unique digits and add a new test case. gcc/m2/ChangeLog: * gm2-compiler/M2CaseList.mod (NewRanges): Add block comment. (NewSet): Add block comment. (DisplayRanges): Add block comment. (IncludeElement): Add block comment. (IncludeElements): Add block comment. (appendString): Add block comment. (appendEnum): Add block comment. (appendTree): Add block comment. (SubrangeErrors): Add block comment. gcc/testsuite/ChangeLog: * gm2/switches/case/fail/subrangecase.mod: Replace 19 with 17. * gm2/switches/case/fail/subrangecase2.mod: Ditto. * gm2/switches/case/fail/subrangecase3.mod: Ditto. * gm2/switches/case/fail/subrangecase4.mod: Ditto. * gm2/switches/case/pass/subrangecase.mod: Ditto. * gm2/switches/case/pass/subrangecase2.mod: Ditto. * gm2/switches/case/pass/subrangecase3.mod: Ditto. * gm2/switches/case/pass/subrangecase4.mod: Ditto. * gm2/switches/case/fail/calendar.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-09-14modula2: introduce case checking when switching on subrangesGaius Mulley5-78/+278
This patch extends the -Wcase-enum warning to catch missing elements from subranges. The patch also includes removal of unused parameters from M2SymInit.mod and M2CaseList.mod. gcc/m2/ChangeLog: * gm2-compiler/M2CaseList.mod (appendString): New procedure. (appendEnum): Re-implement. (NoOfSetElements): New procedure function. (isPrintableChar): New procedure function. (appendTree): New procedure. (SubrangeErrors): New procedure. (EmitMissingRangeErrors): Call SubrangeErrors if appropriate. * gm2-compiler/M2SymInit.mod (SetFieldInitializedNo): Avoid using a temporary variable once. (IsLocalVar): Comment out. (RecordContainsVarient): Remove fieldtype. (GenerateNoteFlow): Remove lst parameter. (CheckDeferredRecordAccess): Remove lst parameter. (CheckUnary): Remove lst parameter. Remove procSym. (CheckBinary): Remove lst parameter. Remove procSym. (CheckIndrX): Remove lst parameter. Remove procSym. (CheckXIndr): Remove bblst and procSym parameters. (CheckRecordField): Remove procSym, op1tok, op2tok and op2. (CheckBecomes): Remove procSym and bblst. (CheckComparison): Remove procSym and bblst. (CheckAddr): Remove procSym parameter. * gm2-gcc/m2expr.cc (m2expr_CSTIntToString): New function. (m2expr_CSTIntToChar): New function. * gm2-gcc/m2expr.def (CSTIntToString): New procedure function declaration. (CSTIntToChar): New procedure function declaration. * gm2-gcc/m2expr.h (m2expr_CSTIntToChar): New prototype. (m2expr_CSTIntToString): New prototype. gcc/testsuite/ChangeLog: * gm2/switches/case/fail/subrangecase.mod: New test. * gm2/switches/case/fail/subrangecase2.mod: New test. * gm2/switches/case/fail/subrangecase3.mod: New test. * gm2/switches/case/fail/subrangecase4.mod: New test. * gm2/switches/case/fail/subrangecase5.mod: New test. * gm2/switches/case/fail/subrangecase6.mod: New test. * gm2/switches/case/pass/subrangecase.mod: New test. * gm2/switches/case/pass/subrangecase2.mod: New test. * gm2/switches/case/pass/subrangecase3.mod: New test. * gm2/switches/case/pass/subrangecase4.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-09-14Daily bump.GCC Administrator1-0/+12
2023-09-13modula2: -Wcase-enum detect singular/plural and use switch during buildGaius Mulley3-15/+42
This patch generates a singular or plural message relating to the number of enums missing. Use -Wcase-enum when building of the modula-2 libraries and m2/stage2/cc1gm2. gcc/m2/ChangeLog: * Make-lang.in (GM2_FLAGS): Add -Wcase-enum. (GM2_ISO_FLAGS): Add -Wcase-enum. * gm2-compiler/M2CaseList.mod (EnumerateErrors): Issue singular or plural start text prior to the enum list. Remove unused parameter tokenno. (EmitMissingRangeErrors): New procedure. (MissingCaseBounds): Call EmitMissingRangeErrors. (MissingCaseStatementBounds): Call EmitMissingRangeErrors. * gm2-libs-iso/TextIO.mod: Fix spacing. libgm2/ChangeLog: * libm2cor/Makefile.am (libm2cor_la_M2FLAGS): Add -Wcase-enum. * libm2cor/Makefile.in: Regenerate. * libm2iso/Makefile.am (libm2iso_la_M2FLAGS): Add -Wcase-enum. * libm2iso/Makefile.in: Regenerate. * libm2log/Makefile.am (libm2log_la_M2FLAGS): Add -Wcase-enum. * libm2log/Makefile.in: Regenerate. * libm2pim/Makefile.am (libm2pim_la_M2FLAGS): Add -Wcase-enum. * libm2pim/Makefile.in: Regenerate. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-09-13Daily bump.GCC Administrator1-0/+73
2023-09-12modula2: new option -Wcase-enum and associated fixesGaius Mulley16-353/+542
This patch introduces -Wcase-enum which enumerates each missing field in a case statement without an else clause providing the selector expression type is an enum. gcc/ChangeLog: * doc/gm2.texi (Compiler options): Document new option -Wcase-enum. gcc/m2/ChangeLog: * gm2-compiler/M2CaseList.def (PushCase): Rename parameters r to rec and v to va. Add expr parameter. (MissingCaseStatementBounds): New procedure function. * gm2-compiler/M2CaseList.mod (RangePair): Add expression. (PushCase): Rename parameters r to rec and v to va. Add expr parameter. (RemoveRange): New procedure function. (SubBitRange): Detect the case when the range in the set matches lo..hi. (CheckLowHigh): New procedure. (ExcludeCaseRanges): Rename parameter c to cd. Rename local variables q to cl and r to rp. (High): Remove. (Low): Remove. (DoEnumValues): Remove. (IncludeElement): New procedure. (IncludeElements): New procedure. (ErrorRangeEnum): New procedure. (ErrorRange): Remove. (ErrorRanges): Remove. (appendEnum): New procedure. (appendStr): New procedure. (EnumerateErrors): New procedure. (MissingCaseBounds): Re-implement. (InRangeList): Remove. (MissingCaseStatementBounds): New procedure function. (checkTypes): Re-format. (inRange): Re-format. (TypeCaseBounds): Re-format. * gm2-compiler/M2Error.mod (GetAnnounceScope): Add noscope to case label list. * gm2-compiler/M2GCCDeclare.mod: Replace ForeachFieldEnumerationDo with ForeachLocalSymDo. * gm2-compiler/M2Options.def (SetCaseEnumChecking): New procedure. (CaseEnumChecking): New variable. * gm2-compiler/M2Options.mod (SetCaseEnumChecking): New procedure. (Module initialization): set CaseEnumChecking to FALSE. * gm2-compiler/M2Quads.def (QuadOperator): Alphabetically ordered. * gm2-compiler/M2Quads.mod (IsBackReferenceConditional): Add else clause. (BuildCaseStart): Pass selector expression to InitCaseBounds. (CheckUninitializedVariablesAreUsed): Remove. (IsInlineWithinBlock): Remove. (AsmStatementsInBlock): Remove. (CheckVariablesInBlock): Remove commented code. (BeginVarient): Pass NulSym to InitCaseBounds. * gm2-compiler/M2Range.mod (FoldCaseBounds): New local variable errorGenerated. Add call to MissingCaseStatementBounds. * gm2-compiler/P3Build.bnf (CaseEndStatement): Call ElseCase. * gm2-compiler/PCSymBuild.mod (InitDesExpr): Add else clause. (InitFunction): Add else clause. (InitConvert): Add else clause. (InitLeaf): Add else clause. (InitBinary): Add else clause. (InitUnary): Add else clause. * gm2-compiler/SymbolTable.def (GetNth): Re-write comment. (ForeachFieldEnumerationDo): Re-write comment stating alphabetical traversal. * gm2-compiler/SymbolTable.mod (GetNth): Re-write comment. Add case label for EnumerationSym and call GetItemFromList. (ForeachFieldEnumerationDo): Re-write comment stating alphabetical traversal. (SymEnumeration): Add ListOfFields used for declaration order. (MakeEnumeration): Initialize ListOfFields. (PutFieldEnumeration): Include Field in ListOfFields. * gm2-gcc/m2options.h (M2Options_SetCaseEnumChecking): New function. * gm2-lang.cc (gm2_langhook_handle_option): Add OPT_Wcase_enum case and call M2Options_SetCaseEnumChecking. * lang.opt (Wcase-enum): Add. gcc/testsuite/ChangeLog: * gm2/switches/case/fail/missingclause.mod: New test. * gm2/switches/case/fail/switches-case-fail.exp: New test. * gm2/switches/case/pass/enumcase.mod: New test. * gm2/switches/case/pass/enumcase2.mod: New test. * gm2/switches/case/pass/switches-case-pass.exp: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-09-12Daily bump.GCC Administrator1-0/+7
2023-09-11PR modula2/111330 Bootstrap failure building SeqFile.loGaius Mulley1-1/+5
cc1gm2 issues a runtime case statement error and terminates when building SeqFile.lo on Fedora mock. There are four missing labels from the largest case statement in M2SymInit.mod. This patch adds the case labels and appropriate actions. gcc/m2/ChangeLog: PR modula2/111330 * gm2-compiler/M2SymInit.mod (CheckReadBeforeInitQuad): Add case labels LogicalDiffOp, DummyOp, OptParamOp and InitAddressOp. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-08-21Daily bump.GCC Administrator1-0/+13
2023-08-20PR modula2/111085 nexttoward and nexttowardf contain incorrect definitionsGaius Mulley3-6/+6
The definition for procedures nexttoward and nexttowardf contain second incorrect parameter and return types. This bug was discovered when attempting to resolve PR 108143 and is applied separately and prior to PR 108143. gcc/m2/ChangeLog: PR modula2/111085 * gm2-libs/Builtins.def (nexttoward): Alter the second parameter to LONGREAL. (nexttowardf): Alter the second parameter to LONGREAL. * gm2-libs/Builtins.mod (nexttoward): Alter the second parameter to LONGREAL. (nexttowardf): Alter the second parameter to LONGREAL. * gm2-libs/cbuiltin.def (nexttoward): Alter the second parameter to LONGREAL. (nexttowardf): Alter the second parameter to LONGREAL. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-08-14Daily bump.GCC Administrator1-0/+5
2023-08-13modula-2, plugin: Fix Darwin bootstrap issues.Iain Sandoe1-2/+3
This corrects some typos in the suffix of the m2rte pluing that lead to a bootstrap fail on Darwin, where the suffix is not '.so'. On some versions of Darwin, the linker complains if libSystem is not linked, so we disable all the default libs, but add libc back. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> gcc/m2/ChangeLog: * Make-lang.in: Update suffix spellings to use 'soext'. Add libc to the plugin link.
2023-08-13Daily bump.GCC Administrator1-0/+29
2023-08-12PR modula2/110779 SysClock can not read the clock (Darwin portability fixes)Gaius Mulley2-8/+38
This patch adds corrections to defensively check against glibc functions, structures and contains fallbacks. These fixes were required under Darwin. gcc/m2/ChangeLog: PR modula2/110779 * gm2-libs-iso/SysClock.mod (EpochTime): New procedure. (GetClock): Call EpochTime if the C time functions are unavailable. * gm2-libs-iso/wrapclock.def (istimezone): New function definition. libgm2/ChangeLog: PR modula2/110779 * configure: Regenerate. * configure.ac: Provide special case test for Darwin cross configuration. (GLIBCXX_CONFIGURE): New statement. (GLIBCXX_CHECK_GETTIMEOFDAY): New statement. (GLIBCXX_ENABLE_LIBSTDCXX_TIME): New statement. * libm2iso/wrapclock.cc: New sys/time.h conditional include. (sys/syscall.h): Conditional include. (unistd.h): Conditional include. (GetTimeRealtime): Re-implement. (SetTimeRealtime): Re-implement. (timezone): Re-implement. (istimezone): New function. (daylight): Re-implement. (isdst): Re-implement. (tzname): Re-implement. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-08-12PR modula2/108119 disable m2rte plugin by defaultGaius Mulley2-9/+16
This patch disables the m2rte plugin by default. The driver will only append the -fplugin=m2rte command line option for cc1gm2 if -fm2-plugin is present. It only enabled providing ENABLE_PLUGIN is defined. gcc/m2/Make-file.in will only build and install m2rte if enable_plugin is yes. gcc/m2/ChangeLog: PR modula2/108119 * Make-lang.in (M2RTE_PLUGIN_SO): Assigned to plugin/m2rte$(exeext).so if enable_plugin is yes. (m2.all.cross): Replace plugin/m2rte$(soext) with $(M2RTE_PLUGIN_SO). (m2.all.encap): Replace plugin/m2rte$(soext) with $(M2RTE_PLUGIN_SO). (m2.install-plugin): Add dummy rule when enable_plugin is not yes. (plugin/m2rte$(exeext).so): Add dummy rule when enable_plugin is not yes. (m2/stage2/cc1gm2$(exeext)): Replace plugin/m2rte$(soext) with $(M2RTE_PLUGIN_SO). (m2/stage1/cc1gm2$(exeext)): Replace plugin/m2rte$(soext) with $(M2RTE_PLUGIN_SO). * gm2spec.cc (lang_specific_driver): Set need_plugin to false by default. gcc/testsuite/ChangeLog: PR modula2/108119 * gm2/iso/check/fail/iso-check-fail.exp (gm2_init_iso): Add -fm2-plugin. * gm2/switches/auto-init/fail/switches-auto-init-fail.exp (gm2_init_iso): Add -fm2-plugin. * gm2/switches/check-all/pim2/fail/switches-check-all-pim2-fail.exp (gm2_init_pim2): Add -fm2-plugin. * gm2/switches/check-all/plugin/iso/fail/switches-check-all-plugin-iso-fail.exp (gm2_init_iso): Add -fm2-plugin. * gm2/switches/check-all/plugin/pim2/fail/switches-check-all-plugin-pim2-fail.exp (gm2_init_pim2): Add -fm2-plugin. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-08-10Daily bump.GCC Administrator1-0/+10
2023-08-09PR modula2/110779: libgm2 fix solaris bootstrap check for tm_gmtoffGaius Mulley2-23/+32
This patch defensively checks for every C function and every struct used in wrapclock.cc. It adds return values to GetTimespec and SetTimespec to allow the module to return a code representing unavailable. gcc/m2/ChangeLog: PR modula2/110779 * gm2-libs-iso/SysClock.mod (GetClock): Test GetTimespec return value. (SetClock): Test SetTimespec return value. * gm2-libs-iso/wrapclock.def (GetTimespec): Add integer return type. (SetTimespec): Add integer return type. libgm2/ChangeLog: PR modula2/110779 * config.h.in: Regenerate. * configure: Regenerate. * configure.ac (AC_CACHE_CHECK): Check for tm_gmtoff field in struct tm. (GM2_CHECK_LIB): Check for daylight, timezone and tzname. * libm2iso/wrapclock.cc (timezone): Guard against absence of struct tm and tm_gmtoff. (daylight): Check for daylight. (timezone): Check for timezone. (isdst): Check for isdst. (tzname): Check for tzname. (GetTimeRealtime): Check for struct timespec. (SetTimeRealtime): Check for struct timespec. (InitTimespec): Check for struct timespec. (KillTimespec): Check for struct timespec. (SetTimespec): Check for struct timespec. (GetTimespec): Check for struct timespec. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-08-06Daily bump.GCC Administrator1-0/+6
2023-08-05PR modula2/110779 SysClock can not read the clockGaius Mulley2-100/+281
This patch completes the implementation of the ISO module SysClock.mod. Three new testcases are provided. wrapclock.{cc,def} are new support files providing access to clock_settime, clock_gettime and glibc timezone variables. gcc/m2/ChangeLog: PR modula2/110779 * gm2-libs-iso/SysClock.mod: Re-implement using wrapclock. * gm2-libs-iso/wrapclock.def: New file. libgm2/ChangeLog: PR modula2/110779 * config.h.in: Regenerate. * configure: Regenerate. * configure.ac (GM2_CHECK_LIB): Check for clock_gettime and clock_settime. * libm2iso/Makefile.am (M2DEFS): Add wrapclock.def. * libm2iso/Makefile.in: Regenerate. * libm2iso/wraptime.cc: Replace HAVE_TIMEVAL with HAVE_STRUCT_TIMEVAL. * libm2iso/wrapclock.cc: New file. gcc/testsuite/ChangeLog: PR modula2/110779 * gm2/iso/run/pass/m2date.mod: New test. * gm2/iso/run/pass/testclock.mod: New test. * gm2/iso/run/pass/testclock2.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-08-02Daily bump.GCC Administrator1-0/+18
2023-08-02PR modula2/110161 Comparing a typed procedure variable to 0 gives ICE or ↵Gaius Mulley2-9/+35
assertion This patch allows a proc type to be compared against an address. gcc/m2/ChangeLog: PR modula2/110161 * gm2-compiler/M2Check.mod (checkProcTypeEquivalence): New procedure function. (checkTypeKindEquivalence): Call checkProcTypeEquivalence if either left or right is a proc type. * gm2-compiler/M2Quads.mod (BuildRelOp): Create combinedTok prior to creating the range check quadruple. Use combinedTok when creating the range check quadruple. gcc/testsuite/ChangeLog: PR modula2/110161 * gm2/pim/fail/badxproc.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-08-01PR modula2/110865 Unable to access copied const arrayGaius Mulley1-14/+15
This patch allows constants of an array type to be indexed. gcc/m2/ChangeLog: PR modula2/110865 * gm2-compiler/M2Quads.mod (BuildDesignatorArray): Rename t as type and d as dim. New variable result. Allow constants of an array type to be indexed. gcc/testsuite/ChangeLog: PR modula2/110865 * gm2/iso/pass/constvec.mod: New test. * gm2/iso/pass/constvec2.mod: New test. * gm2/iso/run/pass/constvec3.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-07-26Daily bump.GCC Administrator1-0/+31
2023-07-25PR modula2/110174 Bugfixes to M2GenGCC.mod:CodeInline preventing an ICEGaius Mulley12-122/+200
This patch calls skip_const_decl before chaining parameter values and ensures that all strings passed to build_stmt (..., ASM_EXPR, ...) are nul terminated. It also improves the accuracy of locations in function calls and asm statements. gcc/m2/ PR modula2/110174 * gm2-compiler/M2GCCDeclare.def (PromoteToCString): New procedure function. * gm2-compiler/M2GCCDeclare.mod (PromoteToCString): New procedure function. * gm2-compiler/M2GenGCC.mod (BuildTreeFromInterface): Call skip_const_decl before chaining the parameter value. Use PromoteToCString to ensure the string is nul terminated. (CodeInline): Remove all parameters and replace with quad. Use GetQuadOtok to get operand token numbers. Remove call to DeclareConstant and replace it with PromoteToCString. * gm2-compiler/M2Quads.def (BuildInline): Rename into ... (BuildAsm): ... this. * gm2-compiler/M2Quads.mod: (BuildInline): Rename into ... (BuildAsm): ... this. (BuildAsmElement): Add debugging. * gm2-compiler/P1Build.bnf: Remove import of BuildInline. * gm2-compiler/P2Build.bnf: Remove import of BuildInline. * gm2-compiler/P3Build.bnf: Remove import of BuildInline and import BuildAsm. * gm2-compiler/PHBuild.bnf: Remove import of BuildInline. * gm2-libs-iso/SysClock.mod (foo): Remove. * gm2-libs/FIO.mod (BufferedRead): Rename parameter a to dest. Rename variable t to src. * m2pp.cc (pf): Correct block comment. (pe): Correct block comment. (m2pp_asm_expr): New function. (m2pp_statement): Call m2pp_asm_expr. gcc/testsuite/ PR modula2/110174 * gm2/pim/pass/program2.mod: Remove import of BuildInline. * gm2/extensions/asm/fail/extensions-asm-fail.exp: New test. * gm2/extensions/asm/fail/stressreturn.mod: New test. * gm2/extensions/asm/pass/extensions-asm-pass.exp: New test. * gm2/extensions/asm/pass/fooasm.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-07-23Daily bump.GCC Administrator1-0/+15
2023-07-22PR modula2/110631 Bugfix to FIO WriteCardinalGaius Mulley2-30/+30
FIO.WriteCardinal fails to write binary data. This patch fixes two bugs in FIO.mod and provides a testcase which writes and reads binary cardinals. There was an off by one error when using HIGH (a) to determine the number of bytes and the dest/src pointers were switched when calling memcpy. gcc/m2/ChangeLog: PR modula2/110631 * gm2-libs/FIO.def (ReadAny): Correct comment as HIGH (a) + 1 is number of bytes. (WriteAny): Correct comment as HIGH (a) + 1 is number of bytes. * gm2-libs/FIO.mod (ReadAny): Correct comment as HIGH (a) + 1 is number of bytes. Also pass HIGH (a) + 1 to BufferedRead. (WriteAny): Correct comment as HIGH (a) + 1 is number of bytes. Also pass HIGH (a) + 1 to BufferedWrite. (BufferedWrite): Rename parameter a to src, rename variable t to dest. Correct parameter order to memcpy. gcc/testsuite/ChangeLog: PR modula2/110631 * gm2/pimlib/run/pass/testfiobinary.mod: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
2023-07-21Daily bump.GCC Administrator1-0/+21