Bug #1989

signbit macro doesn't compile under gcc -Werror=strict-aliasing -O2

Added by John Firebaugh over 2 years ago.

Status:New Start date:2012-01-16
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:- Spent time: -
Target version:-
Difficulty:Medium Tags:needs-triage

Description

The definition of the signbit macro from math_c99.h uses a type-punned pointer, which breaks strict-aliasing rules and will not compile on gcc with -O2 and the -Werror=strict-aliasing option.

From what I've seen, other implementations type pun via a union instead, which is standards compliant.

Test program: https://gist.github.com/1616683
Downstream issue: https://github.com/rubinius/rubinius/issues/1515

Also available in: Atom PDF