Skip to content

Test program fails to compile with strict-aliasing errors  #7143

@eli-schwartz

Description

@eli-schwartz
FAILED: src/test/CMakeFiles/test-z3.dir/hwf.cpp.o 
/usr/bin/x86_64-pc-linux-gnu-g++ -D_EXTERNAL_RELEASE -D_MP_INTERNAL -I/var/tmp/portage/sci-mathematics/z3-4.12.5/work/z3-z3-4.12.5_build-abi_x86_64.amd64/src -I/var/tmp/portage/sci-mathematics/z3-4.12.5/work/z3-z3-4.12.5/src  -march=native -fstack-protector-all -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-clash-protection -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing  -Wformat -Werror=format-security -Werror=odr  -Werror=return-type  -std=gnu++17 -mfpmath=sse -msse -msse2 -Wall -MD -MT src/test/CMakeFiles/test-z3.dir/hwf.cpp.o -MF src/test/CMakeFiles/test-z3.dir/hwf.cpp.o.d -o src/test/CMakeFiles/test-z3.dir/hwf.cpp.o -c /var/tmp/portage/sci-mathematics/z3-4.12.5/work/z3-z3-4.12.5/src/test/hwf.cpp
/var/tmp/portage/sci-mathematics/z3-4.12.5/work/z3-z3-4.12.5/src/test/hwf.cpp: In function ‘void bug_is_int()’:
/var/tmp/portage/sci-mathematics/z3-4.12.5/work/z3-z3-4.12.5/src/test/hwf.cpp:106:21: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
  106 |     double   val = *(double*)(raw_val);
      |                     ^~~~~~~~~~~~~~~~~~
/var/tmp/portage/sci-mathematics/z3-4.12.5/work/z3-z3-4.12.5/src/test/hwf.cpp:106:14: warning: ‘raw_val’ is used uninitialized [-Wuninitialized]
  106 |     double   val = *(double*)(raw_val);
      |              ^~~
/var/tmp/portage/sci-mathematics/z3-4.12.5/work/z3-z3-4.12.5/src/test/hwf.cpp:105:14: note: ‘raw_val’ declared here
  105 |     unsigned raw_val[2] = { 2147483648u, 1077720461u };
      |              ^~~~~~~
cc1plus: some warnings being treated as errors

Downstream bug report: https://bugs.gentoo.org/879327
Full build log: build.log

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions