Re: behavior-preserving optimization in C, was compiler bugs

"Christopher Glaeser" <cdg@nullstone.com>
Fri, 15 May 2009 23:07:31 -0700

          From comp.compilers

Related articles
[6 earlier articles]
Re: compiler bugs anton@mips.complang.tuwien.ac.at (2009-05-06)
Re: compiler bugs cfc@shell01.TheWorld.com (Chris F Clark) (2009-05-07)
Re: compiler bugs anton@mips.complang.tuwien.ac.at (2009-05-10)
Re: behavior-preserving optimization in C, was compiler bugs cdg@nullstone.com (Christopher Glaeser) (2009-05-12)
Re: behavior-preserving optimization in C, was compiler bugs anton@mips.complang.tuwien.ac.at (2009-05-13)
Re: behavior-preserving optimization in C, was compiler bugs dnovillo@acm.org (Diego Novillo) (2009-05-15)
Re: behavior-preserving optimization in C, was compiler bugs cdg@nullstone.com (Christopher Glaeser) (2009-05-15)
Re: behavior-preserving optimization in C, was compiler bugs mcintosh@cup.hp.com (Nathaniel McIntosh) (2009-05-16)
Re: behavior-preserving optimization in C, was compiler bugs pertti.kellomaki@tut.fi (Pertti Kellomaki) (2009-05-18)
Re: behavior-preserving optimization in C, was compiler bugs gah@ugcs.caltech.edu (glen herrmannsfeldt) (2009-05-18)
Re: behavior-preserving optimization in C, was compiler bugs torbenm@pc-003.diku.dk (2009-05-19)
Re: behavior-preserving optimization in C, was compiler bugs torbenm@pc-003.diku.dk (2009-05-19)
Re: behavior-preserving optimization in C, was compiler bugs gneuner2@comcast.net (George Neuner) (2009-05-19)
[15 later articles]
| List of all articles for this month |

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



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.