|
|
Message-ID: <BLU0-SMTP2497A16D7145AD35F1D976CFDE10@phx.gbl>
Date: Mon, 25 Jun 2012 11:03:32 +0200
From: Frank Dittrich <frank_dittrich@...mail.com>
To: john-dev@...ts.openwall.com
Subject: Re: compiler warnings: make clean linux-x86-clang > /dev/null
On 06/25/2012 10:41 AM, Solar Designer wrote:
> On Mon, Jun 25, 2012 at 10:26:22AM +0200, Frank Dittrich wrote:
>> But some definitely look suspicious:
>>
>>
>> single.c:330:8: warning: array index of '1' indexes past the end of an
>> array (that contains 1 elements)
>> [-Warray-bounds]
>> if (first->data[1]) {
>> ^ ~
>> In file included from single.c:15:
>> In file included from ./loader.h:16:
>> ./list.h:19:7: note: array 'data' declared here
>> char data[1];
>> ^
>
> This is as intended.
I thought so. After sending my mail I did a git blame, and saw that it
was that way virtually "forever".
> A real concern is
> that some compiler might think that since the behavior is undefined
> anyway, it can optimize this out, or maybe trap it as a runtime fault.
Yes, GCC and their "C language lawyers" are always searching for new
possibilities to improve performance.
(That reminds me: apparently there is still no progress here:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51017)
You would have to be happy if the result is a runtime fault instead of
silently, without any warning doing what the programmer definitely never
intended.
Frank
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.