Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
* Digital Unix 3.2C optimizer bug?
@ 1996-01-31  5:00 Jamie Watson
  0 siblings, 0 replies; only message in thread
From: Jamie Watson @ 1996-01-31  5:00 UTC (permalink / raw)



It appears that I have also stumbled across a fairly nasty optimizer bug in
my transition to Digital Unix 3.2C.  I am porting some pretty old C code in
our application.  Why does it so often seem to be the sources that *you*
didn't write that cause the problems?  In this case, one of our programs
contains the following:

    for (size = 0, 
         sqlvars = (GetPutFlag == FETCHFLG ? f_desc->sqlvar : i_desc->sqlvar),
         i = (GetPutFlag == FETCHFLG ? f_desc->sqld : i_desc->sqld);
         i > 0; i--, sqlvars++) 

Now, this isn't the most wonderful C code in the world, but it certainly looks
to me as if it is completely legal, given that all the variables are declared
with the appropriate types and such.  I'm not including the complete context
here, because I'm not looking for someone to debug the program, I'm looking
for (or hoping for) confirmation of a compiler bug.

When this program is compiled, the value of "i" after the loop initialization
is incorrect; in fact, what it contains is the same value that was assigned
to "sqlvars".  I have found that if I reverse the order of the second and
third lines, the problem is solved and the program runs correctly.  Also, if
I simply turn off optimization when compiling this file, the problem is gone
and the program runs.

So, am I safe in assuming that this is a compiler bug?  Has anyone ever seen
or heard of such a bug in Digital Unix 3.2C?  Even better, does anyone know
if there is a patch available that fixes this problem?

Thanks.

jw



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1996-01-31  5:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-01-31  5:00 Digital Unix 3.2C optimizer bug? Jamie Watson

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