tinycc-devel
[Top][All Lists]
Advanced

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

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


From: kf
Subject: Re: [Tinycc-devel] Bug Report (offset+cast)
Date: Fri, 11 May 2007 17:52:50 +0300

On 5/11/07, Gil Dabah <address@hidden> wrote:
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?

Happens here too. However,

short word = *(short*)(s+1);

works as expected.


Thanks,
Gil


_______________________________________________
Tinycc-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/tinycc-devel






reply via email to

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