Re: Fwd: error in variable dereferencing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/20/06, Andrew Haley <aph@xxxxxxxxxxx> wrote:> Thibaud GUERIN writes:>  > hi,>  > I'm actually writing a program in C and i'm fighting with an address>  > dereferencing since some days now.>  >>  > int            the_bug(const char *fmt, ...)>  > {>  >   char    **ap;>  >   char        **s = (char **)(&fmt);>  >>  > /* __asm__ volatile ( */>  > /*           "\tleal %1, %%eax\n" */>  > /*           "\tmovl %%eax,%0\n" */>  > /*           "\tmovl %1, %%eax\n" */>  > /*           "\tmovl %2, %%ebx \n" */>  > /*           "\tmovl %%eax, (%%ebx)\n" */>  > /*           : "=m"(ap) : "m" (fmt), "m"(ap)); */>> This is wrong in so many ways I don't know where to start.>> It may be better if you try to tell us what you are trying to do.>> Redirecting gcc-help@xxxxxxxxxxxx

Not clear in the first message, (and maybe not in this one too..), sorry

This asm inline was something like a "test/patch code".
I try to have a simple :
char        **ap = (char **)(&fmt);
working, It didn't :ap was equal to &fmt BUT *ap wasn't equal to fmt (don't kown why...)
so i try by my self... to do :
ap = &fmt;*ap = fmt;
in asm inline.... (dirty i know...)
problem is :With this asm code in the binary *s is equal to fmtWithout this asm code in the binary *s isn't equal to fmt

All the 's' variable stuffs are from my debug...Again :My only aim is to have an 'ap = &fmt' valid (->ap = &fmt AND *ap = fmt)
The resulting asm was here to help you to understand wath's wrong ....I'm looking for some days now without answer...
--Thibaud

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux