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

Building for AArch64 fails due to "strict-aliasing" , "maybe-uninitialized" & "stringop-truncation" errors #2234

Open
Antonios-C opened this issue Jan 17, 2025 · 2 comments

Comments

@Antonios-C
Copy link
Contributor

When building the CTS repo for a AArch64 platform, the build failed due to 3 types of warnings, that turned into errors (-Werror enablement in CMakeLists.txt).

Example "strict-aliasing":

../test_conformance/basic/test_numeric_constants.cpp:529:154: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
  529 | #define TEST_FLOAT_ASSERTION( a, msg, f ) if( !( a ) ) { log_error( "ERROR: Float constant failed requirement: %s (bitwise value is 0x%8.8x)\n", msg, *( (uint32_t *)&f ) ); return -1; }
      |                                                                                                                                                        ~~^~~~~~~~~~~~~~~~
../test_conformance/basic/test_numeric_constants.cpp:574:9: note: in expansion of macro 'TEST_FLOAT_ASSERTION'
  574 |         TEST_FLOAT_ASSERTION( intOut[0] == 0, "isinf( MAXFLOAT ) = false", floatOut[0] )
      |         ^~~~~~~~~~~~~~~~~~~~

Example "stringop-truncation":

../test_conformance/contractions/contractions.cpp:368:16: error: 'char* strncpy(char*, const char*, size_t)' specified bound 4096 equals destination size [-Werror=stringop-truncation]
  368 |         strncpy( appName, argv[0], MAXPATHLEN );
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../test_conformance/contractions/contractions.cpp:373:16: error: 'char* strncpy(char*, const char*, size_t)' specified bound 4096 equals destination size [-Werror=stringop-truncation]
  373 |         strncpy( baseName, argv[0], MAXPATHLEN );
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Examples "maybe-uninitialized":

  • ../test_common/harness/imageHelpers.cpp:3564:56: error: 'src_lod' may be used uninitialized [-Werror=maybe-uninitialized]
  • ../test_common/harness/imageHelpers.cpp:3610:56: error: 'dst_lod' may be used uninitialized [-Werror=maybe-uninitialized]
  • ../test_conformance/api/test_wg_suggested_local_work_size.cpp:276:12: error: 'err' may be used uninitialized [-Werror=maybe-uninitialized]
@svenvh
Copy link
Member

svenvh commented Jan 20, 2025

Thanks for the report! Do you have more details on the compiler version you're using?

@Antonios-C
Copy link
Contributor Author

Hi there !

The compiler version is 13.3.

Currently working on fixing the warnings, will make a pull request this week.

Antonios-C added a commit to Antonios-C/OpenCL-CTS that referenced this issue Jan 22, 2025
This commit links to issue (KhronosGroup#2234).

When cross-compiling for AArch64, using gcc 13.3, you encounter three warnings
types that turn into errors:

- maybe-uninitialized
- stringop-truncation
- strict-aliasing

This commit fixes all the warnings found, in regards to the first two rules. To
resolve the warnigns due to strict-aliasing, I am editing the CMake build
system.

Signed-off-by: Antonios Christidis <[email protected]>
Antonios-C added a commit to Antonios-C/OpenCL-CTS that referenced this issue Jan 22, 2025
This commit links to issue (KhronosGroup#2234).

When cross-compiling for AArch64, using gcc 13.3, you encounter three warnings
types that turn into errors:

- maybe-uninitialized
- stringop-truncation
- strict-aliasing

This commit fixes all the warnings found, in regards to the first two rules. To
resolve the warnigns due to strict-aliasing, I am editing the CMake build
system.

Signed-off-by: Antonios Christidis <[email protected]>
svenvh pushed a commit that referenced this issue Feb 5, 2025
This commit links to issue (#2234).

When cross-compiling for AArch64, using gcc 13.3, you encounter three
warnings types that turn into errors:

- maybe-uninitialized
- stringop-truncation
- strict-aliasing

This commit fixes all the warnings found, in regards to the first two
rules. To resolve the warnigns due to strict-aliasing, I am editing the
CMake build system.

Signed-off-by: Antonios Christidis <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants