GithubHelp home page GithubHelp logo

modula3 / cm3 Goto Github PK

View Code? Open in Web Editor NEW
133.0 23.0 26.0 368.04 MB

Critical Mass Modula-3

Home Page: http://modula3.github.io/cm3/

License: Other

HTML 0.25% Makefile 3.22% Shell 1.18% C++ 3.13% C 65.12% Python 0.11% TeX 0.58% PostScript 0.08% Awk 0.06% Scheme 0.39% Pascal 0.01% Perl 0.21% JavaScript 0.01% LSL 0.02% SystemVerilog 0.01% Emacs Lisp 0.16% Objective-C 0.03% Assembly 25.34% OCaml 0.08% XS 0.04%

cm3's Introduction

This is the root of the Critical Mass Modula-3 Software Distribution.
It may be freely distributed as open source according to the various
copyrights under which different parts of the sources are placed.
Please read the COPYRIGHT-* files found in this directory.

To build everything, go to the `scripts` directory.
Before trying anything there, you need to download
a working compiler for your system;
you can obtain one by clicking on the `Releases` tab on the main Github page
and selecting one for your architecture.

The `README` in the `scripts` directory describes several options.
The `scripts` directory also contains a subdirectory of Python scripts
for those who prefer or need it.

The base system can be found in several packages in the collections
m3-sys and m3-libs. All the rest is more or less optional. Complete
documentation in HTML and other formats can be found in the doc
sub-directory.


cm3's People

Contributors

brakmic avatar coder5506 avatar darko20 avatar demoitem avatar dragisha avatar eiserlohpp avatar hosking avatar jaykrell avatar maseh87 avatar mikanystrom avatar mikanystrom-intel avatar olaf-wagner avatar orlandodilasso avatar redfoxymoon avatar rillig avatar rodneybates avatar victormiasnikov avatar waywardmonkeys avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cm3's Issues

More build detail needed

I would like to build a cm3. I can run do-cm3-front.sh buildglobal ok. When I try to use the cm3 that this script generated (in a separate directory) with the script do-cm3-base.sh buildglobal I get

bad M3CG version stamp (0x110), expected 0x100

Surely there must be a straightforward way to build a system, but I sure don't see any documentation on how to do it. Until I can build a system I will use the elegosoft 2010 version, which has some problems, but there are workarounds. Please supply a little more info on how to build a system.

Thanks -- Doug


compiler is really too slow

We need to figure out the bottlenecks and speed it up.

multi-thread/proc?
batch up cm3cg/as invocations / .ms file content?
Too much autoconf-within-quake (I see fgrep).

m3core takes 18 seconds to compile. Let's try to get it to 10?
Best bet might be entire library at once in one .ms file.
And similar for the .c files.

macOS: Compilation problems & solutions

Hi,

Almost exactly a year ago I opened an Issue documenting my problems with compilation under macOS Mojave 10.14.1 (x64).

Thankfully, @mikanystrom helped me a lot so that in the end I was able to build a package that is still available for download from my server. Malware reports are available as well, so you can be sure everything is clean.

Now, I have tried to do the same for macOS Catalina 10.15.3 (x64). For this I used the currently available master sources and the bootstrap compiler was the one I built previously.

This time the compilation was much easier to accomplish and the few packages I had to remove from pkginfo.txt were a no-brainer. Here's a patch if you like to do the same on your local source.

The affected files are:

newuoa caltech-other
magicextras caltech-other
boxes caltech-other
simplegrid caltech-other
router caltech-other
router-pauls caltech-other
router-pauls3 caltech-other
router-pauls4 caltech-other
gentest caltech-other
magraster caltech-other
mscheme m3-scheme
modula3scheme m3-scheme
schemereadline m3-scheme
mscheme-interactive m3-scheme
mscheme-interactive_r m3-scheme

The error messages I got when trying to compile those files were something like this:

== package /Users/brakmic/projects/cm3/caltech-other/gentest ==

 +++ /usr/local/cm3/bin/cm3    -build -override -DROOT=/Users/brakmic/projects/cm3 +++
--- building in AMD64_DARWIN ---

unable to read ../src/m3overrides, options "-override" and "-x" ignored.
"/Users/brakmic/projects/cm3/caltech-other/gentest/src/m3makefile", line 4: quake runtime error: unable to open "/usr/local/cm3/pkg/router/AMD64_DARWIN/.M3EXPORTS" for reading

--procedure--  -line-  -file---
import             --  <builtin>
include_dir         4  /Users/brakmic/projects/cm3/caltech-other/gentest/src/m3makefile
                    5  /Users/brakmic/projects/cm3/caltech-other/gentest/AMD64_DARWIN/m3make.args

Fatal Error: package build failed
 *** execution of [<function _BuildLocalFunction at 0x104699848>] failed ***

The m3-scheme-files, however, would actually compile at first, but when I later tried to build a package with do-cm3-all.py buildship errors like these were thrown:

****  PARALLEL BACK-END BUILD, M3_PARALLEL_BACK = 20
 -> archiving libscheme-lib.a
 ==> /Users/brakmic/projects/cm3/m3-scheme/scheme-lib done

== package /Users/brakmic/projects/cm3/m3-scheme/mscheme ==

 +++ /usr/local/cm3/bin/cm3    -build -override -DROOT=/Users/brakmic/projects/cm3 +++
--- building in AMD64_DARWIN ---

"/Users/brakmic/projects/cm3/m3-scheme/mscheme/AMD64_DARWIN/../src/m3overrides", line 2: quake runtime error: unable to open "/Users/brakmic/projects/cm3/m3-scheme/mscheme/AMD64_DARWIN/../src/../../m3overrides" for reading

--procedure--  -line-  -file---
include            --  <builtin>
                    2  /Users/brakmic/projects/cm3/m3-scheme/mscheme/AMD64_DARWIN/../src/m3overrides

Fatal Error: package build failed
 *** execution of [<function _BuildLocalFunction at 0x106150848>] failed ***

So I removed them from pkginfo.txt as well.

The packages are available for download from my server. Have fun!




Regards

Array initialization

Hello

The Modula-3 Language Reference states of NEW: (emphasis added)

If T is a reference to an array with k open dimensions, the NEW operation has the form:

NEW(T, n_1, ..., n_k)

where the n's are integer-valued expressions that specify the lengths of the new array in its first k dimensions. The values in the array will be arbitrary values of their type.

I emphasize the last sentence because CM3 apparently initializes the array's values, even with -O3 enabled. I've tested this creating large array of INTEGERs and summing its values. The sum is always 0.

I don't want an array initialized to 0. Is there some way to disable this feature?

Q: how to compile hello world with MinGW or Cygwin on Windows?

I downloaded multiple ZIP packed releases for Windows and I see there in the bin\config folder targets like "I386_MINGW" and "I386_CYGWIN". An attempt to build hello world showed me that only "AMD64_NT" is supported in those ZIP releases. Also I see just pkg\cm3\NT386... So my questions are:

  • are mingw, cygwin supported in Windows?
  • if yes, what release should be downloaded (URL please)?
  • or maybe I need to set something in makefile to do it?

I tried cm3 -DTARGET=I386_MINGW ... but it did not help.

subarray error crashes frontend

Compiling the following fragment

TYPE K = ARRAY[0..100] OF CHAR;
VAR kt : K;
SUBARRAY(kt,1,10) := SUBARRAY(2,10);

with the typo that the first parm kt is omitted from the second SUBARRAY
produces the correct error message

new source -> compiling Main.m3
"../src/Main.m3", line 38: too few arguments: M3_BUILTIN.SUBARRAY
"../src/Main.m3", line 38: SUBARRAY: first argument must be an array

but then crashes


*** runtime error:
*** <ASSERT> failed.
*** file "../src/exprs/Expr.m3", line 398


Building for Win64 with VS2017

Hello everyone,

Is it possible to build an x64 version for Win10x64 + Visual Studio 2017?
I could create C sources with ./boot1.py AMD64_NT but I don't know how to build them under VS2017.
I had also tested the Windows Batch-Scripts from scripts/win but there I've got the error that the only supported archs were NT386 and GNU386.

Kind regards,

Status of CM3 development

Is the transition from CVS to GIT for the CM3 repository still going to happen?

What is the status of CM3 in general?
The website doesn't seem to be getting updating at all.

Will there ever be another release?

Debug info for LONGCARD

In the M3 IR below the local ccc is declared as CARDINAL
and is declared with the builtin uid for the type but
the local lll is a LONGCARD and is declared as a subrange without a typename
to accompany it. The uid is correct but I think it should not have the subrange declaration

declare_local	 ccc 8 8 Word.64 -1746782238 F F 50 v.16
declare_subrange	 -1662175513 89530742 0 9223372036854775807 64
declare_local	 lll 8 8 Word.64 -1662175513 F F 50 v.17

Win 10 x64: Warning LNK4022: cannot find match for _xmm and _OptionsStorage

I'm trying to build from your current sources. The compiler for boostrapping is from here: https://modula3.elegosoft.com/cm3/snaps/cm3-bin-core-NT386-d5.9.0-i686-pc-cygwin-2011-06-16-11-34-26.tgz

Sadly, there are some symbols missing. '_xmm' and '_OptionsStorage'.

I googled a bit and found an entry related to this issue from your mailing list: https://mail.elegosoft.com/pipermail/m3devel/2013-August/010720.html

Before posting here I double-checked everything:

a) I'm running Win 10 x64 but the MSVC toolchain is set to 32bit with:

cmd /k ""C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"" x86

b) Also I tried to prepare everything for Unicode by following the README from here: https://github.com/modula3/cm3/blob/master/scripts/README-build-unicode

But this was equally unsuccessful.

I received errors like these here:

   Creating library sysutils.lib and object sysutils.exp
