GNU bug report logs -
#11675
stty bad C semantics
Previous Next
Reported by: Edward Schwartz <edmcman <at> cmu.edu>
Date: Mon, 11 Jun 2012 19:27:01 UTC
Severity: normal
Done: Jim Meyering <jim <at> meyering.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
On Mon, Jun 11, 2012 at 3:50 PM, Eric Blake <eblake <at> redhat.com> wrote:
> On 06/11/2012 01:16 PM, Edward Schwartz wrote:
>
> I disagree with your interpretation of C99, and claim instead that your
> CIL compiler is buggy.
>
> C99 6.7.8 para. 21:
>
> "If there are fewer initializers in a brace-enclosed list than there are
> elements or members of an aggregate, or fewer characters in a string
> literal used to initialize an array of known size than there are
> elements in the array, the remainder of the aggregate shall be
> initialized implicitly the same as objects that have static storage
> duration."
>
> And while there is no way to zero out padding bits by direct assignment,
> I think we _are_ guaranteed that padding bits are zero when doing the
> same initialization as static storage duration if we did not call out
> all the named members.
Why do you think that? The standard is pretty vague here, but I
interpret the "remainder of the aggregate" as the remaining fields,
since the initializer list is a list of fields.
I just want to make sure the bug is filed in the proper place. If
it's a CIL bug, I'll file it with them.
>
>> The problem is easily fixed by using memset, instead of implied
>> initializations. I am attaching a patch that does this. While it
>> won't affect most coreutils users, it might save some time for someone
>> using a non-standard compiler or analysis platform.
>
> If I understand correctly, gcc is also able to optimize out the memset,
> so that your patch has no net impact and would allow us to work around
> your buggy compiler; but I will leave it up to Jim whether it is worth
> applying.
Thanks,
Ed
This bug report was last modified 12 years and 342 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.