Vector Class Discussion

 
thread Warnings on gcc 7.1.0 - HolyWu - 2017-06-02
last replythread Warnings on gcc 7.1.0 - Agner - 2019-04-30
last reply Warnings on gcc 7.1.0 - Michal Fapso - 2019-10-02
 
Warnings on gcc 7.1.0
Author: HolyWu Date: 2017-06-02 10:21
It gives the following warnings when compiled with gcc 7.1.0, but not happen with gcc 6.3.0.

vectorclass/vectorf128.h:959:103: warning: optimization attribute on 'Vec4f round(const Vec4f&)' follows definition but the attribute doesn't match [-Wattributes]
static inline Vec4f round(Vec4f const & a) __attribute__ ((optimize("-fno-unsafe-math-optimizations")));

C:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/7.1.0/include/c++/cmath:1771:3: note: previous definition of 'constexpr float std::round(float)' was here
round(float __x)

vectorclass/vectorf128.h:1961:103: warning: optimization attribute on 'Vec2d round(const Vec2d&)' follows definition but the attribute doesn't match [-Wattributes]
static inline Vec2d round(Vec2d const & a) __attribute__ ((optimize("-fno-unsafe-math-optimizations")));

C:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/7.1.0/include/c++/cmath:1771:3: note: previous definition of 'constexpr float std::round(float)' was here
round(float __x)


Best regards,
HolyWu

   
Warnings on gcc 7.1.0
Author: Agner Date: 2019-04-30 03:21
It's a gcc bug.
You can fix it with option -Wno-attributes
See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89325
   
Warnings on gcc 7.1.0
Author:  Date: 2019-10-02 05:13
You can also ignore the warning only for the round() function in vectorf128.h:

#ifdef __MINGW32__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wattributes"
#endif

...declaration of the round function with the -fno-unsafe-math-optimizations attribute
static inline Vec2d round(Vec2d const a) {
...
}
...

#ifdef __MINGW32__
#pragma GCC diagnostic pop
#endif