[M3devel] -new_adr the default?

Jay K jay.krell at cornell.edu
Thu Jun 24 00:59:10 CEST 2010


I'd like to make -new_adr the default.
It is more typesafe than the current way and finds bugs.
  Granted, so far I think only bugs that I introduced.


First I will make the tree compile either way.
 Such as by fixing the bugs and resolving somehow the char vs. CHAR breaks.


Changing this does break code, albeit only unsafe code.
  There isn't much of that? Right? :)
Sometimes that code had bugs, sometimes not.


I believe type safety and static checking (and sometimes runtime checking) do have a place in unsafe code.
 Maybe not as much as in safe code, but definitely still something.


The old way is that ADR return ADDRESS, similar to void*, and it is silently convertable to any pointer type. I think.


The new way is that ADR(T) returns UNTRACED REF T is is only silently convertable to ADDRESS? Or nothing at all?
 Esp. not silently convertable to UNTRACED REF U.


So there are buggy places that do:
PROCEDURE Foo(UNTRACED REF T);

PROCEDURE Bar()
VAR u: U;
BEGIN
 Foo(ADR(u));
END Bar;


That compile with old ADR but not with new ADR.
As I changed socklent_t between int and INTEGER, such code silently kept compiling.
  But possibly silently corrupting the stack or producing the wrong data.


This -new_adr feature was already implemented in the compiler unknown long ago.
  I didn't know but Tony pointed it out.
We should probably look at its impementation make sure we aren't switching on some buggy unused code.
So far switching it on I've only seen correct new errors.


 - Jay
 		 	   		  


More information about the M3devel mailing list