[M3commit] CVS Update: cm3 (Warning, type is NULL)

Jay K jay.krell at cornell.edu
Wed Feb 3 21:11:44 CET 2010


 > type of r to NULL, which is a perfectly valid Modula-3 type, but 
 > rather to an internal value named TypeUnknownBecauseOfAPriorError. 
 > Then make all warning/error checks silently succeed when applied to 
 > such unknown types, or anything else unknown in his way. 


 

The compiler does apparently do stuff like that in general.

Tony put in use of "ErrType.T".

 

 

 - Jay

 
> Date: Wed, 3 Feb 2010 13:13:48 -0600
> From: rodney_bates at lcwb.coop
> To: m3commit at elegosoft.com
> Subject: Re: [M3commit] CVS Update: cm3 (Warning, type is NULL)
> 
> 
> 
> Tony Hosking wrote:
> > On 3 Feb 2010, at 06:43, Jay K wrote:
> > 
> >> That is legal? What does it mean? What can you do it with t?
> > 
> > It's a variable of type NULL. It can only hold the NIL reference. 
> > Agreed, it is not particularly useful.
> > 
> > The warning is there to distinguish:
> > 
> > VAR t: NULL
> > 
> > which a programmer presumably intended to write, from
> > 
> > VAR t:= complicated expression of type NULL (perhaps hidden through 
> > various type renaming)
> > 
> > which the programmer possibly did not intend to write.
> 
> IMO, the appropriate thing for the front end to do is not to set the
> type of r to NULL, which is a perfectly valid Modula-3 type, but
> rather to an internal value named TypeUnknownBecauseOfAPriorError.
> Then make all warning/error checks silently succeed when applied to
> such unknown types, or anything else unknown in his way.
> 
> > 
> >> I compiled all of cm3 (at least what isn't filtered out on NT386) and 
> >> it didn't break anything.
> >> 
> >> - Jay
> >>
> >> 
> >> ------------------------------------------------------------------------
> >> From: hosking at cs.purdue.edu <mailto:hosking at cs.purdue.edu>
> >> Date: Wed, 3 Feb 2010 00:52:34 -0500
> >> To: jay.krell at cornell.edu <mailto:jay.krell at cornell.edu>
> >> CC: m3commit at elegosoft.com <mailto:m3commit at elegosoft.com>
> >> Subject: Re: [M3commit] CVS Update: cm3
> >>
> >> Clearly the source code is not legal. It's just that your change 
> >> breaks legal code:
> >>
> >> VAR t: NULL;
> >>
> >> which should emit a warning but nothing else.
> >>
> >> The problem lies elsewhere...
> >>
> >>
> >> On 3 Feb 2010, at 00:22, Jay K wrote:
> >>
> >> The backend should be able to cope with almost anything, I guess.
> >> But is the source code really legal?
> >> Shouldn't the front end error?
> >> The front end should error on some things, obviously.
> >> 
> >> Notice that all of the "internal errors" in this scenario are from
> >> the front end. Just the assertion failure is not.
> >> 
> >> 
> >> The front end doesn't handle its own stack correctly
> >> here, the errors come from its CG.m3 module that wraps
> >> the backend.
> >> 
> >> If this code is truly illegal and has no valid meaning, I think
> >> this is an ok change.
> >> The NT386 backend I guess should be hardened against front end
> >> bugs though.
> >> 
> >> 
> >> - Jay
> >>
> >> 
> >> ------------------------------------------------------------------------
> >> From: hosking at cs.purdue.edu <mailto:hosking at cs.purdue.edu>
> >> Date: Tue, 2 Feb 2010 12:19:16 -0500
> >> To: jkrell at elego.de <mailto:jkrell at elego.de>
> >> CC: m3commit at elegosoft.com <mailto:m3commit at elegosoft.com>
> >> Subject: Re: [M3commit] CVS Update: cm3
> >>
> >> That's the wrong approach. A warning is not an error. The
> >> backend should be able to cope with it...
> >>
> >> Antony Hosking | Associate Professor | Computer Science | Purdue
> >> University
> >> 305 N. University Street | West Lafayette | IN 47907 | USA
> >> Office +1 765 494 6001 | Mobile +1 765 427 5484
> >>
> >>
> >>
> >>
> >> On 1 Feb 2010, at 20:17, Jay Krell wrote:
> >>
> >> CVSROOT: /usr/cvs
> >> Changes by: jkrell at birch. 10/02/01 20:17:28
> >>
> >> Modified files:
> >> cm3/m3-sys/m3front/src/values/: Variable.m3 
> >>
> >> Log message:
> >> test case e0\e029:
> >>
> >> MODULE Main;
> >> TYPE Rec = RECORD a: INTEGER END;
> >> VAR r := Rec; (* warning: variable has type NULL *)
> >> BEGIN
> >> INC(r.a)
> >> END Main.
> >>
> >> followed by internal errors and an assertion failure in m3back
> >>
> >> Change warning to error, and then it never gets to the
> >> internal errors.
> >>
> >>
> >>
> >>
> >>
> > 
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3commit/attachments/20100203/49f4ad9a/attachment-0002.html>


More information about the M3commit mailing list