Hi all,

I try to debug this in -g -O0 option. But the subfunc debug info all goes
wrong.

#include "stdio.h"

typedef struct _x{
int y;
int z;
}X;
int subfunc(int a,int b,int c,X d)//i=>r0 j=>r1 k=>r2 l.y & l.z =>stack
{
        printf("a %x b %x c %x d.y %x d.z %x\n",a,b,c,d.y,d.z);
}
int main()
{
        int i=0,j=1,k=2;
        X l={3,4};
        printf("i %x j %x k %x l.y %x l.z %x\n",i,j,k,l.y,l.z);
        subfunc(i,j,k,l); //i=>r0 j=>r1 k=>r2 l.y=>r3 l.z=>stack

        return 1;
}

When I try to put struct l into the fourth parameter. gcc4.1.1 put l.y into r3
and l.z into stack and then call subfunc. In the subfunc gcc4.1.1 use stack
directly. 
And parameter sequence in subfunc will be wrong in the debuger.  b's address is
a. c's address is b , a & d are any unknown value.

But it'll only give your problem on debug. The result is correct.

Calilon Huang
Beijing


-- 
           Summary: arm ABI bug in transfer structure on the 4th parameter
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: h_happy at 263 dot net
 GCC build triplet: elf
  GCC host triplet: x86
GCC target triplet: arm


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31004

Reply via email to