delorie.com/djgpp/bugs/show.cgi | search |
Programs with nested functions will crash when compiled with -pg, e.g.: ---- #include <stdio.h> #include <stdlib.h> int main(int argc, char **argv) { int x; void Sub(void) { printf("x=%i",x); } x=random(); Sub(); return 0; } ---- main() tries to pass its %ebp to Sub() in %ecx, but the call to mcount() will destroy the register. When Sub() tries to access x, the program will crash.
This is not a DJGPP problem. It's a genuine FSF bug in gcc itself. (gcc-2.7.2.1 on Linux has the same bug, but egcs-1.0 doesn't). Looks like someone forgot to tell gcc that %ecx is in use during the startup phase of a nested function
Update gcc.
webmaster | delorie software privacy |
Copyright © 2010 by DJ Delorie | Updated Jul 2010 |