[M3devel] unused warning isn't transitive

Rodney M. Bates rodney.m.bates at cox.net
Thu Jul 30 03:48:36 CEST 2009


There is more wrong with this code than unused warnings.
 From 2.2.5 Packed types: "variables of type T that occur in
records, objects, or arrays will occupy exactly n bits and be
packed adjacent to the preceding field or element".
(here, type T is BITS n FOR Base). 

The packed type has no effect when variables of T are not
so enclosed.  And the Int32Rec is nowhere enclosed in a
record, object, or array.   Perhaps the BITS 32 FOR should be
moved inside the record and applied to the type of field v?
 

Jay K wrote:
> TYPE Int32Rec = BITS 32 FOR RECORD v : Swap.Int32 END; 
> (* We need v to be inside a record.  Otherwise, the language would allow
>    a compiler to actually allocate more than the BITS 32 for a value of
>    type Swap.Int32.
> *) 
> VAR Int32RecVar : Int32Rec; 
> VAR CheckInt32 : [ 0 .. 0 ] := ADR(Int32RecVar) - ADR(Int32RecVar.v);
>  
>  
> Compiler complains that CheckInt32 isn't used.
> It should also perhaps mention Int32RecVar therefore.
>  
>  
>  - Jay
>   




More information about the M3devel mailing list