This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GCC 3.2.1 Bug on XScale?


On Fri, Mar 21, 2003 at 04:40:21PM +0800, Zhang, Yun wrote:
> Hi, all
> 
> I found out that with a simple test case: (GCC configured --target=arm-linux
> --prefix=$PREFIX $HOST --with-headers=$KERNEL/include --disable-shared
> --disable-threads --enable-languages="c" --nfp --with-cpu=xscale
> --without-fp --with-softfloat-support=internal )
> 
> "
> int main () {
> 	char ch = -2;
> 	int i = ch;
> 	printf ("%d", i);
> }
> 
> GCC 3.2.1 compiled code is (Debug version. Release is right):
> "
> mvn r3, #1
> strb r3, [fp, #-13]
> ldrb r3, [fp, #-13] @zero-extendedqisi2
> ......."
> 
> In fact, r3 should be signed extended. Embedded VC generated code seems to
> be correct:
> "
> mvn r0, #1
> strb r0, [sp, #4]
> ldrsb r1, [sp, #4]
> "
> Is this a gcc bug? Which gcc patch could fix this problem? 

I believe this is not a bug.  "Char" is unsigned by default on
arm-linux, so the load should in fact _not_ be sign extended.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]