On Tue, Aug 16, 2011 at 7:25 PM, Richard W.M. Jones <r...@annexia.org> wrote: > On Tue, Aug 16, 2011 at 11:37:03AM +0400, Dmitry Bely wrote: >> C compiler first puts "list" pointer on stack and then calls >> caml_copy_string(*s), potentially invalidating "list". Of course, the >> stack copy of "list" is not registered as a global root so wrp_ml_cons >> gets an invalid value. > > I think this must be a bug in your C compiler. The address of list is > stashed in the roots struct,so the C compiler should know that list > can be changed by the call to caml_copy_string.
Why the compiler should worry about that? It evaluates parameters form right to left and that behavior fully conforms to the C standard (evaluation order is unspecified). > What C compiler / version is this? Microsoft Visual C++ 10.0 ;-) - Dmitry Bely -- Caml-list mailing list. Subscription management and archives: https://sympa-roc.inria.fr/wws/info/caml-list Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs