This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Infinite loop in dcraw with current GCC versions

On 1 March 2015 at 12:44, Andrew Haley <> wrote:
> On 28/02/15 16:27, Manuel López-Ibáñez wrote:
>> On the other hand,
>> &cam_xyz[0][0] should have type 'double *', and the standard does say
>> that the data is contiguously allocated, yet the c-faq says that
>> ((double *)(&cam_xyz[0][0]))[j] "is not in strict conformance with the
>> ANSI C Standard; according to an official interpretation"
>> (, although without a
>> reference to the standard, I have no idea what that means.
> Therefore the result of the inner
>     *(cam_xyz+i)
> is a one-dimensional array.  You have no permission to dereference
> beyond the end of that array, and any attempt to do so is UB.

Actually, the question that I was unsure about and I could not find a
ready answer in the standard is whether one can use ((double
*)(&cam_xyz[0][0]))[j] to address the whole multidimensional array.
The C-FAQ seems to suggest that one cannot, but it is not crystal
clear in this respect.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]