LINK : warning LNK4199: /DELAYLOAD:advapi32.dll ignored; no imports found from advapi32.dll
LINK : warning LNK4199: /DELAYLOAD:gdi32.dll ignored; no imports found from gdi32.dll
LINK : warning LNK4199: /DELAYLOAD:netapi32.dll ignored; no imports found from netapi32.dll
LINK : warning LNK4199: /DELAYLOAD:user32.dll ignored; no imports found from user32.dll
LINK : warning LNK4199: /DELAYLOAD:comctl32.dll ignored; no imports found from comctl32.dll
LINK : warning LNK4199: /DELAYLOAD:rpcrt4.dll ignored; no imports found from rpcrt4.dll
LINK : warning LNK4199: /DELAYLOAD:iphlpapid.dll ignored; no imports found from iphlpapid.dll
SystemC.obj : error LNK2019: unresolved external symbol __imp___errno referenced in function _System__GetErrno
TextUtils.mo : error LNK2001: unresolved external symbol __setjmp
msvcrt.lib(_setjmp.obj) : error LNK2001: unresolved external symbol __setjmp
Confirmation.mo : error LNK2001: unresolved external symbol __setjmp
DirStack.mo : error LNK2001: unresolved external symbol __setjmp
ConnectRdWr.mo : error LNK2001: unresolved external symbol __setjmp
FSysWin32.mo : error LNK2001: unresolved external symbol __setjmp
System.mo : error LNK2001: unresolved external symbol __setjmp
PathReprCommon.mo : error LNK2001: unresolved external symbol __setjmp
TextReadingUtils.mo : error LNK2001: unresolved external symbol __setjmp
FastLex.mo : error LNK2001: unresolved external symbol __setjmp
EnvUtils.mo : error LNK2001: unresolved external symbol __setjmp
FSUtils.mo : error LNK2001: unresolved external symbol __setjmp
SMsg.mo : error LNK2001: unresolved external symbol __setjmp
MsgIF.mo : error LNK2001: unresolved external symbol __setjmp
FSUnixC.obj : error LNK2019: unresolved external symbol __imp___access referenced in function _FSUtils__access
msvcrt.lib(_setjmp.obj) : error LNK2001: unresolved external symbol ___intrinsic_setjmp
msvcrt.lib(dll_dllmain.obj) : error LNK2019: unresolved external symbol __initterm referenced in function "int __cdecl dllmain_crt_process_attach(struct HINSTANCE__ * const,void * const)" (?dllmain_crt_process_attach@@YAHQAUHINSTANCE__@@QAX@Z)
msvcrt.lib(dll_dllmain.obj) : error LNK2019: unresolved external symbol __initterm_e referenced in function "int __cdecl dllmain_crt_process_attach(struct HINSTANCE__ * const,void * const)" (?dllmain_crt_process_attach@@YAHQAUHINSTANCE__@@QAX@Z)
msvcrt.lib(dll_dllmain.obj) : error LNK2019: unresolved external symbol ___telemetry_main_invoke_trigger referenced in function "int __cdecl dllmain_dispatch(struct HINSTANCE__ * const,unsigned long,void * const)" (?dllmain_dispatch@@YAHQAUHINSTANCE__@@KQAX@Z)
msvcrt.lib(dll_dllmain.obj) : error LNK2019: unresolved external symbol ___telemetry_main_return_trigger referenced in function "int __cdecl dllmain_dispatch(struct HINSTANCE__ * const,unsigned long,void * const)" (?dllmain_dispatch@@YAHQAUHINSTANCE__@@KQAX@Z)
msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol __seh_filter_dll referenced in function ___scrt_dllmain_exception_filter
msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol __initialize_narrow_environment referenced in function ___scrt_dllmain_after_initialize_c
msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol __initialize_onexit_table referenced in function ___scrt_initialize_onexit_tables
msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol __register_onexit_function referenced in function __onexit
msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol __execute_onexit_table referenced in function ___scrt_dllmain_uninitialize_c
msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol __crt_atexit referenced in function __onexit
msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol __crt_at_quick_exit referenced in function _at_quick_exit
msvcrt.lib(utility.obj) : error LNK2019: unresolved external symbol __cexit referenced in function ___scrt_dllmain_uninitialize_c
msvcrt.lib(tncleanup.obj) : error LNK2019: unresolved external symbol ___std_type_info_destroy_list referenced in function "void __cdecl __scrt_uninitialize_type_info(void)" (?__scrt_uninitialize_type_info@@YAXXZ)
msvcrt.lib(utility_desktop.obj) : error LNK2019: unresolved external symbol _terminate referenced in function ___scrt_unhandled_exception_filter@4
msvcrt.lib(utility_desktop.obj) : error LNK2019: unresolved external symbol _memset referenced in function ___scrt_fastfail
msvcrt.lib(_chandler4gs_.obj) : error LNK2019: unresolved external symbol __except_handler4_common referenced in function __except_handler4
sysutils.dll : fatal error LNK1120: 20 unresolved externals

I've tried Batch and Python-Scripts. I'm using Anaconda Package which provides a complete Python env. Version 2.7.11

Here's the error message I get when executing python upgrade.py

Microsoft (R) Incremental Linker Version 14.00.23506.0
Copyright (C) Microsoft Corporation.  All rights reserved.

-nodefaultlib 
-debug 
-incremental:no 
-opt:ref 
-delayload:ws2_32.dll 
-delayload:advapi32.dll 
-delayload:gdi32.dll 
-delayload:netapi32.dll 
-delayload:user32.dll 
-delayload:comctl32.dll 
-delayload:rpcrt4.dll 
-delayload:iphlpapid.dll 
delayimp.lib 
-def:m3core.def 
-dll 
-out:m3core.dll 
hand.obj 
dtoa.obj 
libgcc.obj 
RTHooks.io 
RTHooks.mo 
RT0.io 
RT0.mo 
RuntimeError.io 
RuntimeError.mo 
Compiler.io 
Compiler.mo 
RTAllocator.io 
RTAllocator.mo 
RTAllocCnts.io 
RTAllocStats.io 
RTAllocStats.mo 
RTHeap.io 
RTHeap.mo 
RTHeapInfo.io 
RTHeapInfo.mo 
RTHeapMap.io 
RTHeapMap.mo 
RTHeapRep.io 
RTHeapRep.mo 
RTHeapStats.io 
RTHeapStats.mo 
RTCollector.io 
RTCollector.mo 
RTCollectorSRC.io 
RTWeakRef.io 
RTIO.io 
RTIO.mo 
RTIOc.obj 
RTLinkerX.io 
RTLinker.io 
RTLinker.mo 
RTLinkerC.obj 
RTDebug.io 
RTDebug.mo 
RTDebugC.obj 
RTError.io 
RTError.mo 
RTException.io 
RTException.mo 
RTMapOp.io 
RTMapOp.mo 
RTMisc.io 
RTMisc.mo 
RTMiscC.obj 
RTModule.io 
RTPacking.io 
RTPacking.mo 
RTParams.io 
RTParams.mo 
RTProcedure.io 
RTProcedure.mo 
RTProcess.io 
RTProcess.mo 
RTProcessC.obj 
RTThread.io 
RTTipe.io 
RTTipe.mo 
RTType.io 
RTType.mo 
RTTypeFP.io 
RTTypeFP.mo 
RTTypeMap.io 
RTTypeMap.mo 
RTutils.io 
RTutils.mo 
RTHeapDebug.io 
RTHeapDebug.mo 
RTArgs.io 
RTHeapEvent.io 
RTProcedureSRC.io 
RTSignal.io 
RTStack.io 
RTTypeSRC.io 
RTOS.io 
RTMachine.io 
RTArgs.mo 
RTOS.mo 
RTPerfTool.io 
RTPerfTool.mo 
RTOSc.obj 
RTSignal.mo 
RTMachInfo.io 
RTMachInfo.mo 
RTExFrame.mo 
RTStackC.obj 
Thread.io 
ThreadF.io 
Scheduler.io 
ThreadDebug.io 
ThreadDebug.obj 
MutexRep.io 
ThreadEvent.io 
ThreadContext.io 
ThreadWin32.io 
ThreadWin32.mo 
ThreadWin32C.obj 
WinBaseTypes.io 
WinDef.io 
WinDef.mo 
WinNT.io 
WinNT.mo 
WinError.io 
WinBase.io 
WinCon.io 
WinGDI.io 
WinIoctl.io 
WinIoctl.mo 
WinNetwk.io 
WinNLS.io 
WinReg.io 
WinReg.mo 
WinSock.io 
WinSock.mo 
WinUser.io 
WinVer.io 
WinVer.mo 
NB30.io 
NB30.mo 
CDErr.io 
CommDlg.io 
TlHelp32.io 
WinMidi.io 
WinCommCtrl.io 
WinTabCon.io 
WinListView.io 
WinImageList.io 
WinNTc.obj 
WinGDI.mo 
WinUser.mo 
WinUserC.obj 
WinTabCon.mo 
WinListView.mo 
WinImageList.mo 
UtimeC.obj 
UnixC.obj 
UnixLink.obj 
Uexec.io 
Uexec.obj 
Unetdb.io 
Unetdb.obj 
Umman.obj 
Ugrp.io 
Ugrp.obj 
Uin.obj 
Uugid.obj 
Uuio.obj 
Uutmp.obj 
Usignal.obj 
Upwd.obj 
Uprocess.obj 
Usignal.io 
Uconstants.obj 
Uutmp.io 
Umman.io 
Uuio.io 
Upwd.io 
Uugid.io 
Uprocess.io 
Unix.io 
Unix.mo 
Utime.io 
Utypes.io 
Uerror.io 
Usched.io 
Usocket.io 
Usocket.obj 
Ustat.io 
Udir.io 
UdirC.obj 
Uin.io 
Cerrno.io 
Cstddef.io 
Cstdint.io 
Cstdlib.io 
CstdlibC.obj 
Ctypes.io 
M3toC.io 
M3toC.mo 
CerrnoC.obj 
Cstring.io 
CstringC.obj 
Cstdio.io 
CstdioC.obj 
Csignal.io 
CsignalC.obj 
Csetjmp.io 
CsetjmpC.obj 
BasicCtypes.io 
FPU.io 
RealFloat.io 
LongFloat.io 
ExtendedFloat.io 
IEEESpecial.io 
IEEESpecial.mo 
Real.mo 
LongReal.mo 
Extended.mo 
DragonInt.io 
DragonInt.mo 
DragonT.io 
DragonT.mo 
FloatMode.io 
FloatMode.mo 
Real.io 
LongReal.io 
Extended.io 
RealFloat.mo 
LongFloat.mo 
ExtendedFloat.mo 
RealRep.io 
LongRealRep.io 
Time.io 
Tick.io 
Date.io 
FmtTime.io 
FmtTime.mo 
TickPortable.mo 
TimeWin32.io 
Time.mo 
DateWin32.mo 
TimeWin32.obj 
CConvert.io 
CConvert.mo 
Convert.io 
Convert.mo 
String8.io 
String8.mo 
String16.io 
String16.mo 
Text.io 
Text.mo 
TextClass.io 
TextClass.mo 
TextLiteral.io 
TextLiteral.mo 
Text8.io 
Text8.mo 
Text8Short.io 
Text8Short.mo 
Text8CString.io 
Text8CString.mo 
Text16.io 
Text16.mo 
Text16Short.io 
Text16Short.mo 
TextSub.io 
TextSub.mo 
TextCat.io 
TextCat.mo 
TextStats.io 
TextStats.mo 
TextConv.io 
TextConv.mo 
Fingerprint.io 
Fingerprint.mo 
Poly.io 
Poly.mo 
PolyBasis.io 
PolyBasis.mo 
Main.io 
WeakRef.io 
WeakRef.mo 
WordRep.io 
Word.io 
LongRep.io 
Long.io 
Word.mo 
Long.mo 
Boolean.io 
Boolean.mo 
Char.io 
Char.mo 
Int32.io 
Int32.mo 
Int64.io 
Int64.mo 
Integer.io 
Integer.mo 
Longint.io 
Longint.mo 
Refany.io 
Refany.mo 
ASCII.io 
ASCII.mo 
WideChar.io 
WideChar.mo 
Unicode.io 
Unicode.mo 
Address.io 
Address.mo 
iphlpapi.lib 
rpcrt4.lib 
winspool.lib 
comctl32.lib 
ws2_32.lib 
comdlg32.lib 
netapi32.lib 
gdi32.lib 
user32.lib 
advapi32.lib 
kernel32.lib 
msvcrt.lib 
m3core.def : warning LNK4022: cannot find unique match for symbol '_xmm'
m3core.def : warning LNK4002: __xmm@41f00000000000000000000000000000 defined in dtoa.obj
m3core.def : warning LNK4002: __xmm@80000000000000008000000000000000 defined in dtoa.obj
m3core.def : error LNK2001: unresolved external symbol " ?? _OptionsStorage" (?_OptionsStorage)
m3core.def : error LNK2001: unresolved external symbol _xmm
m3core.lib : fatal error LNK1120: 2 unresolved externals

How to build from scratch?

Every one of the scripts seems to try to run "cm3" at some point. I have no cm3. I have no Modula-3 compiler of any sort. How do I build one?

Variable initialization

The language definition says initial values in variable declarations are a shorthand for assignments inserted “at the beginning of the executable part of the block” “in the order they are declared”.

The following declarations don’t achieve the expected result.

VAR
  x1 := y1 + 3;
  y1 := -1;
  x2 := y2 + 3;
  y2 := TRUNC(cos(Pi));

At the beginning of the block, x2 will be 3 as expected, but x1 will have value 2.

How does one build?

Reading various issues here, I have the impression that make-dist.py in the scripts/python directory should build the system. But when I try to run that, I get the following response:

fatal error environment variable CM3_INSTALL not set AND cm3 not found in PATH; please fix

According to the README in the scripts directory, I should be able to install the compiler using do-cm3-core.sh. Alas, that gives me the following error:

/bin/sh: cm3: command not found

This suggests I have to have the compiler built before I can build it. That can't be right. So how do I build it?

Typechecker divergence

I’m trying to build a project of mine that contains something like the following.

INTERFACE AbsType; TYPE T <: ROOT; END AbsType.

INTERFACE AbsTypeRep;
  IMPORT AbsType;
  REVEAL AbsType.T <: Rep;
  TYPE Rep = AbsType.T OBJECT END;
  PROCEDURE proc (obj: T);
END AbsTypeRep.

MODULE AbsType EXPORTS AbsType, AbsTypeRep;
  REVEAL T = Rep BRANDED OBJECT END;
  PROCEDURE proc (<*UNUSED*> obj: T) = BEGIN END proc;
BEGIN
END AbsType.

The compiler enters into an infinite loop while compiling AbsType.m3. Here’s one of the possible stacks traces.

--- building in ..\NT386 ---

new source -> compiling AbsType.i3
new source -> compiling AbsTypeRep.i3
new source -> compiling AbsType.m3


***
*** runtime error:
***    A runtime error occurred.
***    pc = 0xc21fe0 = Equal in ..\src\types\Brand.m3
***

Stack trace:
   FP         PC      Procedure
---------  ---------  -------------------------------
  0x92fec   0xe0659b  SystemError + 0x64 in ..\src\runtime\NT386\RTSignal.m3
  0x9303c   0xc21fe0  GenFPrint + 0x463 in ..\src\types\Brand.m3
  0x93078   0xbf9cf0  IsEqual + 0x2d5 in ..\src\types\Type.m3
  0x930ac   0xbf9ead  IsSubtype + 0x132 in ..\src\types\Type.m3
  0x93118   0xc672a3  Subtyper + 0x6e in ..\src\types\OpaqueType.m3
  0x93148   0xbf9f12  IsSubtype + 0x197 in ..\src\types\Type.m3
  0x93180   0xc5abb4  Subtyper + 0x19e in ..\src\types\ObjectType.m3
  0x931b0   0xbf9f12  IsSubtype + 0x197 in ..\src\types\Type.m3
  0x9321c   0xc6735c  Subtyper + 0x127 in ..\src\types\OpaqueType.m3
  0x9324c   0xbf9f12  IsSubtype + 0x197 in ..\src\types\Type.m3
.........  .........  ... more frames ...

If the redundant revelation AbsType.T <: Rep is removed in AbsTypeRep.i3, the compiler crashes when compiling from scratch, but subsequent runs are fine.

--- building in NT386 ---

new source -> compiling AbsType.i3
new source -> compiling AbsTypeRep.i3
new source -> compiling AbsType.m3
new exporters -> recompiling AbsTypeRep.i3


***
*** runtime error:
***    A runtime error occurred.
***    pc = 0xdc9d14 = KeyHash + 0xa in ..\NT386\IntRefTbl.m3 => ..\src\table\Table.mg
***

Stack trace:
   FP         PC      Procedure
---------  ---------  -------------------------------
  0x92fec   0xe0659b  SystemError + 0x64 in ..\src\runtime\NT386\RTSignal.m3
  0x9300c   0xdc9d14  KeyHash + 0xa in ..\NT386\IntRefTbl.m3 => ..\src\table\Table.mg
  0x93048   0xdc949b  Get + 0x74 in ..\NT386\IntRefTbl.m3 => ..\src\table\Table.mg
  0x9308c   0xb1e0bb  Pass0_FindMagic + 0xbe in ..\src\Builder.m3
  0x930e4   0xc5b918  FindMagic + 0x19c in ..\src\types\ObjectType.m3
  0x93130   0xc5b944  FindMagic + 0x1c8 in ..\src\types\ObjectType.m3
  0x9317c   0xc5b944  FindMagic + 0x1c8 in ..\src\types\ObjectType.m3
  0x931c8   0xc5b944  FindMagic + 0x1c8 in ..\src\types\ObjectType.m3
  0x93214   0xc5b944  FindMagic + 0x1c8 in ..\src\types\ObjectType.m3
  0x93260   0xc5b944  FindMagic + 0x1c8 in ..\src\types\ObjectType.m3
.........  .........  ... more frames ...

(According to my compiler its version is d5.10.0 and it was last updated 2015-05-21. I built it this January.)

Conversion problem with C backend

SHA256.m3.cpp:2369:763: error: narrowing conversion of ‘3144134277’ from ‘long int’ to ‘INT32’ {aka ‘int’} inside { } [-Wnarrowing]
'e','f'},{0 /* 1 / ,0 / 2 / ,0 / 3 / ,0 / 4 / ,0 / 5 / ,0 / 6 */ ,}};

This error is being generated by the C backend. The C code generated for this module used to work, back when
the generated file had a c suffix. I think it is generating the wrong type. The INT32 should be UINT32 or similar.

Those values are perfectly correct for unsigned 32 bit vars.

Building on macOS Mojave 10.14.3 fails at recompiling HMTime.i3

Hi everyone,

I'm trying to compile an AMD64_DARWIN release on my Mac but it always stops at this step:

new exporters -> recompiling HMTime.i3
 -> archiving libcit_util.a
Undefined symbols for architecture x86_64:
  "_UtimeOpsC__delete_T", referenced from:
      _UtimeWrap__delete_T in UtimeWrap_m.o
  "_UtimeOpsC__make_T", referenced from:
      _UtimeWrap__make_T in UtimeWrap_m.o
  "_UtimeOpsC__check_types", referenced from:
      _UtimeOpsC_M3 in UtimeOpsC_m.o
  "_UtimeOpsC__Get_second", referenced from:
      _TZ__Localtime in TZ_m.o
  "_UtimeOpsC__Get_minute", referenced from:
      _TZ__Localtime in TZ_m.o
  "_UtimeOpsC__Get_hour", referenced from:
      _TZ__Localtime in TZ_m.o
  "_UtimeOpsC__Get_month", referenced from:
      _TZ__Localtime in TZ_m.o
  "_UtimeOpsC__Get_year", referenced from:
      _TZ__Localtime in TZ_m.o
  "_UtimeOpsC__mktime", referenced from:
      _TZ__Mktime in TZ_m.o
  "_UtimeOpsC__Get_wday", referenced from:
      _TZ__Localtime in TZ_m.o
  "_UtimeOpsC__Set_second", referenced from:
      _TZ__Mktime in TZ_m.o
      _TZ__Localtime in TZ_m.o
  "_UtimeOpsC__Set_day", referenced from:
      _TZ__Mktime in TZ_m.o
  "_UtimeOpsC__Get_gmtoff", referenced from:
      _TZ__Localtime in TZ_m.o
  "_UtimeOpsC__Set_month", referenced from:
      _TZ__Mktime in TZ_m.o
  "_CTZ__setTZ", referenced from:
      _TZ__SetCurTZ in TZ_m.o
      _TZ_M3 in TZ_m.o
  "_UtimeOpsC__Get_zone", referenced from:
      _UCTime__ctime in UCTime_m.o
      _TZ__Localtime in TZ_m.o
  "_UtimeOpsC__write_double_clock", referenced from:
      _UCTime__ctime in UCTime_m.o
  "_UtimeOpsC__Set_year", referenced from:
      _TZ__Mktime in TZ_m.o
  "_UtimeOpsC__Set_minute", referenced from:
      _TZ__Mktime in TZ_m.o
  "_UtimeOpsC__ctime_r", referenced from:
      _UCTime__ctime in UCTime_m.o
  "_UtimeOpsC__Get_day", referenced from:
      _TZ__Localtime in TZ_m.o
  "_UtimeOpsC__localtime_r", referenced from:
      _UCTime__ctime in UCTime_m.o
      _TZ__Mktime in TZ_m.o
      _TZ__Localtime in TZ_m.o
  "_UtimeOpsC__Set_hour", referenced from:
      _TZ__Mktime in TZ_m.o
  "_diskAvail", referenced from:
      _SysPerf__DiskAvail in SysPerf_m.o
  "_getloadavg_glue", referenced from:
      _SysPerf__GetLoadAvg in SysPerf_m.o
  "_printf_prints", referenced from:
      _RTRefStats__Visit in RTRefStats_m.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
  make_lib => 1
librarian failed building: cit_util
Fatal Error: package build failed
 *** execution of [<function _BuildGlobalFunction at 0x10f6b87d0>, <function _ShipFunction at 0x10f6b8848>] failed ***
ERROR: ./do-cm3-all.py buildship

I've properly setup the environment, with the latest available x64 compiler release for macOS. I've used boot2.py from scripts/python directory to kickoff the compilation.

I'm not sure if there are any alternative ways to compile the toolchain.

Kind regards,

Array constructor copy size seems wrong

This small program extracted from p277 VArrsInArr causes a segv using the llvm backend, yet the m3cc backend seems
to work for unknown reason. Stepping through the code in assembly causes gdb to complain about the stack being smashed or corrupted.

I think the size of the copy is too large for each array element being initialised.

MODULE Main ;
IMPORT IO;
TYPE
Rng = [0 .. 31];
Arr = ARRAY [0 .. 3] OF BITS 5 FOR Rng;

CONST A1C = Arr{1, 4, 7, 10};
VAR A1V := A1C;
CONST A2C = Arr{9, 6, 3, 0};
VAR A2V := A2C;
CONST A3C = Arr{2, 5, 8, 11};
VAR A3V := A3C;

VAR
return : INTEGER;

PROCEDURE V () : INTEGER =
VAR
Loc := ARRAY [1 .. 3] OF Arr{A1V , A2V , A3V}; <------- problem here
BEGIN
(*
Loc := ARRAY [1 .. 3] OF Arr{A1V, A2V, A3V};
*)
RETURN 0;
END V;

BEGIN
return := V();
END Main.

This is the generated M3 IR

begin_unit	 0
widechar_size	 16
				-----FILE ../src/Main.m3  -----
				-----LINE 4  -----
# module global constants
declare_segment	 * -1 T v.1
# module global data
declare_segment	 M_Main -1 F v.2
				-----LINE 32  -----
declare_procedure	 Main_M3 1 Addr 0 0 T * p.1
declare_param	 mode 8 8 Int.64 425470580 F F 100 v.3
declare_subrange	 765876253 425470580 0 31 8
declare_subrange	 -1993854505 425470580 0 3 8
declare_packed	 2086536086 5 765876253
declare_array	 1916360575 -1993854505 2086536086 32
declare_proctype	 -291811747 0 425470580 0 0
declare_subrange	 -1993854761 425470580 1 3 8
declare_array	 365186788 -1993854761 1916360575 96
import_procedure	 Main_I3 0 Addr 0 p.2
export_unit	 Main
import_procedure	 IO_I3 0 Addr 0 p.3
import_unit	 IO
import_procedure	 RTHooks_I3 0 Addr 0 p.4
import_unit	 RTHooks
declare_typename	 765876253 Rng
declare_typename	 1916360575 Arr
declare_indirect	 -1916360576 1916360575
declare_procedure	 Main__V 0 Int.64 0 0 F * p.5
declare_local	 Loc 12 4 Struct 365186788 T F 50 v.4
declare_local	 _result 8 8 Int.64 425470580 F F 50 v.5
# V
				-----LINE 22  -----
begin_procedure	 p.5
				-----LINE 24  -----
load_address	 v.4 0
load_address	 v.2 112
copy		 4 Int.32 F   <----------------------- I think this is copying 1 array elt, size 4 bytes but it's 4 times size of Int.32 which is 16 bytes - same for other 3 copies below. So maybe its either    1 Int.32 or 4 Int.8
load_address	 v.4 4
load_address	 v.2 128
copy		 4 Int.32 F
load_address	 v.4 8
load_address	 v.2 144
copy		 4 Int.32 F
import_procedure	 alloca 1 Addr 0 p.6
declare_param	 * 8 8 Word.64 0 F F 0 v.6
import_global	 m3_jmpbuf_size 8 8 Word.64 0 v.7
# AllocateJmpbufs V try_count:0
				-----LINE 23  -----
				-----LINE 29  -----
load_integer	 Int.64 0
exit_proc	 Int.64
end_procedure	 p.5
# Main_M3
# module main body Main_M3
				-----LINE 32  -----
begin_procedure	 p.1
load		 v.3 0 Int.64 Int.64
if_false	 Int.64 L.1 0
# AllocateJmpbufs  try_count:0
				-----LINE 33  -----
start_call_direct	 p.5 0 Int.64
call_direct	 p.5 Int.64
declare_temp	 8 8 Int.64 F v.8
store		 v.8 0 Int.64 Int.64
load		 v.8 0 Int.64 Int.64
store		 v.2 152 Int.64 Int.64

. L.1 F
load_address v.2 0
exit_proc Addr
free_temp v.8
end_procedure p.1
# global constant type descriptor
declare_record -1 704 3
declare_field A1C 0 32 1916360575
declare_field A2C 32 32 1916360575
declare_field A3C 64 32 1916360575
# global data type descriptor
declare_record -1 1856 7
declare_field A1C 832 64 -1916360576
declare_field A1V 896 32 1916360575
declare_field A2C 960 64 -1916360576
declare_field A2V 1024 32 1916360575
declare_field A3C 1088 64 -1916360576
declare_field A3V 1152 32 1916360575
declare_field return 1216 64 425470580
# module global constants
bind_segment v.1 88 8 Struct F T
begin_init v.1
# Contents of constant Main.A1C
init_int 0 129 Int.8
# Contents of constant Main.A2C
init_int 1 28 Int.8
init_int 2 5 Int.16
init_int 4 201 Int.8
# Contents of constant Main.A3C
init_int 5 12 Int.8
init_int 8 162 Int.8
# procedure names
init_int 9 160 Int.8
init_int 10 5 Int.16
init_chars 16 "Main_M3"
init_chars 24 "V"
# procedure table
init_proc 32 p.1
init_var 40 v.1 16
init_proc 48 p.5
init_var 56 v.1 24
# file name
init_chars 72 "../src/Main.m3"
end_init v.1
# module global data
bind_segment v.2 232 8 Struct F T
begin_init v.2
init_var 0 v.1 72
init_var 40 v.1 32
init_var 72 v.2 160
init_proc 88 p.1
init_int 96 3 Int.64
# Address of constant Main.A1C
init_var 104 v.1 0
init_int 112 129 Int.8
# Address of constant Main.A2C
init_int 113 28 Int.8
init_int 114 5 Int.16
init_var 120 v.1 4
init_int 128 201 Int.8
# Address of constant Main.A3C
init_int 129 12 Int.8
init_var 136 v.1 8
init_int 144 162 Int.8
init_int 145 160 Int.8
init_int 146 5 Int.16
init_proc 168 p.2
init_var 176 v.2 184
init_proc 192 p.3
init_var 200 v.2 208
init_proc 216 p.4
end_init v.2
# load map
#
#
# global data allocation for M_Main
# 0 104 8 module info
# 104 8 8 constantMain.A1C_ADDR_
# 112 4 4 Main.A1V
# 120 8 8 constantMain.A2C_ADDR_
# 128 4 4 Main.A2V
# 136 8 8 constantMain.A3C_ADDR_
# 144 4 4 Main.A3V
# 152 8 8 Main.return
# 160 24 8 import Main
# 184 24 8 import IO
# 208 24 8 import RTHooks
# 232 0 8 TOTAL
#
#
# global constants for M_Main
# 0 4 4 constant Main.A1C
# 4 4 4 constant Main.A2C
# 8 4 4 constant Main.A3C
# 16 10 8 proc names
# 32 40 8 proc info
# 72 15 1 string
# 88 0 8 TOTAL
#
end_unit

