Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!lll-winken!uunet!tektronix!psueea!psu-cs.cs.pdx.edu!bartonr From: bartonr@psu-cs.cs.pdx.edu (Robert Barton) Newsgroups: comp.lang.modula2 Subject: WriteInt(-32768, n) Message-ID: <1007@psueea.UUCP> Date: 15 Apr 89 08:03:37 GMT Sender: news@psueea.UUCP Reply-To: bartonr@psu-cs.cs.pdx.edu (Robert Barton) Organization: Dept. of Computer Science, Portland State University; Portland OR Lines: 29 Consider the following simple program: (* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- *) MODULE Test; FROM InOut IMPORT WriteHex, WriteInt, WriteLn; VAR int : INTEGER; BEGIN int := -32768; WriteHex(CARDINAL(int), 12); WriteInt(int, 12); WriteLn END Test. (* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- *) With my system (Modula-2/Amiga by TDI) I get the following output: 8000H -4294934528 I believe I have isolated the problem to WriteInt not taking into account the fact that -(MIN(INTEGER)) # MAX(INTEGER). I recently came across a similar assembly example that did the same thing, so I'm wondering how common this bug is. Could anyone with a different M-2 compiler try this out and let me know the results.