delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/01/13/23:24:53

Date: Fri, 13 Jan 95 23:06:58 EST
From: peprbv AT cfa0 DOT harvard DOT edu (Bob Babcock)
To: enrico AT max DOT tiac DOT net
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: gcc = gcc -O2 ?
Reply-To: babcock AT cfa DOT harvard DOT edu

> DR> I also like the idea of gcc -g implying gcc -g -O0.
> 
>   I don't understand exactly what the advantages of this could possibly be.
> Will the program be easier to debug if it's slower?  Theoretically, that
> should be the only difference optimization makes...

Optimization can obscure the relationship between the source code and machine
language instructions.  As a simple example, consider a routine with two
returns.  The optimizer may combine the exit code in a single location, and
as you step through the code, you suddenly jump elsewhere when you hit one of
the returns.  Or, a variable may exist only in a register after optimization,
in which case looking at memory won't tell you its value.

- Raw text -


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