Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006516OCamlmiscpublic2014-08-15 15:582016-12-07 11:34
Assigned Tolefessan 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version4.03.0+dev / +beta1 
Summary0006516: Dubious code in testsuite
Descriptiontests / lib-dynlink-bytecode / stub1.c contains the following code:

    value stub1() {
      printf("This is stub1!\n"); fflush(stdout);
      x = caml_copy_string("ABCDEF");
      return x;

This uses CAMLlocal1 incorrectly, without CAMLparam0 or CAMLreturn. I'm working on an experimental branch of the runtime with multicore support, where this test actually crashes. It seems to work on trunk, but I think this is just by coincidence.

Am I correct in thinking this code is broken? It seems to keep the address of an out-of-scope local.
Steps To ReproduceBug doesn't trigger on trunk, but you can observe that caml_local_roots contains a dangling pointer to the out-of-scope local x after stub1() returns.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
lefessan (developer)
2014-08-17 23:12

I committed a new version:
value stub1() {
  printf("This is stub1!\n"); fflush(stdout);
  x = caml_copy_string("ABCDEF");
I hope it's correct now.

- Issue History
Date Modified Username Field Change
2014-08-15 15:58 stedolan New Issue
2014-08-17 23:12 lefessan Note Added: 0012016
2014-08-17 23:12 lefessan Status new => resolved
2014-08-17 23:12 lefessan Fixed in Version => 4.03.0+dev / +beta1
2014-08-17 23:12 lefessan Resolution open => fixed
2014-08-17 23:12 lefessan Assigned To => lefessan
2016-12-07 11:34 xleroy Status resolved => closed
2017-02-23 16:44 doligez Category Misc => misc

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker