Sven Panne writes:
> The first one is not a severe bug, but nevertheless: When using
> declare, Green Card omits a C type cast. Consider the following
> (silly) GC spec:
> 
> --------------------------------------------------
> module Cast where
> 
> import StdDIS
> 
> newtype Foo = B Word32
> %dis foo b = B (declare {FILE*} b in (word32 b))
> 
 ...
>   _casm_ ``do {FILE* b;char r;
>              b = %0;
...
> --------------------------------------------------
> 
> The "b = %0;" should be "b = (FILE*)%0;", otherwise gcc complains
> about making a pointer from an integer without a cast. That this
> should be correct has already been stated in the DIS.
> 

Hmm..I'm not convinced that you want to be so silent about these
kind of wild type casts, but I've added it nontheless :-)

> Another point is user-defined marshalling with more than one argument.
> The Green Card from York seems to interpret this as implicit tupling,
> so (I guess) the following should be fine:
> 
> --------------------------------------------------
> module Strange where
> 
> import StdDIS
> 
> data Foo = F Int Char
> %dis foo x y = <fromFoo/toFoo> (int x) (char y)
> 
> fromFoo (F i c) = (i,c)
> toFoo   (i,c)   = F i c
> 
> %fun bar :: Foo -> IO ()
> %call (foo a b)
> %code baz(a, b);
> --------------------------------------------------
> 
> But, alas, it isn't:
> 
> --------------------------------------------------
> module Strange where
> 
> import StdDIS
> 
> data Foo = F Int Char
> 
> fromFoo (F i c) = (i,c)
> toFoo   (i,c)   = F i c
> 
> bar :: Foo -> IO ()
> bar gc_arg1 =
>   case (fromFoo gc_arg1) of { a ->
>   _casm_ ``do {int a;
>              a = %0;
>              do { baz(a, b);
>                  } while(0);} while(0);'' a}
> --------------------------------------------------
> 
> Somehow the b disappeared...   :-(
> Bug, feature, or an uncool DIS again?   ;-)
> 

Support for this was just missing, but it should be there now.
New snapshot available via the GC home page.

--Sigbjorn

Reply via email to