[Mesa-dev] [PATCH] Fix strict-aliasing violations in GLSL shader list implementation

Eero Tamminen eero.t.tamminen at intel.com
Wed Jul 1 07:49:55 PDT 2015


Hi,

On 06/24/2015 05:53 AM, Matt Turner wrote:
> On Tue, Jun 23, 2015 at 6:44 PM, Ian Romanick <idr at freedesktop.org> wrote:
>> Please quote the spec.
>
> Section 6.5 Expressions of the draft C99 spec I have says (page 68, 80
> of the pdf):
>
> 7 An object shall have its stored value accessed only by an lvalue
> expression that has one of the following types: 76)
>
> — a type compatible with the effective type of the object,
>
> — a qualified version of a type compatible with the effective type of
> the object,
>
> — a type that is the signed or unsigned type corresponding to the
> effective type of the object,
>
> — a type that is the signed or unsigned type corresponding to a
> qualified version of the effective type of the object,
>
> — an aggregate or union type that includes one of the aforementioned
> types among its members (including, recursively, a member of a
> subaggregate or contained union), or
>
> — a character type.
>
> And the footnote 76 is:
>
> 76) The intent of this list is to specify those circumstances in which
> an object may or may not be aliased.

Btw. Chris Lattner had good blog posts on what is undefined behavior in 
C (including type rules violations), their interaction with compiler 
optimizations and how to detect them:
http://blog.llvm.org/2011/05/what-every-c-programmer-should-know.html
http://blog.llvm.org/2011/05/what-every-c-programmer-should-know_14.html
http://blog.llvm.org/2011/05/what-every-c-programmer-should-know_21.html


	- Eero



More information about the mesa-dev mailing list