comp.lang.ada
 help / color / mirror / Atom feed
* Optimization Defaults
@ 1999-12-13  0:00 Roger Racine
  1999-12-19  0:00 ` Robert Dewar
  1999-12-27  0:00 ` Jeffrey L Straszheim
  0 siblings, 2 replies; 3+ messages in thread
From: Roger Racine @ 1999-12-13  0:00 UTC (permalink / raw)


I have already forgotten the original thread this was in, but I have
some more information for those who think I am being paranoid about
not using high levels of optimization.

Based on Robert Dewar's strong statement to trust the GCC optimizer,
and based on my own knowledge of the use of the optimizer when
building GCC itself, I suggested that there should be no problem using
-O2 for GCC on a current project.  Immediately someone said that he
had gotten burned using GCC a couple years ago (version 2.7.2, I
believe he said he was using) in two different ways (using C, but the
optimizer is common, right?).  In one case he was trying to use an
initializer on a variable that was not used except in a call to
another function, and the optimizer got rid of the initialization, so
the value was incorrect.  In the other case he had declared a variable
"volatile", and the optimizer ignored it.  In both cases the
no-optimize case worked fine.  

He vaguely remembered other problems but could not think of more than
these two specific cases.  His thought was that most of the problems
were in the area of embedded systems (such as the use of "volatile"),
that would not be used as much on workstation tools (such as GCC).

In any event, we will try the current version of GCC with the
optimizer (we need the performance improvement).  We can hope the
problems my colleague saw were fixed.

Unfortunately for this newsgroup, the project is being done in C.  I
have asked for permission to use Ada, but have not received an answer.

Roger Racine




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Optimization Defaults
  1999-12-13  0:00 Optimization Defaults Roger Racine
@ 1999-12-19  0:00 ` Robert Dewar
  1999-12-27  0:00 ` Jeffrey L Straszheim
  1 sibling, 0 replies; 3+ messages in thread
From: Robert Dewar @ 1999-12-19  0:00 UTC (permalink / raw)


In article <38553cf0.22235803@newsnew.draper.com>,
  rracine@myremarq.com (Roger Racine) wrote:
> Based on Robert Dewar's strong statement to trust the GCC
optimizer,
> and based on my own knowledge of the use of the optimizer when
> building GCC itself, I suggested that there should be no
problem using
> -O2 for GCC on a current project.  Immediately someone said
that he
> had gotten burned using GCC a couple years ago (version 2.7.2,
I
> believe he said he was using) in two different ways (using C,
but the
> optimizer is common, right?).



No one claimed that there was no possibility of bugs that
cause the compiler to malfunction at one optimization level
where it succeeds at another. But the point is:

1) There are relatively few such problems because the gcc
backend is pretty mature at this stage.

2) Going from -O0 to -O2 is by no means a guarantee that the
number of such bugs will increase, we have seen (rarely, but
then optimization bugs are rare in general) cases in which
a bug appeared only at -O0 and disappeared at -O2.

One thing to be aware of is that the punishment for erroneous
code is often more severe at -O2, so if you write junk code,
you may well find that the code appears to "work" at -O0 and
appears to "fail" at -O2. In such cases, using -O2 is actually
helpful in helping to smoke out such bugs


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Optimization Defaults
  1999-12-13  0:00 Optimization Defaults Roger Racine
  1999-12-19  0:00 ` Robert Dewar
@ 1999-12-27  0:00 ` Jeffrey L Straszheim
  1 sibling, 0 replies; 3+ messages in thread
From: Jeffrey L Straszheim @ 1999-12-27  0:00 UTC (permalink / raw)


Roger Racine wrote:

> Unfortunately for this newsgroup, the project is being done in C.  I
> have asked for permission to use Ada, but have not received an answer.

I too am forced to use C at work. In this case I'm the only Ada-aware
programer on staff, and anything that I write may have to be maintained
by someone else if I leave, so I can't really blame them. However, there
are some modules I'll be writing soon that aren't likely to be heavily
maintained, and so the source will not be reviewed. I plan to do them
in Ada, just for my own amusement.

So I guess this is a case of "don't ask, don't tell" for Ada.

-- Jeffrey Straszheim          
-- Systems Engineer, Programmer
-- http://www.shadow.net/~stimuli
-- stimuli AT shadow DOT net




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1999-12-27  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-12-13  0:00 Optimization Defaults Roger Racine
1999-12-19  0:00 ` Robert Dewar
1999-12-27  0:00 ` Jeffrey L Straszheim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox