This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GCC 3.2.1 Bug on XScale?
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: "Zhang, Yun" <yun dot zhang at intel dot com>
- Cc: "'gcc at gcc dot gnu dot org'" <gcc at gcc dot gnu dot org>
- Date: Fri, 21 Mar 2003 10:39:49 -0500
- Subject: Re: GCC 3.2.1 Bug on XScale?
- References: <A577A8CE35DBD211AC3F00A0C9E0115406598C30@bjsmsx90.bj.intel.com>
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