compiler trashes edx register when using -pg on x86

Dimitris Michailidis dimitris@darkside.engr.sgi.com
Tue Mar 9 16:12: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?

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



More information about the Gcc-bugs mailing list