Release builds of Amber (and the CTS) with GCC 11.0.1 produce some uninitialized variable warnings:
external/amber/src/src/float16_helper.cc: In function ‘float amber::float16::{anonymous}::HexFloat16ToFloat(const uint8_t*)’:
external/amber/src/src/float16_helper.cc:79:11: error: ‘hex’ is used uninitialized [-Werror=uninitialized]
79 | return *hex_float;
| ^~~~~~~~~
external/amber/src/src/float16_helper.cc:77:12: note: ‘hex’ declared here
77 | uint32_t hex = sign | exponent | mantissa;
| ^~~
I'm not sure if this is a bug in GCC. This commit works around the warnings by replacing reinterpret_cast with memcpy when type punning unsigned integers to floats. At least on GCC the generated code should be unchanged compared to the current approach:
Release builds of Amber (and the CTS) with GCC 11.0.1 produce some uninitialized variable warnings:
I'm not sure if this is a bug in GCC. This commit works around the warnings by replacing reinterpret_cast with memcpy when type punning unsigned integers to floats. At least on GCC the generated code should be unchanged compared to the current approach:
There's also a new stringop-truncation warning in SPIRV-tools which affects building Amber but not the CTS.