delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/08/27/09:25:46

From: scheidhr AT dfki DOT de (Ralf Scheidhauer)
Subject: Bug in gcc and egcs with .linkonce
27 Aug 1998 09:25:46 -0700 :
Message-ID: <199808270818.KAA00842.cygnus.gnu-win32@laurel.ps.uni-sb.de>
To: gnu-win32 AT cygnus DOT com

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 AT dfki DOT 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 AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019