This is the mail archive of the
mailing list for the GCC project.
Re: Infinite loop in dcraw with current GCC versions
- From: Andrew Haley <aph at redhat dot com>
- To: Manuel López-Ibáñez <lopezibanez at gmail dot com>
- Cc: dcoffin at shell dot cybercom dot net, "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>, Conchúr Navid <conchur at web dot de>, Sven Eckelmann <sven at narfation dot org>, René Rebe ExactCODE <rene at exactcode dot com>
- Date: Mon, 02 Mar 2015 11:31:43 +0000
- Subject: Re: Infinite loop in dcraw with current GCC versions
- Authentication-results: sourceware.org; auth=none
- References: <CAESRpQDZs=EZTAj7bO5Dn8d=M8p8MuN7_s__XNatnL2BWgs9wA at mail dot gmail dot com> <CAESRpQBx7V=O-pH5Ckvt=XpJHYyEwCyZGz1HQTByqdKftQC0MQ at mail dot gmail dot com> <20150227190206 dot GA6175 at shell dot cybercom dot net> <CAESRpQCCWVQGeWMByFFiX6MLoA-VxJ3AAp5u99VdOy7h8SsgQg at mail dot gmail dot com> <20150227204552 dot GA8916 at shell dot cybercom dot net> <CAESRpQAbO-6Zy3FBvR56NDiAGJg8CZYtSTUPLR5jud0baNHKHg at mail dot gmail dot com> <54F2FBA6 dot 1060308 at redhat dot com> <CAESRpQA466GP9CSv17Dcw3t7LyNrhatJ7Rh13OEopGj6wVHE2Q at mail dot gmail dot com> <54F44610 dot 5010101 at redhat dot com> <CAESRpQCXvqrKfnuzGNY5=Qgm8DsHvkuVRWnD93HZzFynUMY22A at mail dot gmail dot com>
On 03/02/2015 11:26 AM, Manuel López-Ibáñez wrote:
> On 2 March 2015 at 12:14, Andrew Haley <email@example.com> wrote:
>> On 03/02/2015 11:08 AM, Manuel López-Ibáñez wrote:
>>> 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))[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.
>> It may not be, but the passage I sent you is.
> The way I read that passage is that *cam_xyz is of type double and
> *(*cam_xyz) is of type 'double', but it doesn't say anything about
> dereferencing the pointer &(*(*cam_xyz)) beyond any limits.
Would you like me also to quote you the section of the standard which
says you cannot address beyond the end of an array? That is not in
any doubt so I did not post it.
> This also raises the question of whether is valid to initialize a
> multidimensional array with memset as memset(&cam_xyz, 0,
It does not because bytes are special: there is explicit language in
the standard which says that any object pointer may be converted to a
byte pointer, and that byte pointer may be used to address all of the