2 ms·
Compile this program with -fsanitize=undefined: #include <stddef.h> #include <inttypes.h> int main(int argc, char **argv) { uint8_t msg[] = { 255
by jwilk 9y ago
Compile this program with -fsanitize=undefined:
#include <stddef.h>
#include <inttypes.h>
int main(int argc, char **argv)
{
uint8_t msg[] = { 255 };
size_t i = 0;
size_t c_index = 255;
return msg[i] << ((c_index % 4) * 8);
}
You get:
runtime error: left shift of 255 by 24 places cannot be represented in type 'int'