Bug 000202

When Created: 01/25/1998 14:17:24
Against DJGPP version: 2.01
By whom:
Abstract: Compiling programs with nested functions and -pg generates buggy code
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)

   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.

Note added: 01/27/1998 12:54:02
By whom:
This is not a DJGPP problem. It's a genuine FSF bug in gcc itself.

(gcc- 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

Workaround added: 01/27/1998 12:55:06
By whom:
Update gcc.

Closed on 04/12/1999 10:00:27: This is a bug in GCC 2.7.2 which is fixed in later GCC versions
By whom:

  webmaster     delorie software   privacy  
  Copyright 2010   by DJ Delorie     Updated Jul 2010