Skip to content

-Wstrict-aliasing is flagging code that may break with compiler optimizations that -fstrict-aliasing unlocks #121

@jsetje

Description

@jsetje

When building a modern gcc and -O2 or higher which enables -fstrict-aliasing there are a number of these warnings:

 dereferencing type-punned pointer will break strict-aliasing rules

This is flagging code that may break with compiler optimizations that are unlocked by -fstrict-aliasing.

The short answer is to build with -fno-strict-aliasing which will disable both the optimizations and the warnings.

The longer answer may be to evaluate fixing the code to be safe for such optimizations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions