Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006516OCamlMiscpublic2014-08-15 15:582014-08-17 23:12
Reporterstedolan 
Assigned Tolefessan 
PrioritylowSeverityminorReproducibilityN/A
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version4.03.0+dev 
Summary0006516: Dubious code in testsuite
Descriptiontests / lib-dynlink-bytecode / stub1.c contains the following code:

    value stub1() {
      CAMLlocal1(x);
      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
(0012016)
lefessan (developer)
2014-08-17 23:12

I committed a new version:
value stub1() {
  CAMLparam0();
  CAMLlocal1(x);
  printf("This is stub1!\n"); fflush(stdout);
  x = caml_copy_string("ABCDEF");
  CAMLreturn(x);
}
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
2014-08-17 23:12 lefessan Resolution open => fixed
2014-08-17 23:12 lefessan Assigned To => lefessan


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker