[comp.lang.modula3] SRC Modula-3 V 1.6 for AIX PS/2, V 1.2

orgass+@rchland.ibm.com (Dick Orgass) (04/06/91)

There's a nit mistake of mine in the source file
.ROOT/libs/aix-ps2-1-2/os/Udir.m3.  Because of this nit, it is the case
that libm3aix-ps2-1-2.a is a client of libm3data.a.  Since the former
library is linked with all user programs by default, this would also
force linking with libm3data.a; not a very good idea considering the
simple use of Char.NUL.

Modify line 6 of Udir.m3 to be

    IMPORT Text;

Modify line 23 of Udir.m3 to be:

        IF name[i] = '\000' THEN EXIT ELSE INC(nameLength) END

The distributed configuration file, util/config.dist-AIX386, uses
/usr/local/lib/cpp as the C preprocessor for imake because the product
(ANSI) cpp and imake don't get along.  This is a port of the 4.3 BSD
cpp.  The MIT version distributed with X11 might also work.

The same three problems that I previously reported for the RISC 6000
port also appear with AIX PS/2 and there a few additional bugs depending
on which C compiler is used.  I suspect that something strange is
happening in the compilation of the intermediate C file for Thread.m3
but haven't been able to find the problem.

The three problems shared with the RISC 6000 port are:

        (1)     tests/ptests/p083

                There is an undefined symbol when the test program
        is linked; Eric reports that the link succeeds on DEC
        platforms.

        (2)     demos/pickles/Graph4Test

                This pickle test program terminates with an
        unhandled exception Graph4Test.Bug which is raised
        at line 120 of Graph4Test.m3; the 6000 version is at line 115.

        (3)     tools/pp/m3pp

                The pretty printer is not working correctly.  When
        tools/pp/Main.m3 is formatted, there is an assert failure at
        line 588 of Formatter.m3; when tools/pp/Parse.i3 is
        formatted, there is an assert failure at line 913 of
        Formatter.m3.  Similar problems come up when formatting
        other Modula-3 source files.

The following problem occurs independent of the C compiler that is used
to translate the intermediate C files:

        (4)     Test case p032 fails in the following strange ways.

                If the input is from /dev/null (as in the imake
        file), there is an unhandled exception, Rd.Failure, followed
        by a error message concerning deadlock followed by a fairly
        large number of messages about a run time error
        dereferencing NIL; evenually the whole thing stops.

                If the input is from a real terminal, the everyting
        is ok unless the first input character is end-of-file (^D);
        in this case the program goes into a loop without producing
        any output.

If the entire system is compiled using MetaWare's High C with or without
optimization and with or without -g, the following problems come up:

        (5a)    Test case p007 terminates with a Modula-3 runtime
        error concerning dereferencing NIL after the characters "16:
        " starting at the beginning of a line are emitted.

        (6a)    Test case p008 terminates with a Bus Error and no
        Modula-3 error message immediately after the first line of
        output is produce.

If the product C compiler, without optimization and without symbol
tables is used the following problems come up:

        (5b)    Test case p005 fails with a Modula-3 runtime error
        concerning an attempt to dereference NIL.

        (6b)    All of the pickle test programs in demos/pickles
        fail with either a bus error or a Modula-3 runtime error
        concerning an attempt to dereference NIL.

The solution that I adopted was to use the optimized High C version
except for Thread.mo.  For this module, I use /bin/cc to create a .s
file.  I edited the .s file to correct one incompatibility between the
two compilers.  For High C, a public char is one byte while for cc a
public char is four bytes.  This occurs exactly and only in identifiers
that begin M3_EXPORTS_ and M3_IMPORTS_.

This provided me with the best solution: Only p005 breaks and pickles
are very close to working.

Thanks to Eric Muller for doing a fine job on version 1.6 and for all
his help while I was working on this port.

Dick