Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Functions from vec3-ext.h and vec4-ext.h can trigger warnings with recent clang #428

Open
pm4gh opened this issue Aug 18, 2024 · 1 comment

Comments

@pm4gh
Copy link

pm4gh commented Aug 18, 2024

The glm_vec3_isnan, glm_vec3_isinf, glm_vec4_isnan and glm_vec4_isinf sunctions cause compiler warnings with recent clang versions and the -ffast-math compiler flag:
"use of NaN is undefined behavior due to the currently enabled floating-point options [-Wnan-infinity-disabled]"
or
"use of infinity is undefined behavior due to the currently enabled floating-point options [-Wnan-infinity-disabled]"

Changes similar to the following would work around this.

@@ -172,7 +172,12 @@ glm_vec3_min(vec3 v) {
CGLM_INLINE
bool
glm_vec3_isnan(vec3 v) {
+#if !defined( FAST_MATH)
return isnan(v[0]) || isnan(v[1]) || isnan(v[2]);
+#else

  • (void)v;
  • return 0;
    +#endif
    }

/*!

@recp recp added the fast-math label Aug 27, 2024
@recp
Copy link
Owner

recp commented Aug 27, 2024

Hi @pm4gh,

Sorry for the delay and thanks for reporting this and providing a solution.

c12f318 should suppress the warnings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants