Bug in gcc and egcs with .linkonce

Ralf Scheidhauer scheidhr@dfki.de
Thu Aug 27 01:42:00 GMT 1998


Maybe the following is a known problem, but I could not find any
reference to it so far.

The following program crashes, if you compile with both gcc 2.7 and
egcs 1.02 under Windows NT, if you do NOT use -O:

     gcc -o bug bug.cc


---- bug .cc --------------------------------------------------
inline void bug(int *x)
{
  switch (*x) {
  case 1: *x=2; break;
  case 2: *x=3; break;
  case 3: *x=4; break;
  case 4: *x=5; break;
  case 5: *x=6; break;
  default: break;
  }
}

int main()
{
  int x = 4;
  bug(&x);
}
---------------------------------------------------------------

Looking at the assembler code, the reason seems to be the 
".linkonce discard" being used for the inline function. Unfortunately
a ".text" gets in front of the jump table being generated for the
switch statement. It then crashes if "bug" is not being inlined. 

Anyone know how to fix that? Otherwise I cannot debug my application
at all! I puzzles me that no one else has had that problem before???


Cheers
Ralf

PS: Please answer via email.


---
Ralf Scheidhauer                   Tel:    +49 681 302-5619
Programming Systems Lab, DFKI GmbH Fax:    +49 681 302-5615
Universität des Saarlandes,        Mobile: +49 172 6758800
Postfach 15 11 50                  Email:  scheidhr@dfki.de
D-66041 Saarbrücken, Germany       WWW:    http://www.ps.uni-sb.de/~scheidhr

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".



More information about the Cygwin mailing list