Hello

I just tried to compile diStorm (http://ragestorm.net/distorm/) with TCC.
Everything works well, except one bug I found.

It seems you can't cast a pointer from a specified offset:

char* s = "\x34\x34\x12";
short word = *(short*)&s[1]; // <--buggy
printf("%x", word);

will print 34 instead of 1234 (on LE machine, of course).
I also took a look at the generated code and it seems it simply ignores the cast to short and reads a byte. The bug can be triggered when specifying offset to access the buffer, without the [XXX] it won't generate erroneously code.

Can anyone confirm?

Thanks,
Gil


_______________________________________________
Tinycc-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to