This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Optimization of conditional access to globals: thread-unsafe?

David Miller wrote:
From: Darryl Miles <>
Date: Mon, 29 Oct 2007 04:53:49 +0000

What are the issues with "speculative loads" ?

The conditional might be protecting whether the pointer is valid and can be dereferenced at all.

This then leads into the question. Is a pointer allowed to be invalid.

I'm sure I have read a comment on this before, along the line of the spec says it must be valid or a certain number of other values (like zero or one past being valid). But I can not cite chapter and verse if this is true.

I would agree however (before you say) that 'counter' by itself is just a variable, and it is only when execution allows it to be dereferenced that the issues about its validity come into play. This is practical common law usage.

And in another module that GCC can't see when compiling foo():

I agree, any external symbols might not even be in the 'C' language, but those symbols do conform to the ABI and the unwritten rules of what the value represents is implied when you assign an equivalent type 'int' to it in a C variable declaration.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]