Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Different behaviour in native and bytecode compilations (Compiler Bug?)
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-03-02 (15:08)
From: nickgrey@s...
Subject: [Caml-list] Different behaviour in native and bytecode compilations (Compiler Bug?)
Hi Camlers. 

I have a program which uses the ncurses library.  It runs as expected when 
compiled natively, and when bytecode compiled in custom runtime mode.  But 
when compiled with ncurses bindings as a shared library, it produces 
different, seemingly incorrect output. 

I've created a minimal example of this behaviour.  The code is too still too 
big to attach, as it obviously includes bindings for ncurses. but I've 
archived it here (60KiB): 

Running make will build 3 executables. 

bug_native and bug_bytecode1 produce the output I expect (2 vertical rows of 
Xs), something like this: 



but with bug_bytecode2, which is exactly the same code, but linked 
differently, the second row of Xs are horizontal, rather than vertical: 



Any suggestions as to why this might happen?  I'm not an expert in O'Caml 
and especially not in using C bindings, so I could be doing something wrong, 
but the fact that it only happens with certain linking options makes me 
suspect it is a compiler bug.  Or could it be something wrong with the C 
bindings for ncurses?  (I didn't write them myself.) 

I've checked in the ocamlopt documentation, and I'm not using any of the 
constructs which behave differently under native compilation, but I don't 
think that's relevant anyway. 

I'm using O'Caml 3.07+2 and ncurses 5.4. 

Thanks in advance,

PS. Thanks to all those who replied to my previous query on polymorphic 

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: