You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@Not-Nik@raysan5 Sorry for raising the PR again, but while compiling raylib with -02 (or -03) HalfToFloat and FloatToHalf will raise dereferencing type-punned pointer will break strict-aliasing rules, which, AFAIK, incurs in undefined behavior, so probably worth looking into. Not sure how to address these ones tho.
EDIT: -fno-strict-aliasing is set, not sure why it's not being applied.
Compiling log:
[...]
gcc -c rtextures.c -Wall -D_GNU_SOURCE -DPLATFORM_DESKTOP_GLFW -DGRAPHICS_API_OPENGL_33 -Wno-missing-braces -Werror=pointer-arith -fno-strict-aliasing -std=c99 -fPIC -O2 -Werror=implicit-function-declaration -D_GLFW_X11 -I. -Iexternal/glfw/include
rtextures.c: In function‘HalfToFloat’:
rtextures.c:5396:30: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
5396 | const unsigned int v = (*(unsigned int *)&fm) >> 23; // Evil log2 bit hack to count leading zeros in denormalized format
| ^~~~~~~~~~~~~~~~~~~
rtextures.c:5399:15: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
5399 | result = *(float *)&r;| ^~~~~~~~~~~
rtextures.c: In function‘FloatToHalf’:
rtextures.c:5409:30: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
5409 | const unsigned int b = (*(unsigned int *) & x) + 0x00001000; // Round-to-nearest-even: add last bit after truncated mantissa
| ^~~~~~~~~~~~~~~~~~~~
rtextures.c: In function‘HalfToFloat’:
rtextures.c:5396:29: warning: ‘fm’ is used uninitialized [-Wuninitialized]
5396 | const unsigned int v = (*(unsigned int *)&fm) >> 23; // Evil log2 bit hack to count leading zeros in denormalized format
|~^~~~~~~~~~~~~~~~~~~~~
rtextures.c:5395:17: note: ‘fm’ declared here
5395 | const float fm = (float)m;| ^~
[...]
@Not-Nik @raysan5 Sorry for raising the PR again, but while compiling raylib with
-02
(or-03
)HalfToFloat
andFloatToHalf
will raisedereferencing type-punned pointer will break strict-aliasing rules
, which, AFAIK, incurs in undefined behavior, so probably worth looking into. Not sure how to address these ones tho.EDIT:
-fno-strict-aliasing
is set, not sure why it's not being applied.Compiling log:
Originally posted by @asdqwe in #3220 (comment)
The text was updated successfully, but these errors were encountered: