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

-Werror=unused-result in GCC48 compiler #236

Closed
luotao1 opened this issue May 11, 2018 · 0 comments
Closed

-Werror=unused-result in GCC48 compiler #236

luotao1 opened this issue May 11, 2018 · 0 comments
Labels
bug A confirmed library bug

Comments

@luotao1
Copy link

luotao1 commented May 11, 2018

When use GCC48 to compile mkldnn, there are a lot of -Werror=unused-result errors. But when use GCC53, there is no error.

  • configuration:
[14:59:21] :	 [Step 1/4] -- Found Paddle host system: centos, version: 6.9
[14:59:21] :	 [Step 1/4] -- Found Paddle host system's CPU: 12 cores
[14:59:22] :	 [Step 1/4] -- The CXX compiler identification is GNU 4.8.2
[14:59:22] :	 [Step 1/4] -- The C compiler identification is GNU 4.8.2
  • error log:
In file included from /home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/cpu_barrier.hpp:22:0,
                 from /home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/cpu_barrier.cpp:19:
/home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/jit_generator.hpp: In member function ‘void mkldnn::impl::cpu::jit_generator::dump_code(const uint8*) const’:
/home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/jit_generator.hpp:719:47: error: ignoring return value of ‘size_t fwrite(const void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result [-Werror=unused-result]
                 fwrite(code, getSize(), 1, fp);
                                               ^
cc1plus: all warnings being treated as errors
make[5]: *** [src/CMakeFiles/mkldnn.dir/cpu/cpu_barrier.cpp.o] Error 1
make[5]: *** Waiting for unfinished jobs....
In file included from /home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/jit_uni_dw_conv_kernel_f32.hpp:21:0,
                 from /home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/jit_uni_dw_conv_kernel_f32.cpp:23:
/home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/jit_generator.hpp: In member function ‘void mkldnn::impl::cpu::jit_generator::dump_code(const uint8*) const’:
/home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/jit_generator.hpp:719:47: error: ignoring return value of ‘size_t fwrite(const void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result [-Werror=unused-result]
                 fwrite(code, getSize(), 1, fp);
                                               ^
In file included from /home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/jit_transpose_src_utils.cpp:21:0:
/home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/jit_generator.hpp: In member function ‘void mkldnn::impl::cpu::jit_generator::dump_code(const uint8*) const’:
/home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/jit_generator.hpp:719:47: error: ignoring return value of ‘size_t fwrite(const void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result [-Werror=unused-result]
                 fwrite(code, getSize(), 1, fp);
                                               ^
In file included from /home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/jit_uni_reorder.cpp:29:0:
/home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/jit_generator.hpp: In member function ‘void mkldnn::impl::cpu::jit_generator::dump_code(const uint8*) const’:
/home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/jit_generator.hpp:719:47: error: ignoring return value of ‘size_t fwrite(const void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result [-Werror=unused-result]
                 fwrite(code, getSize(), 1, fp);
                                               ^
cc1plus: all warnings being treated as errors
make[5]: *** [src/CMakeFiles/mkldnn.dir/cpu/jit_transpose_src_utils.cpp.o] Error 1
cc1plus: all warnings being treated as errors
make[5]: *** [src/CMakeFiles/mkldnn.dir/cpu/jit_uni_reorder.cpp.o] Error 1
In file included from /home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/cpu_barrier.hpp:22:0,
                 from /home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/cpu_reducer.hpp:28,
                 from /home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/jit_avx2_convolution.hpp:23,
                 from /home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/jit_avx2_convolution.cpp:20:
/home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/jit_generator.hpp: In member function ‘void mkldnn::impl::cpu::jit_generator::dump_code(const uint8*) const’:
/home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/jit_generator.hpp:719:47: error: ignoring return value of ‘size_t fwrite(const void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result [-Werror=unused-result]
                 fwrite(code, getSize(), 1, fp);
                                               ^
cc1plus: all warnings being treated as errors
In file included from /home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/cpu_barrier.hpp:22:0,
                 from /home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/cpu_reducer.hpp:28,
                 from /home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/jit_avx512_common_1x1_convolution.hpp:23,
                 from /home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/jit_avx512_common_1x1_convolution.cpp:20:
/home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/jit_generator.hpp: In member function ‘void mkldnn::impl::cpu::jit_generator::dump_code(const uint8*) const’:
/home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/jit_generator.hpp:719:47: error: ignoring return value of ‘size_t fwrite(const void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result [-Werror=unused-result]
                 fwrite(code, getSize(), 1, fp);
                                               ^
make[5]: *** [src/CMakeFiles/mkldnn.dir/cpu/jit_uni_dw_conv_kernel_f32.cpp.o] Error 1
In file included from /home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/jit_avx512_common_conv_winograd_kernel_f32.hpp:23:0,
                 from /home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/jit_avx512_common_convolution_winograd.hpp:25,
                 from /home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/jit_avx512_core_convolution_winograd.cpp:28:
/home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/jit_generator.hpp: In member function ‘void mkldnn::impl::cpu::jit_generator::dump_code(const uint8*) const’:
/home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/jit_generator.hpp:719:47: error: ignoring return value of ‘size_t fwrite(const void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result [-Werror=unused-result]
                 fwrite(code, getSize(), 1, fp);
                                               ^
In file included from /home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/cpu_barrier.hpp:22:0,
                 from /home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/cpu_reducer.hpp:28,
                 from /home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/jit_avx2_1x1_convolution.hpp:23,
                 from /home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/jit_avx2_1x1_convolution.cpp:20:
/home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/jit_generator.hpp: In member function ‘void mkldnn::impl::cpu::jit_generator::dump_code(const uint8*) const’:
/home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/jit_generator.hpp:719:47: error: ignoring return value of ‘size_t fwrite(const void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result [-Werror=unused-result]
                 fwrite(code, getSize(), 1, fp);
                                               ^
cc1plus: all warnings being treated as errors
make[5]: *** [src/CMakeFiles/mkldnn.dir/cpu/jit_avx2_convolution.cpp.o] Error 1
cc1plus: all warnings being treated as errors
cc1plus: all warnings being treated as errors
make[5]: *** [src/CMakeFiles/mkldnn.dir/cpu/jit_avx512_core_convolution_winograd.cpp.o] Error 1
make[5]: *** [src/CMakeFiles/mkldnn.dir/cpu/jit_avx512_common_1x1_convolution.cpp.o] Error 1
In file included from /home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/jit_uni_batch_normalization.cpp:26:0:
/home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/jit_generator.hpp: In member function ‘void mkldnn::impl::cpu::jit_generator::dump_code(const uint8*) const’:
/home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/jit_generator.hpp:719:47: error: ignoring return value of ‘size_t fwrite(const void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result [-Werror=unused-result]
                 fwrite(code, getSize(), 1, fp);
                                               ^
cc1plus: all warnings being treated as errors
In file included from /home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/jit_avx512_core_u8s8s32x_1x1_convolution.cpp:23:0:
/home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/jit_generator.hpp: In member function ‘void mkldnn::impl::cpu::jit_generator::dump_code(const uint8*) const’:
/home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/jit_generator.hpp:719:47: error: ignoring return value of ‘size_t fwrite(const void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result [-Werror=unused-result]
                 fwrite(code, getSize(), 1, fp);
                                               ^
make[5]: *** [src/CMakeFiles/mkldnn.dir/cpu/jit_avx2_1x1_convolution.cpp.o] Error 1
cc1plus: all warnings being treated as errors
make[5]: *** [src/CMakeFiles/mkldnn.dir/cpu/jit_uni_batch_normalization.cpp.o] Error 1
cc1plus: all warnings being treated as errors
make[5]: *** [src/CMakeFiles/mkldnn.dir/cpu/jit_avx512_core_u8s8s32x_1x1_convolution.cpp.o] Error 1
In file included from /home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/jit_uni_eltwise.cpp:22:0:
/home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/jit_generator.hpp: In member function ‘void mkldnn::impl::cpu::jit_generator::dump_code(const uint8*) const’:
/home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/jit_generator.hpp:719:47: error: ignoring return value of ‘size_t fwrite(const void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result [-Werror=unused-result]
                 fwrite(code, getSize(), 1, fp);
                                               ^
In file included from /home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/jit_avx2_gemm_f32.hpp:21:0,
                 from /home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/jit_avx2_gemm_f32.cpp:22:
/home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/jit_generator.hpp: In member function ‘void mkldnn::impl::cpu::jit_generator::dump_code(const uint8*) const’:
/home/luotao02/Paddle/build/third_party/mkldnn/src/extern_mkldnn/src/cpu/jit_generator.hpp:719:47: error: ignoring return value of ‘size_t fwrite(const void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result [-Werror=unused-result]
                 fwrite(code, getSize(), 1, fp);
                                               ^
cc1plus: all warnings being treated as errors
make[5]: *** [src/CMakeFiles/mkldnn.dir/cpu/jit_avx2_gemm_f32.cpp.o] Error 1
cc1plus: all warnings being treated as errors
make[5]: *** [src/CMakeFiles/mkldnn.dir/cpu/jit_uni_eltwise.cpp.o] Error 1
make[4]: *** [src/CMakeFiles/mkldnn.dir/all] Error 2
make[3]: *** [all] Error 2
make[2]: *** [third_party/mkldnn/src/extern_mkldnn-stamp/extern_mkldnn-build] Error 2
make[1]: *** [CMakeFiles/extern_mkldnn.dir/all] Error 2
make: *** [all] Error 2

Now we use -Wno-error=unused-result -Wno-unused-result to skip this error in PaddlePaddle/Paddle#10571. But could you help fix it at all? Thanks very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A confirmed library bug
Projects
None yet
Development

No branches or pull requests

2 participants