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

Compilation fails in release mode #40

Closed
wonder-sk opened this issue Jan 4, 2021 · 2 comments
Closed

Compilation fails in release mode #40

wonder-sk opened this issue Jan 4, 2021 · 2 comments

Comments

@wonder-sk
Copy link
Contributor

When I set CMAKE_BUILD_TYPE to Release then I get compilation errors due to warnings being handled as errors (-Werror compilation flag). With CMAKE_BUILD_TYPE=Debug, there are no warnings/errors.

This is with GCC 9.3.0 on ubuntu 20.04.

$ ninja      
[0/1] Re-running CMake...
-- Configuring done
-- Generating done
-- Build files have been written to: /home/martin/inst/untwine/build-ubuntu
[1/16] Building CXX object CMakeFiles/untwine.dir/epf/Grid.cpp.o
FAILED: CMakeFiles/untwine.dir/epf/Grid.cpp.o 
/usr/bin/c++   -Iinclude -isystem /usr/include/gdal -O3 -DNDEBUG   -Wno-implicit-fallthrough -Wno-int-in-bool-context -Wno-dangling-else -Wno-noexcept-type -Wall -Wextra -Wpointer-arith -Wcast-align -Wcast-qual -Wno-error=parentheses -Wno-error=cast-qual -Wredundant-decls -Wno-unused-parameter -Wno-unused-variable -Wno-long-long -Wno-unknown-pragmas -Wno-deprecated-declarations -Werror -std=gnu++11 -MD -MT CMakeFiles/untwine.dir/epf/Grid.cpp.o -MF CMakeFiles/untwine.dir/epf/Grid.cpp.o.d -o CMakeFiles/untwine.dir/epf/Grid.cpp.o -c ../epf/Grid.cpp
In file included from ../epf/EpfTypes.hpp:25,
                 from ../epf/Epf.hpp:21,
                 from ../epf/Grid.cpp:17:
../epf/../untwine/FileDimInfo.hpp: In function ‘std::istream& untwine::operator>>(std::istream&, untwine::FileDimInfo&)’:
../epf/../untwine/FileDimInfo.hpp:43:33: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
   43 |     in >> fdi.name >> (int&)fdi.type >> fdi.offset;
      |                             ~~~~^~~~
cc1plus: all warnings being treated as errors
[3/16] Building CXX object CMakeFiles/untwine.dir/epf/BufferCache.cpp.o
FAILED: CMakeFiles/untwine.dir/epf/BufferCache.cpp.o 
/usr/bin/c++   -Iinclude -isystem /usr/include/gdal -O3 -DNDEBUG   -Wno-implicit-fallthrough -Wno-int-in-bool-context -Wno-dangling-else -Wno-noexcept-type -Wall -Wextra -Wpointer-arith -Wcast-align -Wcast-qual -Wno-error=parentheses -Wno-error=cast-qual -Wredundant-decls -Wno-unused-parameter -Wno-unused-variable -Wno-long-long -Wno-unknown-pragmas -Wno-deprecated-declarations -Werror -std=gnu++11 -MD -MT CMakeFiles/untwine.dir/epf/BufferCache.cpp.o -MF CMakeFiles/untwine.dir/epf/BufferCache.cpp.o.d -o CMakeFiles/untwine.dir/epf/BufferCache.cpp.o -c ../epf/BufferCache.cpp
In file included from ../epf/EpfTypes.hpp:25,
                 from ../epf/BufferCache.hpp:20,
                 from ../epf/BufferCache.cpp:16:
../epf/../untwine/FileDimInfo.hpp: In function ‘std::istream& untwine::operator>>(std::istream&, untwine::FileDimInfo&)’:
../epf/../untwine/FileDimInfo.hpp:43:33: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
   43 |     in >> fdi.name >> (int&)fdi.type >> fdi.offset;
      |                             ~~~~^~~~
cc1plus: all warnings being treated as errors
[4/16] Building CXX object CMakeFiles/untwine.dir/epf/Reprocessor.cpp.o
FAILED: CMakeFiles/untwine.dir/epf/Reprocessor.cpp.o 
/usr/bin/c++   -Iinclude -isystem /usr/include/gdal -O3 -DNDEBUG   -Wno-implicit-fallthrough -Wno-int-in-bool-context -Wno-dangling-else -Wno-noexcept-type -Wall -Wextra -Wpointer-arith -Wcast-align -Wcast-qual -Wno-error=parentheses -Wno-error=cast-qual -Wredundant-decls -Wno-unused-parameter -Wno-unused-variable -Wno-long-long -Wno-unknown-pragmas -Wno-deprecated-declarations -Werror -std=gnu++11 -MD -MT CMakeFiles/untwine.dir/epf/Reprocessor.cpp.o -MF CMakeFiles/untwine.dir/epf/Reprocessor.cpp.o.d -o CMakeFiles/untwine.dir/epf/Reprocessor.cpp.o -c ../epf/Reprocessor.cpp
In file included from ../epf/EpfTypes.hpp:25,
                 from ../epf/Reprocessor.hpp:16,
                 from ../epf/Reprocessor.cpp:16:
../epf/../untwine/FileDimInfo.hpp: In function ‘std::istream& untwine::operator>>(std::istream&, untwine::FileDimInfo&)’:
../epf/../untwine/FileDimInfo.hpp:43:33: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
   43 |     in >> fdi.name >> (int&)fdi.type >> fdi.offset;
      |                             ~~~~^~~~
cc1plus: all warnings being treated as errors
[5/16] Building CXX object CMakeFiles/untwine.dir/epf/Cell.cpp.o
FAILED: CMakeFiles/untwine.dir/epf/Cell.cpp.o 
/usr/bin/c++   -Iinclude -isystem /usr/include/gdal -O3 -DNDEBUG   -Wno-implicit-fallthrough -Wno-int-in-bool-context -Wno-dangling-else -Wno-noexcept-type -Wall -Wextra -Wpointer-arith -Wcast-align -Wcast-qual -Wno-error=parentheses -Wno-error=cast-qual -Wredundant-decls -Wno-unused-parameter -Wno-unused-variable -Wno-long-long -Wno-unknown-pragmas -Wno-deprecated-declarations -Werror -std=gnu++11 -MD -MT CMakeFiles/untwine.dir/epf/Cell.cpp.o -MF CMakeFiles/untwine.dir/epf/Cell.cpp.o.d -o CMakeFiles/untwine.dir/epf/Cell.cpp.o -c ../epf/Cell.cpp
In file included from ../epf/EpfTypes.hpp:25,
                 from ../epf/Cell.hpp:22,
                 from ../epf/Cell.cpp:14:
../epf/../untwine/FileDimInfo.hpp: In function ‘std::istream& untwine::operator>>(std::istream&, untwine::FileDimInfo&)’:
../epf/../untwine/FileDimInfo.hpp:43:33: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
   43 |     in >> fdi.name >> (int&)fdi.type >> fdi.offset;
      |                             ~~~~^~~~
cc1plus: all warnings being treated as errors
[6/16] Building CXX object CMakeFiles/untwine.dir/epf/Writer.cpp.o
FAILED: CMakeFiles/untwine.dir/epf/Writer.cpp.o 
/usr/bin/c++   -Iinclude -isystem /usr/include/gdal -O3 -DNDEBUG   -Wno-implicit-fallthrough -Wno-int-in-bool-context -Wno-dangling-else -Wno-noexcept-type -Wall -Wextra -Wpointer-arith -Wcast-align -Wcast-qual -Wno-error=parentheses -Wno-error=cast-qual -Wredundant-decls -Wno-unused-parameter -Wno-unused-variable -Wno-long-long -Wno-unknown-pragmas -Wno-deprecated-declarations -Werror -std=gnu++11 -MD -MT CMakeFiles/untwine.dir/epf/Writer.cpp.o -MF CMakeFiles/untwine.dir/epf/Writer.cpp.o.d -o CMakeFiles/untwine.dir/epf/Writer.cpp.o -c ../epf/Writer.cpp
In file included from ../epf/EpfTypes.hpp:25,
                 from ../epf/Writer.hpp:21,
                 from ../epf/Writer.cpp:18:
../epf/../untwine/FileDimInfo.hpp: In function ‘std::istream& untwine::operator>>(std::istream&, untwine::FileDimInfo&)’:
../epf/../untwine/FileDimInfo.hpp:43:33: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
   43 |     in >> fdi.name >> (int&)fdi.type >> fdi.offset;
      |                             ~~~~^~~~
cc1plus: all warnings being treated as errors
[7/16] Building CXX object CMakeFiles/untwine.dir/epf/FileProcessor.cpp.o
FAILED: CMakeFiles/untwine.dir/epf/FileProcessor.cpp.o 
/usr/bin/c++   -Iinclude -isystem /usr/include/gdal -O3 -DNDEBUG   -Wno-implicit-fallthrough -Wno-int-in-bool-context -Wno-dangling-else -Wno-noexcept-type -Wall -Wextra -Wpointer-arith -Wcast-align -Wcast-qual -Wno-error=parentheses -Wno-error=cast-qual -Wredundant-decls -Wno-unused-parameter -Wno-unused-variable -Wno-long-long -Wno-unknown-pragmas -Wno-deprecated-declarations -Werror -std=gnu++11 -MD -MT CMakeFiles/untwine.dir/epf/FileProcessor.cpp.o -MF CMakeFiles/untwine.dir/epf/FileProcessor.cpp.o.d -o CMakeFiles/untwine.dir/epf/FileProcessor.cpp.o -c ../epf/FileProcessor.cpp
In file included from ../epf/EpfTypes.hpp:25,
                 from ../epf/FileProcessor.hpp:14,
                 from ../epf/FileProcessor.cpp:14:
../epf/../untwine/FileDimInfo.hpp: In function ‘std::istream& untwine::operator>>(std::istream&, untwine::FileDimInfo&)’:
../epf/../untwine/FileDimInfo.hpp:43:33: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
   43 |     in >> fdi.name >> (int&)fdi.type >> fdi.offset;
      |                             ~~~~^~~~