unix64le: CM3 fails to build on Linux aarch64 (Raspberry Pi 4, Ubuntu 20.04) with GCC 10 or Clang

CM3 (d5.11.3-20211007) fails to build on the Raspberry Pi 4, running aarch64/ARM64 Linux using the unix64le files.

When building CM3 and making an empty config file/one just saying to use the C backend, using the instructions on the 20210610 build:

$ g++-10 -g -pthread -c cm3-boot-unix64le-d5.11.3-20211007.cpp
../src/Wrx86.m3: In function ‘int SockAddrNativeToM3(const NativeSockAddrUnionAll*, M3SockAddrUnionAll*)’:
../src/Wrx86.m3:6671: warning: control reaches end of non-void function [-Wreturn-type]
$ g++-10 -g -pthread -o cm3 cm3-boot-unix64le-d5.11.3-20211007.o
$ ./cm3
cm3: ../src/Wrx86.m3:2064: const char* MxConfigC__HOST(): Assertion `strcmp(M3_HOST, result) == 0' failed.
Aborted (core dumped)

When trying to build the rest of CM3, I get this:

lain@RPI4:~/Downloads/cm3/cm3-unix64le-d5.11.1-20210610/scripts/python$ ./boot2min.py c
SearchPath return:/opt/cm3/bin/cm3
Traceback (most recent call last):
File "./boot2min.py", line 17, in
import os, sys, pylib
File "/home/lain/Downloads/cm3/cm3-unix64le-d5.11.1-20210610/scripts/python/pylib.py", line 660, in
if TargetOnlyHasCBackend(Target):
File "/home/lain/Downloads/cm3/cm3-unix64le-d5.11.1-20210610/scripts/python/pylib.py", line 385, in TargetOnlyHasCBackend
a = a.lower()
AttributeError: 'NoneType' object has no attribute 'lower'

When I use Clang++ instead of GCC:
lain@RPI4:~/Downloads/cm3$ clang++ -g -pthread -c cm3-boot-unix64le-d5.11.3-20211007.cpp
../src/unix/Common/Upwd.i3:494:1: error: 'sched_yield' is missing exception specification 'throw()'
sched_yield(void);
^
throw()
../src/thread/PTHREAD/ThreadPThread.i3:3668:1: note: previous declaration is here
sched_yield(void);
^
1 error generated.

uname -a output:
lain@RPI4:~/Downloads/cm3$ uname -a Linux RPI4 5.4.0-1044-raspi #48-Ubuntu SMP PREEMPT Thu Sep 9 15:24:01 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux

Compiler versions:
lain@RPI4:~/Downloads/cm3$ g++-10 --version g++-10 (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0 Copyright (C) 2020 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

lain@RPI4:~/Downloads/cm3$ clang++ --version clang version 10.0.0-4ubuntu1 Target: aarch64-unknown-linux-gnu Thread model: posix InstalledDir: /usr/bin lain@RPI4:~/Downloads/cm3$

Incorrect “illegal recursive declaration” error

The following pair of (non-recursive) declarations is accepted by the compiler, but only in that order.

VAR x := RECORD f: INTEGER END { y };
CONST y = BYTESIZE(x);

If you move y before x, the compiler will complain about “illegal recursive declaration” on y.

Problem with NUMBER

I'm not sure it's a problem with number, more with initialization of parameters. I added P286
to demonstrate the problem. The Main.m3 has a description of it. I did notice that
after I touched and recompiled one of the modules, the T2.m3 one, the IR had a couple
of extra inits. I would have thought the IR would be identical after recompilation if the source
had not changed. Those extra inits seem to fix the error.

quake BNF, anybody

Hi ppl,

As I am progressing with IntelliJ plugin for Modula-3, quake looms big over me. As it is not possible to just know scoping rules for any source without interpreting m3makefile, I have to do it. It will save me a day or two if anybody has knowledge about, or has access to quake BNF.

TIA,
dd

Porting CM3 to Haiku x86 32 bits

Hi,

I have been using Haiku for a long time and decided to port CM3 to this system.
In the first step I reduced the number of packages from the pkginfo.txt file to the
minimum necessary. So make-dist.py script makes CM3 distribution seamlessly.
The whole thing I prepared on Linux Fedora 25 on AMD64.
I read carefully the file doc/notses/porting.txt and performed the following steps:
a) I added the new target I386_HAIKU to Target.i3;
b) I added a buffer size to Jumpbuf_size, 32 bytes as 8 x address size;
c) I rebuilt CM3 with the make-dist.py script;
d) I have installed the reworked CM3-min distribution on the host system;
CM3 --version:

Critical Mass Modula-3 version d5.10.0
last updated: 2016-10-05
compiled: 2017-04-01 14:38:59
configuration: /opt/cm3-devel-5.10.0-dkk/bin/cm3.cfg
host: AMD64_LINUX
target: AMD64_LINUX

e) I added the entry "I386_HAIKIU": "i586-pc-haiku" to the file m3-sys/m3cc/src/platforms.quake;
f) I added the entry "I386_HAIKU" : "-with-gnu-as -with-gnu-ld" and added "I386_HIAKU" in line 475 in the file m3makefile in the same directory;
g) I tried to run the command: cm3 -DM3CC_TARGET=I386_HAIKU.

After that I have got the following message:

checking for clock_t... yes
checking if mkdir takes one argument... no
*** Configuration i586-pc-haiku not supported
Makefile:3413: recipe for target 'configure-gcc' failed
make: *** [configure-gcc] Error 1
"/run/media/dknoto/ARCHIWUM/Oprogramowanie/Critical.Mass.Modula-3/cm3-d5.10.0-20161121/m3-sys/m3cc/src/m3makefile", line 332: quake runtime error: exit 2: cd ../AMD64_LINUX-I386_HAIKU && make MAKE="make -j4 " AUTOCONF=: AUTOMAKE=: LEX='touch lex.yy.c' MAKEINFO=: configure-host
`--procedure-- -line- -file---` `exec -- <builtin>` `m3cc_Run 332 /run/media/dknoto/ARCHIWUM/Oprogramowanie/Critical.Mass.Modula-3/cm3-d5.10.0-20161121/m3-sys/m3cc/src/m3makefile` `include_dir 543 /run/media/dknoto/ARCHIWUM/Oprogramowanie/Critical.Mass.Modula-3/cm3-d5.10.0-20161121/m3-sys/m3cc/src/m3makefile` ` 5 /run/media/dknoto/ARCHIWUM/Oprogramowanie/Critical.Mass.Modula-3/cm3-d5.10.0-20161121/m3-sys/m3cc/AMD64_LINUX/m3make.args`
Fatal Error: package build failed

I tried manually to run gcc47 compiling commands but I did not go much further.

Packed set literal generation issue

See the fragment below.

VAR
  r := SET OF [0..31] { 0 };  (* OK *)
  s := BITS 32 FOR SET OF [0..31] { 0 };  (* -- assertion failure in “SetExpr.m3” *)
  t := BITS 32 FOR ARRAY [0..31] OF BITS 1 FOR BOOLEAN { TRUE, FALSE, .. };  (* OK *)

Problems building HEAD

I have:
Critical Mass Modula-3 version d5.9.0
last updated: 2010-07-21
compiled: 2014-08-19 18:12:27
configuration: /usr/local/cm3/bin/cm3.cfg
host: AMD64_LINUX
target: AMD64_LINUX

When doing a ./make-bin-dist-min.sh, newly built cm3 breaks when moment comes to rebuild everything with it.


stage 3: compiling libraries using new cm3 compiler

/root/cm3/scripts/do-cm3-core.sh buildlocal
/root/cm3/scripts/pkgmap.sh -c "/var/tmp/cm3/bin/cm3 -build -override -DROOT='/root/cm3'" import-libs m3core libm3 windowsResources parseparams patternmatching sysutils unittest m3middle m3objfile m3linker m3back m3cggen m3quake m3front m3scanner m3tools m3cgcat m3bundle mklib tempfiles bitvector digraph realgeometry set slisp sortedtableextras table-list tcp cm3ide mtex m3sleep cm3 m3cc
=== package /root/cm3/m3-win/import-libs ===
+++ /var/tmp/cm3/bin/cm3 -build -override -DROOT='/root/cm3' +++
/bin/sh: line 1: 20979 Segmentation fault /var/tmp/cm3/bin/cm3 -build -override -DROOT='/root/cm3'
*** execution of /var/tmp/cm3/bin/cm3 -build -override -DROOT='/root/cm3' failed ***

When I start it from gdb, I see this:

Program received signal SIGSEGV, Segmentation fault.
__longjmp () at ../sysdeps/x86_64/__longjmp.S:56
56 jmpq *%rdx
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.166.el6_7.7.x86_64
(gdb) bt
#0 __longjmp () at ../sysdeps/x86_64/__longjmp.S:56
#1 0xa933bd60cb76afa4 in ?? ()

Cannot access memory at address 0xa926bd60cb76afa4

Is there some way to get around this? Some known stable release?

TIA,
dd

State of Atomic

What is current state of atomic support wrt libs/frontend?

FLOOR may silently give incorrect results

FLOOR seems to give incorrect results for larger numbers. In my environment, FLOOR(1.0D10) is −2147483648 on NT386 and FLOOR(1.0D20) is −9223372036854775808 on AMD64_LINUX.

CMASS license change

The COPYRIGHT-CMASS license is non-free because of the paragraph:

LICENSEE hereby grants to CRITICAL MASS a non-exclusive, non-transferable, royalty free right to use, modify, reproduce and distribute with the right to sublicense at any tier, any improvements, enhancements, extensions, or modifications that LICENSEE make to SOFTWARE, provided such are returned to CRITICAL MASS by LICENSEE.

This is a problem for inclusion of cm3 in some free software distributions, including Fedora Linux:
https://www.redhat.com/archives/fedora-legal-list/2009-September/msg00021.html

Is there anyone at CRITICAL MASS (or their successors or assigns) that has authority to amend the license to remove the problematic paragraph, and if so, are they willing to do so?

[Solved] [cm3 AMD64_NT] Modula-3 for Windows x64 ( m3devel 2019-January )

I think that this need a discussion . . .

It's possible duplicate of
https://m3lists.elegosoft.com/pipermail/m3devel/2019-January.txt

Subject: [M3devel] It's time to AMD_64. Modula-3 for Windows x64

Hi!


 It's time to AMD_64


I started from

https://modula3.elegosoft.com/cm3/uploaded-archives/

cm3-min-AMD64_NT-d5.9.0-VC110-20131012.msi
cm3-all-AMD64_NT-d5.9.0-VC110-20131012.zip


I have worked Modula-3 for Windows x64



There some must important patches:


==
--- RTExFrame.m3 cm3-4e08861fd36f23dcfac6e50e157b36eddf3989b7	Fri Jul 01 10:29:12 2016
+++ RTExFrame.m3	Tue Jun 21 11:59:05 2016
@@ -10,17 +10,17 @@
 (*----------------------------------------- compiler generated descriptors --*)
 
 (* This defines the low-level routines and data structures
    used by the exception runtime.
    See also m3middle/src/M3RT, which also describes these structures.
 *)
 
 (* RTExFrame.Alloca_jmpbuf and Target.Alloca_jmpbuf must match. *)
-CONST Alloca_jmpbuf = TRUE;
+CONST Alloca_jmpbuf = FALSE;
 
 TYPE
   ScopeKind = { Except, ExceptElse,
                 Finally, FinallyProc,
                 Raises, RaisesNone,
                 Lock };
 
 TYPE

==



==
--- Target.m3 cm3-4e08861fd36f23dcfac6e50e157b36eddf3989b7	Fri Jul 01 10:29:12 2016
+++ Target.m3	Tue Jun 21 11:59:05 2016
@@ -59,37 +59,37 @@
     System_name := SystemNames[sys];
 
     OS_name := in_OS_name;
 
     (* common values *)
 
     Atomic_lock_free :=
         ARRAY [CGType.Word8..CGType.Addr] OF BOOLEAN { TRUE, .. };
     (* this is overly optimistic... *)
 
     Allow_packed_byte_aligned := FALSE;
     All_floats_legal          := TRUE;
     PCC_bitfield_type_matters := TRUE;
     Structure_size_boundary   := 8;
     Little_endian             := TRUE;
     Setjmp                    := "_setjmp";
 
     (* RTExFrame.Alloca_jmpbuf and Target.Alloca_jmpbuf must match. *)
-    Alloca_jmpbuf             := TRUE;
+    Alloca_jmpbuf             := FALSE;
 
     (* There is no portable stack walker, and therefore few systems have one.
        Having a stack walker theoretically speeds up everything nicely.  If
        you are familiar with NT exception handling, all but x86 have a stack
        walker.  Not having a stack walker means that functions that have
        try/except/finally/raise incur a codegen cost even if there is never a
        raise -- for having the try.  Having a stack walker means "zero cost"
        for exception handling code that does not actually raise an exception.
 
        If there is NOT a stack walker, prologues/epilogues for functions that
        try/except/finally/raise call PushEFrame / PopEFrame, essentially to
        build a walkable parallel stack.
 
        If there is a stack walker, then raise can discover what PushEFrame /
        PopEFrame effectively recorded.
 
        NT/x86 has a highly optimized equivalent of PushEFrame / PopEFrame, not
        currently used by Modula-3. *)

==




==
--- LazyConsole.i3 000	Thu Nov 01 00:26:16 2018
+++ LazyConsole.i3	Thu Jan 17 13:19:20 2019
@@ -5,7 +5,7 @@
 
 IMPORT File, FileWin32, WinDef;
 
-PROCEDURE New (hd: WinDef.DWORD; ds: FileWin32.DirectionSet): File.T;
+PROCEDURE New (hd: WinDef.INT32; ds: FileWin32.DirectionSet): File.T;
 (* Returns a file that if ever written to or read from will allocate
    a fresh Windows console for the I/O.  *)
 
==




==
--- LazyConsole.m3 000	Thu Nov 01 00:26:16 2018
+++ LazyConsole.m3	Thu Jan 17 13:20:54 2019
@@ -7,7 +7,7 @@
 
 TYPE
   T = Terminal.T OBJECT
-    hd    : WinDef.DWORD;
+    hd    : WinDef.INT32;
     setup : BOOLEAN := FALSE;
   OVERRIDES
     read   := Read;
@@ -16,7 +16,7 @@
     status := Status;
   END;
 
-PROCEDURE New (hd: WinDef.DWORD; ds: FileWin32.DirectionSet): File.T =
+PROCEDURE New (hd: WinDef.INT32; ds: FileWin32.DirectionSet): File.T =
   BEGIN
     RETURN NEW (T, ds := ds, hd := hd);
   END New;
==



==
--- m3makefile 000	Thu Nov 01 00:26:16 2018
+++ m3makefile	Thu Jan 17 14:09:22 2019
@@ -15,7 +15,7 @@
     cp_if(Name & ".i3.tmp", Name & ".i3")
 end
 
-if equal(TARGET, "NT386")
+if equal(TARGET, "AMD64_NT")
   MakeGrisuDisable("GrisuDisable", "TRUE")
 else
   MakeGrisuDisable("GrisuDisable", "FALSE")
==





Best regards, Victor Miasnikov


P.S.

 
 For best working with debugger:


--- RTOS.m3 000	Sun Jan 03 11:17:00 2016
+++ RTOS.m3	Fri Jan 04 13:15:50 2019
@@ -23,10 +23,12 @@
     IF WinBase.IsDebuggerPresent () # 0 THEN
       WinBase.DebugBreak ();
     END;
-    RTThread.SuspendOthers ();
-    RTMachInfo.DumpStack (LOOPHOLE (Crash, ADDRESS), fp);
+ (*    RTThread.SuspendOthers ();
+    RTMachInfo.DumpStack (LOOPHOLE (Crash, ADDRESS), fp); *)
+    (** RTThread.ResumeOthers ();
     RTSignal.RestoreHandlers (); (* so we really do crash... *)
-    Exit (-1);
+  ***)
+    Exit (4000);  (*** 0 not -1   ***)
   END Crash;
 
 (*********************
 



 Some trivial patches to .cmd:



--- cm3CommandShell.CMD-000     Sun Jan 03 11:17:00 2016
+++ cm3CommandShell.CMD Wed Jan 02 15:24:30 2019
@@ -96,2 +96,3 @@
 echo %_cm3_ThisOS_Long% | (find /I "Windows 7"           >NUL:) && ((set _cm3_ThisOS=Win7)  & goto ver_7)
+echo %_cm3_ThisOS_Long% | (find /I "Windows 10"           >NUL:) && ((set _cm3_ThisOS=Win7)  & goto ver_7)
 echo %_cm3_ThisOS_Long% | (find /I "Windows Server 2008" >NUL:) && ((set _cm3_ThisOS=2008)  & goto ver_2008)
[/code]



--- do-cm3.cmd 000      Sun Jan 03 11:17:00 2016
+++ do-cm3.cmd  Sat Dec 29 11:46:06 2018
@@ -85,6 +85,7 @@
 if NOT exist %SystemRoot%\system32\systeminfo.exe goto ver_NoSysInfo
 FOR /F "usebackq tokens=3* delims=: " %%i IN (`systeminfo ^| find /I "OS Name"`) DO set _cm3_ThisOS_Long=%%i %%j
 echo %_cm3_ThisOS_Long% | (find /I "Windows Vista"       >NUL:) && ((set _cm3_ThisOS=Vista) & goto ver_Vista)
+echo %_cm3_ThisOS_Long% | (find /I "Windows 10"           >NUL:) && ((set _cm3_ThisOS=Win7)  & goto ver_7)
 echo %_cm3_ThisOS_Long% | (find /I "Windows 7"           >NUL:) && ((set _cm3_ThisOS=Win7)  & goto ver_7)
 echo %_cm3_ThisOS_Long% | (find /I "Windows Server 2008" >NUL:) && ((set _cm3_ThisOS=2008)  & goto ver_2008)




--- RCC_upgradeCM3.cmd 000	Sun Jan 03 11:17:00 2016
+++ RCC_upgradeCM3.cmd	Wed Jan 02 16:45:50 2019
@@ -48,7 +48,7 @@
 set _cm3_Repeat=1
 set _cm3_DO=
 set _z_ctrlArgs=
-set _z_Stage3=min
+set _z_Stage3=all
 
 
 
@@ -113,7 +113,7 @@
 if exist "bin\cm3.exe" if exist "pkg" set CM3_ROOT=%CD%& popd & goto FoundRoot
 cd ..
 if exist "bin\cm3.exe" if exist "pkg" set CM3_ROOT=%CD%& popd & goto FoundRoot
-if exist "C:\cm3\bin\cm3.exe" if exist "C:\cm3\pkg" set CM3_ROOT=C:\cm3& popd & goto FoundRoot
+if exist "D:\cm3\bin\cm3.exe" if exist "D:\cm3\pkg" set CM3_ROOT=D:\cm3& popd & goto FoundRoot
 popd
 rem otherwise, search the existing PATH environment variable to try and find the root of the cm3 installation
 for %%F in (cm3.exe) do set CM3_ROOT=%%~dp$PATH:F..
@@ -138,7 +138,7 @@
 if /I "%_cm3_CommandReady%"=="TRUE" goto FindPkgInfo
 echo Setting up environment variables for CM3 ...
 echo.
-call c:\cm3\bin\cm3CommandShell.CMD SameWindow
+call d:\cm3\bin\cm3CommandShell.CMD SameWindow
 @echo off
 if /I not "%_cm3_CommandReady%"=="TRUE" goto FatalSetupCM3
 
@@ -237,7 +237,7 @@
 echo Creating "%CM3_ROOT%\bin\cm3.cfg" ...
 if exist "%CM3_ROOT%\bin\cm3.cfg" del /f %CM3_ROOT%\bin\cm3.cfg
 REM OLD: echo INSTALL_ROOT = path() ^& "/..">%CM3_ROOT%\bin\cm3.cfg
-REM OLD: echo include(path() ^& "/config/NT386")>>%CM3_ROOT%\bin\cm3.cfg
+REM OLD: echo include(path() ^& "/config/AMD64_NT")>>%CM3_ROOT%\bin\cm3.cfg
 copy /y %_cm3_PkgTree%m3-sys\cminstall\src\config-no-install\cm3.cfg %CM3_ROOT%\bin\cm3.cfg
 if errorlevel 1 echo ERROR:  Problem copying files.� & (set _cm3_ExitCode=5) & goto END
 if not exist "%CM3_ROOT%\bin\cm3.cfg" echo ERROR:  Problem copying files.� & (set _cm3_ExitCode=5) & goto END
@@ -287,12 +287,12 @@
 :FN_FinishStage
 :--------------
 if "%_cm3_CM3Failure%"=="TRUE" echo ...skipping installation of cm3.exe due to errors.�.�.� & goto :EOF
-if not exist "%_cm3_PkgTree%m3-sys\cm3\NT386\cm3.exe" goto StageFailure
+if not exist "%_cm3_PkgTree%m3-sys\cm3\AMD64_NT\cm3.exe" goto StageFailure
 echo ...installing new cm3.exe as "%CM3_ROOT%\bin\cm3.exe" ...
 if exist "%CM3_ROOT%\bin\cm3.exe" del /f "%CM3_ROOT%\bin\cm3.exe"
 if exist "%CM3_ROOT%\bin\cm3.pdb" del /f "%CM3_ROOT%\bin\cm3.pdb"
-copy "%_cm3_PkgTree%m3-sys\cm3\NT386\cm3.exe" "%CM3_ROOT%\bin\cm3.exe"
-if exist "%_cm3_PkgTree%m3-sys\cm3\NT386\cm3.pdb" copy "%_cm3_PkgTree%m3-sys\cm3\NT386\cm3.pdb" "%CM3_ROOT%\bin\cm3.pdb"
+copy "%_cm3_PkgTree%m3-sys\cm3\AMD64_NT\cm3.exe" "%CM3_ROOT%\bin\cm3.exe"
+if exist "%_cm3_PkgTree%m3-sys\cm3\AMD64_NT\cm3.pdb" copy "%_cm3_PkgTree%m3-sys\cm3\AMD64_NT\cm3.pdb" "%CM3_ROOT%\bin\cm3.pdb"
 if not exist "%CM3_ROOT%\bin\cm3.exe" goto StageFailure
 goto :EOF

Type uid used before declaration

In test p269 Dynamic.m3 line 510 a type uid is referenced in declare_local
that has not been declared before it's use.

The type uid is 1035065828

I'm not sure if the IR specifies this but it seems to be the case
in all other generated code.

prepare new bugfix release

Recent changes to master mean that HEAD no longer builds on the 5.11.1 release from June, and most likely does not build on the 5.11.2 release from July (though I haven't been able to personally verify).

I'm looking forward to everything I'll get to learn trying to put together a new release, but I would not object if anybody wanted to drop me some hints.

Const Array Decl Bugs

CONST A = ARRAY OF ARRAY OF INTEGER{ARRAY OF INTEGER{1}};

compiles but

CONST A = ARRAY OF ARRAY OF INTEGER{ARRAY OF INTEGER{}};

results in

***
*** runtime error:
***    <*ASSERT*> failed.
***    file "../src/exprs/ArrayExpr.m3", line 653
***

This may be the same or a related bug:

TYPE  R = RECORD a := 1 END;
CONST B = ARRAY OF R{R{}};
CONST C = B[0].a;  (* error: value is not constant *)

but

TYPE  R = RECORD a := 1 END;
CONST B = ARRAY OF R{R{1}};
CONST C = B[0].a;  (* no error *)

IR changed

Since the packed vars branch was merged I have noticed a slight IR change to do with temps. I mentioned this
to Rodney in an email but thought I would produce a small example.

This program
MODULE Main;

PROCEDURE Test8() : CHAR =
BEGIN
RETURN VAL(65,CHAR);
END Test8;

PROCEDURE TestIt() =
VAR i8 : CHAR;
BEGIN
i8 := Test8();
END TestIt;

BEGIN
TestIt();
END Main.

produces the following (snipped) IR

...
declare_procedure Main__Test8 0 Word.8 0 0 F * p.4 <----- declared return type Word.8 ie 8 bit Word
declare_local _result 1 1 Word.8 1457612899 F F 50 v.4 <---- result type Word.8 not used
declare_procedure Main__TestIt 0 Void 0 0 F * p.5
declare_local i8 1 1 Word.8 1457612899 F F 50 v.5
# Test8
-----LINE 3 -----
begin_procedure p.4
import_procedure alloca 1 Addr 0 p.6
declare_param * 8 8 Word.64 0 F F 0 v.6
import_global m3_jmpbuf_size 8 8 Word.64 0 v.7
# AllocateJmpbufs Test8 try_count:0
-----LINE 4 -----
-----LINE 5 -----
load_integer Int.64 65
exit_proc Word.64 <---- Not exactly relevant to the issue but shouldn't this agree with the return type?
end_procedure p.4
# TestIt
-----LINE 8 -----
begin_procedure p.5
# AllocateJmpbufs TestIt try_count:0
-----LINE 9 -----
-----LINE 11 -----
start_call_direct p.4 0 Word.8
call_direct p.4 Word.8 <----- Again return type Word.8
declare_temp 8 8 Int.64 F v.8 <----- Problem - temp (for func result) is declared Int.64 whereas it used to be Word.8
store v.8 0 Int.64 Int.64 <----- Store result of func on stack (which is Word.8) into Int.64 v.8 temp
load v.8 0 Int.64 Int.64 <----- Load has same problem
store v.5 0 Int.64 Word.8
-----LINE 12 -----
exit_proc Void
free_temp v.8
end_procedure p.5
...

And it generates bad code like this in LLVM
%tmp.16 = alloca i64, align 8
.....
%result1 = call i8 @Main__Test8()
store i8 %result1, i64* %tmp.16, align 1 <--- where the %tmp.16 is the wrong size it should be i8*

We could possibly fix this in the llvm store() function by checking the size of the value
on the stack and doing a trunc. But that sort of defeats the purpose of the type parameters
and the fact is it used to work.

Loophole problem in C backend

With this simple M3
v := 1.23D0;
t := LOOPHOLE(v,LONGINT);
x := LOOPHOLE(t,LONGREAL);

the C backend generates for the first loophole

(the HTML is converting asterix to some unprintable char. Press edit to see the correct stmts below)

(*(INT64*)((120)+(char*)(&Main_m_M_Main_L_29)))=
(INT64)( ((INT64)(((double)(*((double*)(INT64_(104)+((ADDRESS)(&Main_m_M_Main_L_29)))))))));

and for the second loophole

(*(double*)((112)+(char*)(&Main_m_M_Main_L_29)))=
(double)( ((double)(((INT64)(*((INT64*)(INT64_(120)+((ADDRESS)(&Main_m_M_Main_L_29)))))))));

but this is incorrect. It can be fixed by replacing the cast double with INT64 in the first one thus

(*(INT64*)((120)+(char*)(&Main_m_M_Main_L_29)))=
(INT64)( ((INT64)(((INT64)(*((INT64*)(INT64_(104)+((ADDRESS)(&Main_m_M_Main_L_29)))))))));

and INT64 with double in the second

(*(double*)((112)+(char*)(&Main_m_M_Main_L_29)))=
(double)( ((double)(((double)(*((double*)(INT64_(120)+((ADDRESS)(&Main_m_M_Main_L_29)))))))));

then it works.

This might go some way to fixing grisu problems.

Win32 backend crash with Long.LT

This program - extracted from p240 - causes a crash in the code generator

TYPE
<NOWARN>TYPE UINT16 = Cstdint.uint16_t;

<NOWARN> VAR vu16:UINT16:=306;
<NOWARN> VAR vLC:LONGCARD:=307L;

<NOWARN>PROCEDURE uLT_var_LC_u16():BOOLEAN=
BEGIN
RETURN Long.LT(vLC,VAL(vu16, LONGINT));
END uLT_var_LC_u16;


*** runtime error:
*** <ASSERT> failed.
*** file "..\src\Codex86.m3", line 670


Stack trace:
FP PC Procedure


0x10fe7c0 0x1c2827 binOp1 + 0x1d8 in ..\src\Codex86.m3
0x10fe8dc 0x1c2e15 binOp + 0x4bf in ..\src\Codex86.m3
0x10fe90c 0x1c1481 compare_double + 0x66 in ..\src\Codex86.m3
0x10fea24 0x1c2da7 binOp + 0x451 in ..\src\Codex86.m3
0x10feb78 0x1d6e36 dobin + 0x63d in ..\src\Stackx86.m3
0x10febbc 0x19e54b compare + 0x7c0 in ..\src\M3x86.m3
0x10febe8 0x3af353 compare + 0x96 in ..\src\M3CG_Check.m3
0x10fec18 0x263ca1 Compare + 0xcd in ..\src\misc\CG.m3
0x10fec40 0x2cbe89 Compile + 0x1c6 in ..\NT386\LongLT.m3 => ..\src\builtinWord\LT.mg
0x10fec60 0x330d54 Compile + 0x83 in ..\src\exprs\CallExpr.m3
......... ......... ... more frames ...

It may be related to the fact that the parms are globals. Other tests with LT and
locals seem to work.

m3gdb

What's the status of m3gdb? The docs refer to a script that's supposed to build it, but the script doesn't exist, near as I can tell. I tried compiling it but it didn't work on my machine, and when looking at the error I didn't get why it should ever have compiled. I can provide details if need be, but I thought I'd ask first if it's currently supported.

CG error with array of packed type

These types

TYPE
XX = BITS 6 FOR [0..5];
YY = ARRAY [2..7] OF XX;

generate an error in the front end

new source -> compiling Main.m3
"../src/Main.m3", line 45: ** INTERNAL CG ERROR *** unable to find integer type? type=Word.64 size/offset/align=6/6/8
1 error encountered

port integrated backend

port integrated backend
to other object file formats and ABIs
to other architectures, start with amd64, then arm64

Licensing

I’m trying to get Modula-3 and Quake support on GitHub. They need to know under which licenses the sample source files are licensed. I used several files from libm3, which has a “COPYRIGHT-CMASS” file in the package root and a “COPYRIGHT” in “src”. Just which one(s) apply?

Illegal recursive type overflows stack in m3front

This program

MODULE Main;
TYPE
CC = RECORD
a : RR;
b : REF RR;
END;
RR = RECORD
c : CC;
END;
BEGIN
END Main.

correctly emits the illegal recursive type error but then
crashes by overflowing the stack. There seems to be a recursive loop in m3front between CheckAlign, AlignmentOK and IsAlignedOk.

New release for Mac OS X, please?

Hi, first, thanks for the great work! I installed the latest release for Mac OS X (d5.10.0) and tried to compile a simple program.

Unfortunately, there are a few problems (assuming I use cm3 correctly).

First, I had to remove "& SL" in cm3.cfg, see below.

Second, cm3 fails to find .M3EXPORTS because of a missing slash between bin and .. in the path, see below.

Would you please make a new release for Mac OS X?

Cheers,
Clemens

$ cat Main.m3
MODULE Main;

IMPORT IO;

VAR name: TEXT;

BEGIN
IO.Put("Enter your name: ");
name := IO.GetLine();
IO.Put("Hello " & name & "!\n");
END Main.

$ ~/src/cm3-installed/bin/cm3
--- building in AMD64_DARWIN ---

quake runtime error: "/Users/Clemens/src/cm3-installed/bin/cm3.cfg", line 2: quake runtime error: undefined variable: SL

--procedure-- -line- -file---
2 /Users/Clemens/src/cm3-installed/bin/cm3.cfg
new source -> compiling Main.m3
"../Main.m3", line 9: warning: potentially unhandled exception: IO.Error
1 warning encountered
Main.ms:1:9: error: unsupported directive '.stabs'
.stabs "/Users/Clemens/Languages/Modula3/Hello/AMD64_DARWIN/",100,0,0,Ltext0
^
Main.ms:2:9: error: unsupported directive '.stabs'
.stabs "Main.mc",100,0,0,Ltext0
^
Main.ms:5:9: error: unsupported directive '.stabs'
.stabs "gcc2_compiled.",60,0,0,0
^
Main.ms:6:9: error: unsupported directive '.stabs'
.stabs "procedures_have_extra_block.",60,0,0,0
^
Main.ms:7:9: error: unsupported directive '.stabs'
.stabs "m3_widechar_bitsize_16.",60,0,0,0
^
Main.ms:11:2: error: unknown directive
.stabd 46,0,0
^
Main.ms:12:9: error: unsupported directive '.stabs'
.stabs "../Main.m3",132,0,0,Ltext1
^
Main.ms:14:2: error: unknown directive
.stabd 68,0,7
^
Main.ms:24:2: error: unknown directive
.stabd 68,0,7
^
Main.ms:29:2: error: unknown directive
.stabd 68,0,8
^
Main.ms:33:2: error: unknown directive
.stabd 68,0,9
^
Main.ms:41:2: error: unknown directive
.stabd 68,0,10
^
Main.ms:84:9: error: unsupported directive '.stabs'
.stabs "Main_M3:F(0,1)=*(0,2)=(0,2)",36,0,7,_Main_M3
^
Main.ms:85:9: error: unsupported directive '.stabs'
.stabs "mode:p(0,3)=@S64;r(0,3);01000000000000000000000;0777777777777777777777;",160,0,0,-40
^
Main.ms:86:2: error: unknown directive
.stabn 192,0,0,LFBB1
^
Main.ms:87:2: error: unknown directive
.stabn 192,0,0,LBB2
^
Main.ms:88:2: error: unknown directive
.stabn 224,0,0,LBE2
^
Main.ms:89:2: error: unknown directive
.stabn 224,0,0,Lscope1
^
Main.ms:91:9: error: unsupported directive '.stabs'
.stabs "",36,0,0,Lscope1-LFBB1
^
Main.ms:92:2: error: unknown directive
.stabd 78,0,0
^
Main.ms:149:9: error: unsupported directive '.stabs'
.stabs "L_1:S(0,4)=s200;",38,0,0,_L_1
^
Main.ms:150:9: error: unsupported directive '.stabs'
.stabs "MM_Main:S(0,5)=s184;",38,0,0,_MM_Main
^
Main.ms:201:9: error: unsupported directive '.stabs'
.stabs "",100,0,0,Letext0
^
assemble => 1
assembler failed assembling: Main.ms
compilation failed => not building program "prog"
Fatal Error: package build failed

$ ~/src/cm3-installed/bin/cm3 Main.m3
--- building in AMD64_DARWIN ---

"/Users/Clemens/Languages/Modula3/Hello/AMD64_DARWIN/m3make.args", line 5: quake runtime error: unable to open "/Users/Clemens/src/cm3-installed/bin../pkg/libm3/AMD64_DARWIN/.M3EXPORTS" for reading

--procedure-- -line- -file---
import --
5 /Users/Clemens/Languages/Modula3/Hello/AMD64_DARWIN/m3make.args

Fatal Error: package build failed

[ ToDo: re-open] Modula-3 for Windows NT386 cm3-min-win*.* should contain mklib.exe

Problem:


 Short description:
...
'mklib' is not recognized as an internal or external command,
operable program or batch file.
"D:\cm3\bin\config\NT.common", line 1029: quake runtime error: library creation failed, see D:\cm3\src\m3-libs\sysutils\NT386\sysutils.lst for more information
...


Detailed  description:

  When run this command:
python upgrade.py && python do-cm3-all.py realclean skipgcc && python do-cm3-all.py buildship

we have error:
==
== package D:\cm3\src\m3-libs\sysutils ==

 +++ D:\cm3\bin\cm3.exe    -build -DROOT=D:/cm3/src +++
--- building in NT386 ---

ignoring ..\src\m3overrides

new source -> compiling EnvUtils.i3

 . . .
 
new source -> compiling FSUnixC.c
****  PARALLEL BACK-END BUILD, M3_PARALLEL_BACK = 20
new exporters -> recompiling FSUtils.i3
new exporters -> recompiling System.i3
new exporters -> recompiling PathRepr.i3
new exporters -> recompiling OSSpecials.i3
 -> archiving sysutils.lib
'mklib' is not recognized as an internal or external command,
operable program or batch file.
"D:\cm3\bin\config\NT.common", line 1029: quake runtime error: library creation failed, see D:\cm3\src\m3-libs\sysutils\NT386\sysutils.lst for more information


--procedure--  -line-  -file---
error              --  <builtin>
make_lib         1029  D:\cm3\bin\config\NT.common
Library            --  <builtin>
include_dir       117  D:\cm3\src\m3-libs\sysutils\src\m3makefile
                    5  D:\cm3\src\m3-libs\sysutils\NT386\m3make.args


Fatal Error: procedure "make_lib" defined in "D:\cm3\bin\cm3.cfg" failed.

 *** execution of [<function _BuildGlobalFunction at 0x000000000333DDD8>, <function _ShipFunction at 0x000000000333DE48>] failed ***

D:\cm3\src\scripts\python>
==

Solution:

cm3-min-win*.* should contain
mklib.exe
sysutils.dll

Tested with:
cm3-min-win32-d5.11.0-VC90-20210312.zip

Compiler not finding revelations from imported packages

One way to avoid recursive imports among interdependent ADT interfaces is to declare their principal types as opaque types in a common interface.

Trouble is, if you import this this common interface from another package, you might get an “opaque type never revealed” error at link-time.

Here’s a small test. If you build “testlib” and then “testpgm”, you’ll see this error; but if you build “testlib” as a program (cm3 -Dstdalone), it links just fine.

Language Features

  1. Array Constaructor
    In http://monet.cs.columbia.edu/modula3/tutorial/www/m3_54.html it is evident that the open array form cannot be used for array constructors. I think this is a drawback, because it is not always convenient to count the number of elements, and in the process their number can vary. It would be nice if you could do this as c++:
    int a[] = {1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7};

  2. Reflection
    For comfortable serialization/deserialization ((JSON, XML). For arrays, records, objects. Need TypeInfo on runtime - type/name each fields/elements, read|/write value/

  3. Properties
    What do you think about implementing properties in Objects?

OBJECT
   ...
   PROPERTIES
     intValue : INTEGER READ GetIntValue() WRITE SetIntValue();

Filename extension selection on Win32

The current Win32 implementation of the “Pathname” interface separates basename and filename extension by the first (instead of the last) dot character. (For example, Pathname.LastExt("C:\Windows\system32\ntoskrnl.exe.old") returns "exe.old" instead of "old".) I couldn’t find any authoritative documentation, but this is in contrast to the behavior of the .NET framework and the Windows shell.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.