------- Comment #2 from kraftche at cae dot wisc dot edu 2010-05-11 00:29 ------- Subject: Re: optimization bug initializing from cast array
On 05/10/2010 07:22 PM, pinskia at gcc dot gnu dot org wrote: > ------- Comment #1 from pinskia at gcc dot gnu dot org 2010-05-11 00:22 > ------- > The problem is that you are reading past the array (vals[0]). > > I don't think that I am. Or rather, I understand that I am reading off the end of the first row of a 2D array, but not past the end of the entire 2D array. It is fairly common when combining C and C++ code to assume things such about the memory layout of an array. For example that the array rows are consecutive in memory such that reading one position past the end of the first row of a 2D array is equivalent to reading the first element of the second row. And it works fine with without optimization. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44069