[LLVMdev] optimization assumes malloc return is non-null
David Vandevoorde
daveed at vandevoorde.com
Wed May 14 12:49:33 PDT 2008
On May 14, 2008, at 3:06 PM, Jonathan S. Shapiro wrote:
> On Wed, 2008-05-14 at 13:26 -0400, David Vandevoorde wrote:
>> On May 14, 2008, at 10:46 AM, Jonathan S. Shapiro wrote:
>>> On Wed, 2008-05-14 at 23:23 +0900, Neil Booth wrote:
>>>> Jonathan S. Shapiro wrote:-
>>>>> Is there a requirement somewhere in the C *Language* Specification
>>>>> that
>>>>> ties all of this together in the required way?
>>
>> Good question (referring to the original question). The answer
>> appears to be 7.1.3/1, fourth bullet:
>>
>> "All identifiers with external linkage in any of the following
>> subclauses (including the future library directions) are always
>> reserved for use as identifiers with external linkage."
>
> First, thank you.
>
> I apologize if I have been acting like a language lawyer, but I'm
> about
> to be working on static analysis tools and I'm discovering that my
> understanding of the language was, ahem, incomplete. Which seems
> like a
> bad situation for a static analysis tool author to be in. :-)
>
> I read 7.1.3 merely to state that the library-reserved identifiers
> must
> always have external linkage, not that they are required to be bound
> to
> the library implementations. That is: a program is free to override
> them.
>
> Am I misunderstanding the use of the term "reserved" in this clause?
> Should I be reading this as "are always reserved, and further must
> always have external linkage" (which seems to be your reading)?
Ah, no, I think your reading is the most likely. However, paragraph 2
continues:
"[...] If the program declares or defines an identifier in a context
in which it is reserved (other than as allowed by 7.1.4), or defines a
reserved identifier as a macro name, the behavior is undefined."
> Also:
>
> 1 Can you suggest anything in addition to the rationale documents that
> I should go read?
Unfortunately, no, I'm not aware of anything for C. (In truth, I'm
not actively involved in WG14 work; I did a fair bit of work
implementing C99 some years ago, but I had access to true experts for
the nitty gritty details, rather than being an expert myself.)
> 2 Since these questions aren't really specific to LLVM, do you know
> of a
> more appropriate place where I might ask them?
Usenet's comp.std.c looks like it's still an active forum, and is
where I would try first. You could consider becoming a member of J11
or WG14. If that's not feasible you could try contacting one of the
WG14 officers to see if they have further suggestions:
http://www.open-std.org/jtc1/sc22/wg14/www/contacts
Daveed
More information about the llvm-dev
mailing list