target/8624: gcc 2.95.3 (arm-linux-gcc) char type problem.
mchen@transdimension.com
mchen@transdimension.com
Sat Nov 23 01:16:00 GMT 2002
>Number: 8624
>Category: target
>Synopsis: gcc 2.95.3 (arm-linux-gcc) char type problem.
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Nov 18 11:56:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Transdimension
>Release: gcc version 2.95.3 20010315 release
>Organization:
>Environment:
The problem always occurs when a progrom is cross-compiled
on x86 linux for arm targets.
>Description:
A char variable taking a negative value will be cast
to a positive result when being cast to a int variable.
If it is modified by "signed char" instead of just "char"
at declearation, the problem is gone.
>How-To-Repeat:
Compile the attached file t.c on a pc with
gcc t.c -o t
Run the ./t, the result will be:
i=-128 j=-128 i=ffffff80 j=ffffff80
ii=-128 jj=-128 ii=ffffff80 jj=ffffff80
Compile with
arm-linux-gcc t.c -o t
Run the ./t on an arm platform, the result will be:
i=-128 j=-128 i=ffffff80 j=ffffff80
ii=128 jj=128 ii=80 jj=80
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="t.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="t.c"
LyogCWZpbGU6IHQuYwoqLwoKI2luY2x1ZGUgPHN0ZGlvLmg+CgptYWluKCkKeyAKICBzaWduZWQg
Y2hhciAgaTsgaW50ICBqOwogICAgICAgICBjaGFyIGlpOyBpbnQgamo7CgoJaSA9IC0xMjg7Cglq
ID0gaTsKCWlpID0gLTEyODsKCWpqID0gaWk7CgoJcHJpbnRmKCJcbiAgaT0lZCAgaj0lZCAgIGk9
JXggIGo9JXhcbiIsIGksIGosICBpLCBqKTsKCXByaW50ZigiXG4gaWk9JWQgamo9JWQgIGlpPSV4
IGpqPSV4XG4iLGlpLGpqLCBpaSxqaik7Cn0KCi8qIAlyZXN1bHQgb24gYSB4ODYgcGM6CgogIGk9
LTEyOCAgaj0tMTI4ICAgaT1mZmZmZmY4MCAgaj1mZmZmZmY4MAoKIGlpPS0xMjggamo9LTEyOCAg
aWk9ZmZmZmZmODAgamo9ZmZmZmZmODAKKi8KCi8qIAlyZXN1bHQgb24gYW4gYXJtIHBsYXRmb3Jt
OgoKICBpPS0xMjggIGo9LTEyOCAgIGk9ZmZmZmZmODAgIGo9ZmZmZmZmODAKCiBpaT0xMjggamo9
MTI4ICBpaT04MCBqaj04MAoqLwoK
More information about the Gcc-prs
mailing list