[PATCH m32c] PR target/32335 ICE in cselib_record_set, at cselib.c:1508
Ina Pandit
Ina.Pandit@kpitcummins.com
Mon Sep 8 15:20:00 GMT 2008
Hi,
I built a toolchain for m32c using the following,
1. gcc-4.3.1
2. binutils-2.18.50 (snapshot dated 30th July 2008)
3. newlib 1.16
4. gdb-6.8.50 (snapshot dated 11th August 2008)
I faced a problem while debugging the following application built
using this toolchain,
========================================================================
int test_fptr (int x, int y);
int (*fp)(int, int);
int test_fptr (int num1, int num2)
{
int sum;
sum = num1+ num2;
//------------------------------------------------------------------
// No.: Watch Item : Expected : Actual
// 1: num1 : D'20 : D'20
// 2: num2 : D'30 : D'259 -> Actual value is
incorrect
// 3: sum : D'50 : D'50
//------------------------------------------------------------------
return (sum);
}
int main()
{
int iAdd = 0;
fp = test_fptr;
iAdd += fp (20, 30);
return 0;
}
========================================================================
//command to build: $m32c-elf-gcc foo.c -g -mcpu=m32c -msim
//command to debug: $m32c-elf-gdb a.out
In case of m32c and m32cm targets, the value of 'num2' displayed is
incorrect. The value of the variable 'num2' is stored at a particular
location; however the address displayed is a location 4 bytes lesser
than the actual location.
Please note that the value of 'num2' displayed is correct in case
of m16c and r8c targets.
After investigating I found that the contents of '.debug_loc' and
'.debug_frame' sections are incorrect. This results in incorrect
calculation of the frame base address and (hence) incorrect
address of the local variable.
I further investigated this and found the following patch,
http://gcc.gnu.org/ml/gcc-patches/2007-06/msg01233.html
After reverting this patch, the above mentioned problem is solved.
Please let me know, if reverting this patch could cause some other
issue or if there is some other solution to this.
Thanks in advance.
Regards,
Ina Pandit
More information about the Gcc-patches
mailing list