-
Notifications
You must be signed in to change notification settings - Fork 158
Open
Description
While writing a script bytecode->C->MIR compiler I hit what seems to be miscompilation of code that juggles with integer sizes.
I minified the repro as small as I could:
#include <stdio.h>
#include <stdint.h>
int64_t foo(int32_t* target, int32_t* b) {
*target = 0xAAA + *b;
return (int64_t)*target;
}
int main()
{
/* prevents inline somehow */
int64_t (*alias)(int32_t* target32, int32_t* b) = foo;
int32_t target32;
int b = -0xBBB;
printf("%ld\n", alias(&target32, &b));
}
$ c2m repro.c -O3 -el
4294967023
$ c2m repro.c -O0 -el
-273
Tested on both master
and v1.0.0
.
Metadata
Metadata
Assignees
Labels
No labels