You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[CN-Exec] Invalid_argument("Bytes.create") during source injection #80
You don't need the argument for b but you do need the increment on a.
int a;
void b(int x) { ++a; }
% cn test cred_in.c
cn: internal error, uncaught exception:
Invalid_argument("Bytes.create")
Raised by primitive operation at Stdlib.really_input_string in file "stdlib.ml", line 439, characters 10-26
Called from Cn__Fulminate__Source_injection.move_to.aux in file "lib/fulminate/source_injection.ml", line 132, characters 10-49
Called from Cn__Fulminate__Source_injection.inject in file "lib/fulminate/source_injection.ml", line 195, characters 18-78
... 8< ...
% cn --version
git-da48cddb0-dirty [2025-04-15 17:09:21 +0100]
% cn test cred_in.c
./cred_in-exec.c:18:30: error: too few arguments provided to function-like macro invocation
18 | ++CN_STORE(CN_LOAD(a, ++a));
| ^
/Users/guso/.opam/default/lib/cn/runtime/include/cn-executable/utils.h:597:9: note: macro 'CN_STORE' defined here
597 | #define CN_STORE(LV, X) CN_STORE_OP(LV, , X)
| ^
./cred_in-exec.c:18:6: error: use of undeclared identifier 'CN_STORE'
18 | ++CN_STORE(CN_LOAD(a, ++a));
| ^
2 errors generated.
It looks like this should first be written ++CN_STORE(CN_LOAD(a), ++a); and after a bit of comparison, second actually be CN_PREFIX(++,a); which doesn't exist yet.
Activity
peterohanley-galois commentedon Apr 17, 2025
I tried to patch around it and I got this error:
It looks like this should first be written
++CN_STORE(CN_LOAD(a), ++a);and after a bit of comparison, second actually beCN_PREFIX(++,a);which doesn't exist yet.peterohanley-galois commentedon Apr 17, 2025
Actually AIL doesn't have a
Prefixconstruct and the AIL for this example is already rewritten toa = a + 1, so the error is in the templatingpeterohanley-galois commentedon Apr 17, 2025
The approach of using
bboxherecn/lib/fulminate/fulminate.ml
Line 150 in 6251485
It doesn't always preserve comments anyway:
peterohanley-galois commentedon Apr 17, 2025
I have a hack that fixes this, I'll post it as a draft PR.