Infinite loop in dcraw with current GCC versions

Manuel López-Ibáñez lopezibanez@gmail.com
Mon Mar 2 11:09:00 GMT 2015


On 1 March 2015 at 12:44, Andrew Haley <aph@redhat.com> 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"
>> (http://c-faq.com/aryptr/ary2dfunc2.html), 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.

Cheers,

Manuel.



More information about the Gcc-help mailing list