delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/01/13/13:09:39

From: wrh AT placer1 DOT wimsey DOT com (William Hughes)
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Optimization funnies
Reply-To: wrh AT placer1 DOT wimsey DOT com
Date: Thu, 12 Jan 95 20:55:20 PST

Hello, just thought I'd post something that happened to me on the way
to the forum last night...

With optimization set to -O1 the code:

	cout << "\nDebug0";
	cout << "\nDebug1";

works fine.

With optimization set to -O3 the above code dies in execution after
printing "Debug0".  It complains about a general protection fault
with a non-null pointer down inside some function labelled:

	(mangled to protect the innocent)_ios...

Now, I realize that this is probably a gcc thing, but after all the talk
about optimisation lately, I just thought I'd share it.  Remove the optimization
and all is fine.  Let me tell you, it took some sad amount of finger sweat trial
and error to find this, and I still don't understand it.  I ended up deleting
all the code between the two above lines and there just wasn't anything wrong.
Only noticed the above after invoking all the compile/link commands by hand and
ommiting the optimization and other stuff as too much typing.  Ha Ha Hoo Hoo Hee Hee.

I was using version 1.11m5 with no debug info.

In the hope that this may save someone a few hours,
Rattled and Uncertain,
William

"Demon of Chaos"!?!  Lions and Tigers and Bears, Oh My!


- Raw text -


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