Mysticial / Mini-Pi

A miniature program that can compute Pi to millions of digits.
Creative Commons Zero v1.0 Universal
134 stars 23 forks source link

Please g++ warnings #8

Closed jirka-h closed 1 year ago

jirka-h commented 1 year ago

When compiling with

$ g++ -Wall -Wextra -O3 -g -fopenmp -march=native -std=c++17 -o mini-pi_optimized_3_OpenMP mini-pi_optimized_3_OpenMP.cpp 

I'm getting the warnings below. Could you please have a look to see if these can be fixed?

Thanks a lot!

Jirka

mini-pi_optimized_3_OpenMP.cpp: In function ‘void Mini_Pi::fft_forward(__m128d*, int, int)’:
mini-pi_optimized_3_OpenMP.cpp:164:23: warning: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
  164 |     for (int c = 0; c < half_length; c++){
      |                     ~~^~~~~~~~~~~~~
mini-pi_optimized_3_OpenMP.cpp: In function ‘void Mini_Pi::fft_inverse(__m128d*, int, int)’:
mini-pi_optimized_3_OpenMP.cpp:260:23: warning: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
  260 |     for (int c = 0; c < half_length; c++){
      |                     ~~^~~~~~~~~~~~~
mini-pi_optimized_3_OpenMP.cpp: In member function ‘Mini_Pi::BigFloat Mini_Pi::BigFloat::mul(const Mini_Pi::BigFloat&, size_t, int) const’:
mini-pi_optimized_3_OpenMP.cpp:937:53: warning: ignoring attributes on template argument ‘__m128d []’ [-Wignored-attributes]
  937 |     auto Ta = std::unique_ptr<__m128d[], SIMD_delete>((__m128d*)_mm_malloc(length * sizeof(__m128d), 16), deletor);
      |                                                     ^
mini-pi_optimized_3_OpenMP.cpp:938:53: warning: ignoring attributes on template argument ‘__m128d []’ [-Wignored-attributes]
  938 |     auto Tb = std::unique_ptr<__m128d[], SIMD_delete>((__m128d*)_mm_malloc(length * sizeof(__m128d), 16), deletor);
      |                                                     ^
Mysticial commented 1 year ago

I went ahead and fixed the first 2. But the last 2 is more involved. So just suppress the warning for those.

jirka-h commented 1 year ago

Thanks a lot for having a look! :+1:

Jirka