An article I alluded to

Miles Bader miles@gnu.org
Fri Jul 28 14:35:00 GMT 2006


Jeffrey Law <law@redhat.com> writes:
> Whomever wrote it doesn't know what they're talking about, at least
> not in regards to efficiency of storage access in general purpose
> C compilers.

Indeed.

I guess there _are_ machines/environments where static allocation is
better, because I've run across programs where they quite annoyingly
declare just about every (semantically) "local" variable as static.

In particular, many of the EEMBC benchmarks do this (or at least did at
one time), for apparently no good reason at all.  I guess the original
author had one of these funny machines.

As this screws up gcc's optimization big time, I actually wrote a gcc
patch at one time that detected such "artifically static" variables and
changed them into normal automatic variables (at the time I was
comparing EEMBC results for gcc versus Greenhill's compiler -- the
latter already dealt with such artifically static variables, though as I
recall, it did so in an unsafe manner).

-Miles
-- 
In New York, most people don't have cars, so if you want to kill a person, you
have to take the subway to their house.  And sometimes on the way, the train
is delayed and you get impatient, so you have to kill someone on the subway.
  [George Carlin]



More information about the Gcc-help mailing list