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]

Is this a bug?


I'm trying to use linux-x86 hosted egcs-1.0.2 to compile code for a
PowerPC and think I found
and error in the code that is generated. The C code and the assembly
code that is generated is below.
For the second add (temp=base + (unsigned long)0x8000;) the compiler
seems to want to do a
signed addition even though all the variables are unsigned. When I try
compiling this with a x86
targeted version of the compiler everything seems ok. Has anyone else
seen this problem?

main()
{
  unsigned long base, temp;
  base=0x02800000;
//      lis 0,0x280		Load upper half of R0 with 0x0280 so 
//				  that R0 becomes 0x02800000
//	stw 0,8(31)		Store in local variable sec of stack
frame
//				  - variable name = base

  temp=base + (unsigned long)0x7fff;
//	lwz 0,8(31)		Load R0 with base
//	addic 9,0,32767		add 0x7fff
//	stw 9,12(31)		store as temp in stack frame

  temp=base + (unsigned long)0x8000;
//	lwz 9,8(31)		Load R9 with base
//	addis 11,9,0x1		add 0x10000 and store in R11 - why is
this instruction here?
//	addi 0,11,-32768	add 0x8000 and store in R0
//	stw 0,12(31)		store R0 as temp in stack frame

  
}




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