In my obviously never-ending adventure of porting the Binary
lib to GHC, two nasty bugs in the latest GC version hit me:

-------------------------------------------------------
import StdDIS
-------------------------------------------------------
newtype Baz a = BC Int
%dis baz bp = declare {unsigned int} bp in (BC (int bp))

%fun foo :: IO (Baz a)
%code r = c_foo();
%result (baz r)
-------------------------------------------------------
newtype Blah = B Int
%dis blah x = B x

%fun bar :: Blah -> IO ()
%call (blah x)
%code c_bar( x );
-------------------------------------------------------

The following code is generated from the above spec:

-------------------------------------------------------
import StdDIS
-------------------------------------------------------
newtype Baz a = BC Int

foo :: IO (Baz a)
foo =
  _casm_ ``do {unsigned int r; int r;
               do { r = c_foo();
                   
                   %r = (int)(r);} while(0);} while(0);''
  >>= \  r  ->
  (return ((BC r)))
-------------------------------------------------------
newtype Blah = B Int

bar :: Blah -> IO ()
bar gc_arg1 =
  case gc_arg1 of { (B x) ->
  _casm_ ``do {do { c_bar( x );
                   } while(0);} while(0);''}
-------------------------------------------------------

r is declared *two* times in the first _casm_ and
x is neither declared or passed to the second one.

OK, that's it from the bug-frontier for today! I'd better
switch to my favourite shoot-em-up to calm down...   ;-)

-- 
Sven Panne                                        Tel.: +49/89/2178-2235
LMU, Institut fuer Informatik                     FAX : +49/89/2178-2211
LFE Programmier- und Modellierungssprachen              Oettingenstr. 67
mailto:[EMAIL PROTECTED]            D-80538 Muenchen
http://www.pms.informatik.uni-muenchen.de/mitarbeiter/panne

Reply via email to