Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation of "spacetime_snapshot.c" breaks if configured with `-force-safe-string' #7658

vicuna opened this issue Oct 16, 2017 · 3 comments


Copy link

vicuna commented Oct 16, 2017

Original bug ID: 7658
Reporter: cspiel
Assigned to: @mshinwell
Status: resolved (set by @mshinwell on 2017-10-20T09:44:28Z)
Resolution: duplicate
Priority: normal
Severity: minor
Platform: amd64
OS: GNU/Linux
OS Version: 4.9.0
Target version: 4.06.0 +dev/beta1/beta2/rc1
Category: runtime system and C interface

Bug description

If the current git sources (0b09fb5) are
configured with `-force-safe-string' the compilation of module
"spacetime_snapshot.c" breaks with the following error message:

In file included from ../byterun/caml/alloc.h:24:0,
from spacetime_snapshot.c:23:
spacetime_snapshot.c: In function ‘copy_string_outside_heap’:
../byterun/caml/mlvalues.h:256:23: error: passing argument 1 of ‘memmove’ discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
#define String_val(x) ((const char *) Bp_val(x))
spacetime_snapshot.c:359:11: note: in expansion of macro ‘String_val’
memmove(String_val(result), s, len);
In file included from spacetime_snapshot.c:19:0:
/usr/include/string.h:46:14: note: expected ‘void *’ but argument is of type ‘const char *’
extern void *memmove (void *__dest, const void *__src, size_t __n)
cc1: all warnings being treated as errors

Steps to reproduce

./configure -flambda -force-safe-string -no-naked-pointers -spacetime -with-frame-pointers
make world.opt

Additional information

The origin of this problem sits in file "mlvalues.h". There macro
String_val' is conditionally defined with respect to CAML_SAFE_STRING'.

However, the solution will have to be non-trivial as the error points
to the change in semantics, i.e. value vs. address.

Copy link

vicuna commented Oct 16, 2017

Comment author: @gasche

Thanks for the report! Hopefully we can fix it before the 4.06 release.

Copy link

vicuna commented Oct 20, 2017

Comment author: @mshinwell

Please see #1439

@vicuna vicuna closed this as completed Oct 20, 2017
Copy link

vicuna commented Oct 20, 2017

Comment author: cspiel

With the patch the compilation succeeds.
Spacetime profiling works. THX!

@vicuna vicuna added this to the 4.06.0 milestone Mar 14, 2019
@vicuna vicuna added the bug label Mar 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

2 participants