From: | "Christopher Glaeser" <cdg@nullstone.com> |
Newsgroups: | comp.compilers |
Date: | Fri, 15 May 2009 23:07:31 -0700 |
Organization: | Compilers Central |
References: | 09-04-072 09-04-086 09-05-010 09-05-022 09-05-028 09-05-038 09-05-039 09-05-050 09-05-055 09-05-065 09-05-069 |
Keywords: | optimize |
Posted-Date: | 18 May 2009 12:52:32 EDT |
> If you want to implement an optimization that needs initialized local
> arrays to preserve the behaviour, it's certainly worth considering.
> Or you may find a different way to preserve the behaviour.
Initialize to what?
Suppose you are responsible for maintaining a C compiler and you
receive a defect report with a program that works fine without
optimization but generates a divide by zero exception with
optimization. You analyze the program and determine that the divide
by zero is in a function that references an uninitialized local array
element. Without optimization, the array element has a value of 1 due
to the more-or-less random state of the stack on entry to the
function. With optimization, changes to register and stack
assignments cause changes to the state of the stack on entry to the
function, and now the uninitialized local array element has the value
0, which causes the divide by zero exception.
How would you respond to this defect report?
Best,
Christopher
Return to the
comp.compilers page.
Search the
comp.compilers archives again.