compiler trashes edx register when using -pg on x86

Dimitris Michailidis dimitris@darkside.engr.sgi.com
Wed Mar 31 23:54:00 GMT 1999


> >When compiling with -pg on linux the compiler generates a call to mcount in
> >each function, but right before this call it loads edx without saving its
> >original contents.  This causes code using regparm to pass arguments in
> >registers to crash.  As mcount does not appear to be using the value loaded
> >into edx, why does the compiler trash this register?  It appears that just
> >eliminating that extra load will make things work so why is that load there
> >at all?
>
> Please see the docs regarding how to report bugs.  E.g. you didn't
> specify the compiler version info.
>
>         tq vm, (burley)

All recent versions of gcc/egcs have this problem.  It's the case for gcc 2.7,
2.8 and versions of egcs up to and including 1.1.1.  It was also present in an
egcs snapshot I got at the end of February.

----
Dimitris Michailidis			dimitris@engr.sgi.com




More information about the Gcc-bugs mailing list