This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
bug of gcc-2.95.2
- To: bug-gcc at gnu dot org
- Subject: bug of gcc-2.95.2
- From: "H.Saito" <saito at densan dot co dot jp>
- Date: Wed, 02 Aug 2000 10:49:54 +0900
To : bug-gcc@gnu.org
From: saito@densan.co.jp (Hideo Saito)
Title: bug of gcc-2.95.2
Hello. My name is H.Saito.
I report you a bug of gcc-2.95.2.
Please reference sss.c and error log.
I use gcc-2.95.2 at NetBSD-1.4.2 with -mabicalls -G0 -mips3 flags.
If specify no -O flag or no -mabicalls, I get expected result.
% gcc -o sss sss.c -mabicalls -G0 -mips3 -mcpu=r4000
% sss
x=0x7fffffff, y=0x7f <----- SUCCESS!!!
x=0x7fffffff, y=0x7f
%
Gcc compile this source code
x = x + 0x40000000 ;
x = x + 0x40000000 ;
to this assemble code
la $5,-2147483648($5)
and gas assemble to this code
lui $at,0x8000
daddu $5,$at,$5
but gcc should comile to this code
lui $at,0x8000
addu $5,$at,$5
because x is int type variable.
Thank you. Good bye.
------------------------------------------------------------------------
% cat sss.c
zgffour(int x)
{
register y;
if (x < 0) {
x = x + 0x40000000;
x = x + 0x40000000;
}
y = x / 0x1000000;
printf("x=0x%x, y=0x%x\n", x, y);
}
main()
{
zgffour(-1);
zgffour(0x7fffffff);
}
% gcc -o sss sss.c -O -mabicalls -G0 -mips3 -mcpu=r4000
% sss
x=0x7fffffff, y=0xffffff80 <----- ERROR!!!
x=0x7fffffff, y=0x7f
%