Re: Infinite loop in dcraw with current GCC versions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1 March 2015 at 12:44, Andrew Haley <aph@xxxxxxxxxx> 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.





[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux