From noreply at github.com Tue Dec 3 10:35:58 2019 From: noreply at github.com (peter mckinna) Date: Tue, 03 Dec 2019 01:35:58 -0800 Subject: [M3commit] [modula3/cm3] 693a53: Fix syntax errors for windows Message-ID: Branch: refs/heads/master Home: https://github.com/modula3/cm3 Commit: 693a5392915e3ca2d6d53acc4789beeee035c50a https://github.com/modula3/cm3/commit/693a5392915e3ca2d6d53acc4789beeee035c50a Author: Peter McKinna Date: 2019-12-03 (Tue, 03 Dec 2019) Changed paths: M m3-libs/m3core/src/coroutine/DUMMY/CoroutineDummy.m3 Log Message: ----------- Fix syntax errors for windows From noreply at github.com Fri Dec 6 23:46:36 2019 From: noreply at github.com (Rodney M. Bates) Date: Fri, 06 Dec 2019 14:46:36 -0800 Subject: [M3commit] [modula3/cm3] b2fa2c: Fixes to all-dynamic array constructors, found by ... Message-ID: Branch: refs/heads/packedVars Home: https://github.com/modula3/cm3 Commit: b2fa2cf4a9f7330a4c478324209cf3988dffadc5 https://github.com/modula3/cm3/commit/b2fa2cf4a9f7330a4c478324209cf3988dffadc5 Author: Rodney Bates Date: 2019-12-06 (Fri, 06 Dec 2019) Changed paths: M m3-sys/m3front/src/exprs/ArrayExpr.m3 M m3-sys/m3front/src/exprs/MethodExpr.m3 M m3-sys/m3front/src/misc/CG.i3 M m3-sys/m3front/src/misc/Error.i3 M m3-sys/m3front/src/types/RefType.m3 M m3-sys/m3front/src/types/Type.i3 M m3-sys/m3front/src/types/Type.m3 M m3-sys/m3front/src/values/Exceptionz.m3 Log Message: ----------- Fixes to all-dynamic array constructors, found by new tests. An all-dynamic (possibly multi-dimensioned) array constructor has a row of cousin elements, that are all open, and not statically constrained. This can only happen if all are at the same nesting depth, immediately below the deepest array constructor. From noreply at github.com Sun Dec 22 03:13:06 2019 From: noreply at github.com (Rodney M. Bates) Date: Sat, 21 Dec 2019 18:13:06 -0800 Subject: [M3commit] [modula3/cm3] 1a5db3: Add runtime test p268. Message-ID: Branch: refs/heads/packedVars Home: https://github.com/modula3/cm3 Commit: 1a5db30a718ef1d4942190068495b87c772f713f https://github.com/modula3/cm3/commit/1a5db30a718ef1d4942190068495b87c772f713f Author: Rodney Bates Date: 2019-12-21 (Sat, 21 Dec 2019) Changed paths: M m3-sys/m3tests/src/m3makefile A m3-sys/m3tests/src/p2/p268/Lib.i3 A m3-sys/m3tests/src/p2/p268/Main.m3 A m3-sys/m3tests/src/p2/p268/m3makefile A m3-sys/m3tests/src/p2/p268/m3overrides A m3-sys/m3tests/src/p2/p268/stderr.build A m3-sys/m3tests/src/p2/p268/stderr.pgm A m3-sys/m3tests/src/p2/p268/stdout.build A m3-sys/m3tests/src/p2/p268/stdout.pgm Log Message: ----------- Add runtime test p268. Test that non-assignable ordinal field values of a constant record constructor produce runtime errors when the constructor is used. From noreply at github.com Thu Dec 26 20:33:57 2019 From: noreply at github.com (Rodney M. Bates) Date: Thu, 26 Dec 2019 11:33:57 -0800 Subject: [M3commit] [modula3/cm3] b7389c: Add cases to test p268. Message-ID: Branch: refs/heads/packedVars Home: https://github.com/modula3/cm3 Commit: b7389c9ad2ed30b63949a1539a50e65af3d91378 https://github.com/modula3/cm3/commit/b7389c9ad2ed30b63949a1539a50e65af3d91378 Author: Rodney Bates Date: 2019-12-26 (Thu, 26 Dec 2019) Changed paths: M m3-sys/m3tests/src/p2/p268/Main.m3 M m3-sys/m3tests/src/p2/p268/stdout.build M m3-sys/m3tests/src/p2/p268/stdout.pgm Log Message: ----------- Add cases to test p268. Add uses of a constant record constructor with a non-assignable, (because it's nested) procedure field. All should warn about the constructor at compile time and abort when the constructor is used at runtime. - As default value of a formal parameter - As actual, passed READONLY - The bad field selected by '.' From noreply at github.com Thu Dec 26 20:54:49 2019 From: noreply at github.com (Rodney M. Bates) Date: Thu, 26 Dec 2019 11:54:49 -0800 Subject: [M3commit] [modula3/cm3] 7c8cd9: Add test p268, constant array constructors with RT... Message-ID: Branch: refs/heads/packedVars Home: https://github.com/modula3/cm3 Commit: 7c8cd9aaf41572ac19f2b440ccae788489829a5d https://github.com/modula3/cm3/commit/7c8cd9aaf41572ac19f2b440ccae788489829a5d Author: Rodney Bates Date: 2019-12-26 (Thu, 26 Dec 2019) Changed paths: M m3-sys/m3tests/src/m3makefile A m3-sys/m3tests/src/p2/p270/Lib.i3 A m3-sys/m3tests/src/p2/p270/Main.m3 A m3-sys/m3tests/src/p2/p270/m3makefile A m3-sys/m3tests/src/p2/p270/m3overrides A m3-sys/m3tests/src/p2/p270/stderr.build A m3-sys/m3tests/src/p2/p270/stderr.pgm A m3-sys/m3tests/src/p2/p270/stdout.build A m3-sys/m3tests/src/p2/p270/stdout.pgm Log Message: ----------- Add test p268, constant array constructors with RT assignability failures. Constant array constructors with not-assignable (by runtime assignability rules) element values were formally warning at compile time, but failing to abort at runtime. From noreply at github.com Thu Dec 26 23:06:08 2019 From: noreply at github.com (Rodney M. Bates) Date: Thu, 26 Dec 2019 14:06:08 -0800 Subject: [M3commit] [modula3/cm3] 6cb3f4: Fix more cases of compile time detectable runtime ... Message-ID: Branch: refs/heads/packedVars Home: https://github.com/modula3/cm3 Commit: 6cb3f4f80b1c2482d2a029d8fcfc867d2f72bc56 https://github.com/modula3/cm3/commit/6cb3f4f80b1c2482d2a029d8fcfc867d2f72bc56 Author: Rodney Bates Date: 2019-12-26 (Thu, 26 Dec 2019) Changed paths: M m3-sys/m3front/src/builtinOps/Last.m3 M m3-sys/m3front/src/exprs/ArrayExpr.m3 M m3-sys/m3front/src/exprs/ConsExpr.m3 M m3-sys/m3front/src/exprs/Expr.m3 M m3-sys/m3front/src/exprs/QualifyExpr.m3 M m3-sys/m3front/src/exprs/RecordExpr.m3 M m3-sys/m3front/src/exprs/SubscriptExpr.m3 M m3-sys/m3front/src/misc/Marker.m3 M m3-sys/m3front/src/stmts/AssignStmt.i3 M m3-sys/m3front/src/stmts/AssignStmt.m3 M m3-sys/m3front/src/stmts/WithStmt.m3 M m3-sys/m3front/src/types/ArrayType.i3 M m3-sys/m3front/src/types/OpenArrayType.i3 M m3-sys/m3front/src/types/OpenArrayType.m3 M m3-sys/m3front/src/values/Exceptionz.m3 M m3-sys/m3front/src/values/Formal.m3 M m3-sys/m3front/src/values/Variable.m3 Log Message: ----------- Fix more cases of compile time detectable runtime errors. Two categories: Consistify handling of assignment of nested procedures, to work like ordinal values, i.e., when statically detected, only warn, and generate runtime failures only if/when the subject code is executed. Add additional places where use of constant record/array constructors with non-assignable fields/elements produces runtime failures: Qualified expressions Subscripted values Return values Exception arguments With-bound values Default values of formals Actuals passed READONLY From noreply at github.com Thu Dec 26 23:53:28 2019 From: noreply at github.com (Rodney M. Bates) Date: Thu, 26 Dec 2019 14:53:28 -0800 Subject: [M3commit] [modula3/cm3] 090ed6: Add test p271. Message-ID: Branch: refs/heads/packedVars Home: https://github.com/modula3/cm3 Commit: 090ed682360b0b556a4e8e9bc88726fc26dee0df https://github.com/modula3/cm3/commit/090ed682360b0b556a4e8e9bc88726fc26dee0df Author: Rodney Bates Date: 2019-12-26 (Thu, 26 Dec 2019) Changed paths: M m3-sys/m3tests/src/m3makefile A m3-sys/m3tests/src/p2/p271/Main.m3 A m3-sys/m3tests/src/p2/p271/m3makefile A m3-sys/m3tests/src/p2/p271/m3overrides A m3-sys/m3tests/src/p2/p271/stderr.build A m3-sys/m3tests/src/p2/p271/stderr.pgm A m3-sys/m3tests/src/p2/p271/stdout.build A m3-sys/m3tests/src/p2/p271/stdout.pgm Log Message: ----------- Add test p271. Test that a global constant array constructor, passed READONLY, is passed by reference. This seems impossible to truly test, given some Modula3 type rules, This is a reasonable probabalistic test. From noreply at github.com Sun Dec 29 23:41:54 2019 From: noreply at github.com (Rodney M. Bates) Date: Sun, 29 Dec 2019 14:41:54 -0800 Subject: [M3commit] [modula3/cm3] ec63d9: Add andling of statically detectable CT errors to ... Message-ID: Branch: refs/heads/packedVars Home: https://github.com/modula3/cm3 Commit: ec63d9b510739e063e40610debb5c6810d625259 https://github.com/modula3/cm3/commit/ec63d9b510739e063e40610debb5c6810d625259 Author: Rodney Bates Date: 2019-12-29 (Sun, 29 Dec 2019) Changed paths: M m3-sys/m3front/src/exprs/SetExpr.m3 M m3-sys/m3front/src/stmts/AssignStmt.m3 M m3-sys/m3front/src/values/Constant.m3 M m3-sys/m3front/src/values/Formal.m3 M m3-sys/m3middle/src/M3CG_Check.m3 Log Message: ----------- Add andling of statically detectable CT errors to set constructors. Constant set constructors with (compile time detectable) non-assignable constant elements formerly warned but did not give errors, either at compile time or runtime. From noreply at github.com Mon Dec 30 00:33:15 2019 From: noreply at github.com (Rodney M. Bates) Date: Sun, 29 Dec 2019 15:33:15 -0800 Subject: [M3commit] [modula3/cm3] 80a700: Add test p272, on set constructors. Message-ID: Branch: refs/heads/packedVars Home: https://github.com/modula3/cm3 Commit: 80a700d383840d1e6fef19a4d45d4dff80a58c18 https://github.com/modula3/cm3/commit/80a700d383840d1e6fef19a4d45d4dff80a58c18 Author: Rodney Bates Date: 2019-12-29 (Sun, 29 Dec 2019) Changed paths: M m3-sys/m3tests/src/m3makefile A m3-sys/m3tests/src/p2/p272/Lib.i3 A m3-sys/m3tests/src/p2/p272/Main.m3 A m3-sys/m3tests/src/p2/p272/m3makefile A m3-sys/m3tests/src/p2/p272/m3overrides A m3-sys/m3tests/src/p2/p272/stderr.build A m3-sys/m3tests/src/p2/p272/stderr.pgm A m3-sys/m3tests/src/p2/p272/stdout.build A m3-sys/m3tests/src/p2/p272/stdout.pgm Log Message: ----------- Add test p272, on set constructors. Test set constructors with statically inevitable RT errors. From noreply at github.com Mon Dec 30 00:35:52 2019 From: noreply at github.com (Rodney M. Bates) Date: Sun, 29 Dec 2019 15:35:52 -0800 Subject: [M3commit] [modula3/cm3] f5b323: Correct build output for tests p268 and p270. Message-ID: Branch: refs/heads/packedVars Home: https://github.com/modula3/cm3 Commit: f5b3230c960bc4bdf3250b211ad7357be37c9221 https://github.com/modula3/cm3/commit/f5b3230c960bc4bdf3250b211ad7357be37c9221 Author: Rodney Bates Date: 2019-12-29 (Sun, 29 Dec 2019) Changed paths: M m3-sys/m3tests/src/p2/p268/stdout.build M m3-sys/m3tests/src/p2/p270/stdout.build Log Message: ----------- Correct build output for tests p268 and p270. From noreply at github.com Mon Dec 30 20:59:05 2019 From: noreply at github.com (Rodney M. Bates) Date: Mon, 30 Dec 2019 11:59:05 -0800 Subject: [M3commit] [modula3/cm3] 593df9: Add more cases to p268, p270, p272 Message-ID: Branch: refs/heads/packedVars Home: https://github.com/modula3/cm3 Commit: 593df9be5853dfa023f2796fa6e2a856dcb7e4e8 https://github.com/modula3/cm3/commit/593df9be5853dfa023f2796fa6e2a856dcb7e4e8 Author: Rodney Bates Date: 2019-12-30 (Mon, 30 Dec 2019) Changed paths: M m3-sys/m3tests/src/p2/p268/Main.m3 M m3-sys/m3tests/src/p2/p268/stdout.build M m3-sys/m3tests/src/p2/p268/stdout.pgm M m3-sys/m3tests/src/p2/p270/Main.m3 M m3-sys/m3tests/src/p2/p270/stdout.build M m3-sys/m3tests/src/p2/p270/stdout.pgm M m3-sys/m3tests/src/p2/p272/Main.m3 M m3-sys/m3tests/src/p2/p272/stdout.build M m3-sys/m3tests/src/p2/p272/stdout.pgm Log Message: ----------- Add more cases to p268, p270, p272 More cases for additional places a bad static constructur (i.e.,with runtime non-assignability to the constructor's type) could be used. Check that the constructors produce compile time warnings, and that these uses produce runtime errors: Subscripting, field selection, as RAISE argument, WITH-bound to, as RETURN value. From noreply at github.com Mon Dec 30 22:13:01 2019 From: noreply at github.com (Rodney M. Bates) Date: Mon, 30 Dec 2019 13:13:01 -0800 Subject: [M3commit] [modula3/cm3] f1eaf9: Minor cleanups, hopefully final, of the compile-ti... Message-ID: Branch: refs/heads/packedVars Home: https://github.com/modula3/cm3 Commit: f1eaf920a5551532080e66815af2c095a5765911 https://github.com/modula3/cm3/commit/f1eaf920a5551532080e66815af2c095a5765911 Author: Rodney Bates Date: 2019-12-30 (Mon, 30 Dec 2019) Changed paths: M m3-sys/m3front/src/misc/Marker.m3 M m3-sys/m3front/src/stmts/WithStmt.m3 M m3-sys/m3front/src/values/Exceptionz.m3 Log Message: ----------- Minor cleanups, hopefully final, of the compile-time/runtime thing: Some time ago, I wrote: > Consider: > TYPE Rng = [0 .. 10]; > VAR V: Rng := 17; > Ada explicitly mandates that (in equivalent code), a compiler may > issue a warning about the guaranteed range fault, but not a compile time > error, instead generating code that is sure to suffer a runtime error. > I have always been conflicted about what I think of this, but lean > towards just preferring the error to occur at compile time. > Modula3 says nothing about this distinction that I can find. CM3 > (and probably going back to SRC M3) does it the Ada way. However, > it's buggy. In this case: > TYPE Arr = ARRAY [0 .. 1] OF Rng; > CONST C = Arr {5, 11}; > where the actual assignment is done at compile time into a static, constant > data area, it gives the warning (produced by the same compiler code) but > no error. Instead, it silently stuffs invalid values into the constant area. > While reworking array constructors for packed elements, I would prefer to > fix this by just changing the warning to an error. It's less work, and > avoids duplicating the static range check, both code and execution. > Any opinions? The responses were 2 to 1 in favor of the current bahavior. Since then, I have noticed places in m3core and/or libm3 that depend on this behavior for code that is word-size-independent, and also places in ordsets and maybe vararray. So it seems to be the right way. However, we have an inconsistent mess about it. For one thing, the language definition isn't specific about this, not that I can interpret. As for the implementation, this is only done for ordinal types, and only in assignments and a proper subset of the other cases that require assignability. Assignability of procedures also haa s runtime assignability rule (it can't be nested) that can be sometimes but not always detected atatically. References can require a runtime narrow check, but the only reference value that is constant is NIL, and it will never fail the check. In addition, for record, set, and array constructors that are entirely constant, such assignability violations of components thereof (these can be detected statically) are only warned at compile time, but never raise runtime errors when used. So here is the uniform principle I propose: In 2.3.1, the definition of assignability of an expression to a variable requires "the value of e is a member of the type of v, is not a local procedure, and if it is an array, then it has the same shape as v." and, these "generally require runtime checks." I propose that an implementation is allowed (but not required) to issue a static error only if both of the following hold: 1) The violation is statically inevitable if the subject code is executed, and 2) The code is statically guaranteed to be executed in any main program or library that contains it. When 1) but not 2) holds, the compiler should issue a warning. The compiler must generate code that raises a runtime failure whenever 1) does not hold. I have changed the packedVars branch to follow this, consistently, I believe. Consider this case, in a global scope: VAR V := ARRAY [ 0 .. 5 ] OF [ 0 .. 10 ] { 25 , .. }; This case meets both criteria. Morever, portions of the runtime system are executed before their module's initialization (the only place the compiler could put a runtime abort) and depend instead on variables' being statically initialized. So it is not possible to always detect the failure at runtime. So I have made this a static error. From noreply at github.com Tue Dec 31 03:22:33 2019 From: noreply at github.com (Rodney M. Bates) Date: Mon, 30 Dec 2019 18:22:33 -0800 Subject: [M3commit] [modula3/cm3] 8b4f36: Make newly fixed runtime checks conditional on com... Message-ID: Branch: refs/heads/packedVars Home: https://github.com/modula3/cm3 Commit: 8b4f36526730f4a400a2c81c85236328d650e82b https://github.com/modula3/cm3/commit/8b4f36526730f4a400a2c81c85236328d650e82b Author: Rodney Bates Date: 2019-12-30 (Mon, 30 Dec 2019) Changed paths: M m3-sys/m3front/src/exprs/ArrayExpr.m3 M m3-sys/m3front/src/exprs/RecordExpr.m3 M m3-sys/m3front/src/exprs/SetExpr.m3 M m3-sys/m3front/src/stmts/AssignStmt.i3 M m3-sys/m3front/src/stmts/AssignStmt.m3 Log Message: ----------- Make newly fixed runtime checks conditional on compiler options. Relevant options are -NoNarrowChk and -NoRangeChk. These work, taked from Host.i3, doNarrowChk and doRangeChk, but these variables are not getting values through from the command line, probably the fault of some Quake code. Also, nested procedure and array shape checks are regarded as "narrow", which does not match the language definition of NARROW.