IMA corner case with forward declarations of statics

Dale Johannesen dalej@apple.com
Thu Jun 24 21:22:00 GMT 2004


On Jun 24, 2004, at 1:56 PM, Geoff Keating wrote:
> On 24/06/2004, at 11:56 AM, Dale Johannesen wrote:
>> On Jun 24, 2004, at 11:48 AM, Zack Weinberg wrote:
>>> Dale Johannesen <dalej@apple.com> writes:
>>>
>>>> However, 6.2.2 makes it clear that the order does matter,
>>>> and the reverse order is undefined behavior.  (Which does not mean 
>>>> we
>>>> have to treat it as an error; you and I both thought this was valid,
>>>> and I'm sure I've seen it done that way.  Disallowing it is sure to
>>>> break existing code.)
>>>
>>> Yeah, and there are examples in GCC's own source.  I'm thinking
>>> mandatory warning in normal mode, error in IMA mode.
>>
>> I really don't think IMA mode ought to affect semantics.  The
>> result of building and running a program in IMA mode should be the
>> same as with separate compilation, but possibly better optimized, IMO.
>
> There are errors that we produce when doing IMA that we can't produce 
> when we aren't, because we have more information when doing IMA.  For 
> instance, we detect when a function is declared one way in one 
> translation unit, and used a different way in another.

Yes, this is the way it works in 3.4, and it's highly inconvenient 
running SPEC, which
has several examples of this, all harmless (int vs void when the result 
is not used,
things like that).  It is not the way I think it should work, in C.  
Warning, yes, error, no.
(C++ is a different story, and its users generally have a different 
mindset about
conformance.)



More information about the Gcc mailing list