[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] Bug Report (offset+cast)

From: Gil Dabah
Subject: [Tinycc-devel] Bug Report (offset+cast)
Date: Fri, 11 May 2007 16:58:13 +0300
User-agent: Thunderbird (Windows/20070221)


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?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]