Bug #1989

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

Added by John Firebaugh about 5 years ago.

Status:NewStart date:2012-01-16
Priority:NormalDue date:
Assignee:-% Done:


Target version:-
Difficulty:Medium Tags:needs-triage


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