[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#11675: stty bad C semantics
From: |
Edward Schwartz |
Subject: |
bug#11675: stty bad C semantics |
Date: |
Mon, 11 Jun 2012 16:08:55 -0400 |
On Mon, Jun 11, 2012 at 3:50 PM, Eric Blake <address@hidden> 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
bug#11675: stty bad C semantics, Jim Meyering, 2012/06/12