cc1plus: all warnings being treated as errors
[8/16] Building CXX object CMakeFiles/untwine.dir/bu/PyramidManager.cpp.o
FAILED: CMakeFiles/untwine.dir/bu/PyramidManager.cpp.o 
/usr/bin/c++   -Iinclude -isystem /usr/include/gdal -O3 -DNDEBUG   -Wno-implicit-fallthrough -Wno-int-in-bool-context -Wno-dangling-else -Wno-noexcept-type -Wall -Wextra -Wpointer-arith -Wcast-align -Wcast-qual -Wno-error=parentheses -Wno-error=cast-qual -Wredundant-decls -Wno-unused-parameter -Wno-unused-variable -Wno-long-long -Wno-unknown-pragmas -Wno-deprecated-declarations -Werror -std=gnu++11 -MD -MT CMakeFiles/untwine.dir/bu/PyramidManager.cpp.o -MF CMakeFiles/untwine.dir/bu/PyramidManager.cpp.o.d -o CMakeFiles/untwine.dir/bu/PyramidManager.cpp.o -c ../bu/PyramidManager.cpp
In file included from ../bu/BuTypes.hpp:21,
                 from ../bu/Processor.hpp:18,
                 from ../bu/PyramidManager.cpp:22:
../bu/../untwine/FileDimInfo.hpp: In function ‘std::istream& untwine::operator>>(std::istream&, untwine::FileDimInfo&)’:
../bu/../untwine/FileDimInfo.hpp:43:33: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
   43 |     in >> fdi.name >> (int&)fdi.type >> fdi.offset;
      |                             ~~~~^~~~
cc1plus: all warnings being treated as errors
[9/16] Building CXX object CMakeFiles/untwine.dir/bu/Processor.cpp.o
FAILED: CMakeFiles/untwine.dir/bu/Processor.cpp.o 
/usr/bin/c++   -Iinclude -isystem /usr/include/gdal -O3 -DNDEBUG   -Wno-implicit-fallthrough -Wno-int-in-bool-context -Wno-dangling-else -Wno-noexcept-type -Wall -Wextra -Wpointer-arith -Wcast-align -Wcast-qual -Wno-error=parentheses -Wno-error=cast-qual -Wredundant-decls -Wno-unused-parameter -Wno-unused-variable -Wno-long-long -Wno-unknown-pragmas -Wno-deprecated-declarations -Werror -std=gnu++11 -MD -MT CMakeFiles/untwine.dir/bu/Processor.cpp.o -MF CMakeFiles/untwine.dir/bu/Processor.cpp.o.d -o CMakeFiles/untwine.dir/bu/Processor.cpp.o -c ../bu/Processor.cpp
In file included from ../bu/BuTypes.hpp:21,
                 from ../bu/Processor.hpp:18,
                 from ../bu/Processor.cpp:22:
../bu/../untwine/FileDimInfo.hpp: In function ‘std::istream& untwine::operator>>(std::istream&, untwine::FileDimInfo&)’:
../bu/../untwine/FileDimInfo.hpp:43:33: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
   43 |     in >> fdi.name >> (int&)fdi.type >> fdi.offset;
      |                             ~~~~^~~~
cc1plus: all warnings being treated as errors
[10/16] Building CXX object CMakeFiles/untwine.dir/epf/Epf.cpp.o
FAILED: CMakeFiles/untwine.dir/epf/Epf.cpp.o 
/usr/bin/c++   -Iinclude -isystem /usr/include/gdal -O3 -DNDEBUG   -Wno-implicit-fallthrough -Wno-int-in-bool-context -Wno-dangling-else -Wno-noexcept-type -Wall -Wextra -Wpointer-arith -Wcast-align -Wcast-qual -Wno-error=parentheses -Wno-error=cast-qual -Wredundant-decls -Wno-unused-parameter -Wno-unused-variable -Wno-long-long -Wno-unknown-pragmas -Wno-deprecated-declarations -Werror -std=gnu++11 -MD -MT CMakeFiles/untwine.dir/epf/Epf.cpp.o -MF CMakeFiles/untwine.dir/epf/Epf.cpp.o.d -o CMakeFiles/untwine.dir/epf/Epf.cpp.o -c ../epf/Epf.cpp
In file included from ../epf/EpfTypes.hpp:25,
                 from ../epf/Epf.hpp:21,
                 from ../epf/Epf.cpp:14:
../epf/../untwine/FileDimInfo.hpp: In function ‘std::istream& untwine::operator>>(std::istream&, untwine::FileDimInfo&)’:
../epf/../untwine/FileDimInfo.hpp:43:33: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
   43 |     in >> fdi.name >> (int&)fdi.type >> fdi.offset;
      |                             ~~~~^~~~
cc1plus: all warnings being treated as errors
ninja: build stopped: subcommand failed.
@abellgithub
Copy link
Collaborator

Heh. I was surprised that the compiler let me do this originally, but I was lazy.

@abellgithub
Copy link
Collaborator

Fixed with 154e7f7

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