bad generation of stabs under i386-coff with -O2 -finline-functions

Marc Espie Marc.Espie@liafa.jussieu.fr
Tue Oct 13 11:54:00 GMT 1998


On Tue, Oct 13, 1998 at 09:07:52AM -0700, Mark Mitchell wrote:
> 
>   Consider the following code:
>   // a.C
>   static struct object
> 	  {
> 	  object()
> 		  {
> 		  exit(0);
> 		  }
> 	  } o;
> 
>   // b.C
>   int main()
> 	  {
> 	  abort();
> 	  }
> 
> 
> By the way, this code isn't portable anyways.  There's nothing in the
> standard that says `o' has to be initialized before the first call to
> a function in `a.o'. 

Erm... I hope you mean b.o, right ? 


Okay, I'll admit to having cut corners a bit too short... Is that one
still not portable, or does it fit the bill better ?


// a.C
#include <iostream>

struct B
	{
	int v;

	B() { v = 42; }
	int value() const { return v; }
	};

struct A
	{
	static B o;
	int f() { return o.value(); }
	};
B A::o;


// b.C
void g()
	{
	struct A a;
	cout << a.f() << endl;
	}

-- 
	Marc Espie		
|anime, sf, juggling, unicycle, acrobatics, comics...
|AmigaOS, OpenBSD, C++, perl, Icon, PostScript...
| `real programmers don't die, they just get out of beta'



More information about the Gcc-bugs mailing list