Subject: Bug in gcc and egcs with .linkonce
From: [email-masked] (Ralf Scheidhauer)

27 Aug 1998 09:25:46 -0700
Message-ID: <[email-masked]>
To: [email-masked]

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:  [email-masked]
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
"[email-masked]" with one line of text: "help".