geodynamics / aspect

A parallel, extensible finite element code to simulate convection in both 2D and 3D models.
https://aspect.geodynamics.org/
Other
223 stars 235 forks source link

warning compiling aspect #5138

Closed mibillen closed 1 year ago

mibillen commented 1 year ago

Hello,

When compiling the main branch of aspect on our cluster, I got the following warning (just an FYI) - I"m not using particles so I don't know if this is actually creating any real issue with computations):

[ 94%] Building CXX object CMakeFiles/aspect.dir/Unity/unity_9_cxx.cxx.o In file included from /group/billengrp/Software/aspect-source/aspect/build-debug-deal.ii-9.4.2/CMakeFiles/aspect.dir/Unity/unity_25_cxx.cxx:5: /group/billengrp/Software/aspect-source/aspect/source/particle/world.cc: In instantiation of 'void aspect::Particle::internal::SolutionEvaluatorsImplementation<dim, n_compositional_fields>::get_solution(unsigned int, dealii::Vector&) [with int dim = 3; int n_compositional_fields = 0]': /group/billengrp/Software/aspect-source/aspect/source/particle/world.cc:1152:7: required from here /group/billengrp/Software/aspect-source/aspect/source/particle/world.cc:1168:33: warning: comparison of unsigned expression in '< 0' is always false [-Wtype-limits] 1168 | for (unsigned int j=0; j<n_compositional_fields; ++j) | ~^~~~~~~

here's information about compiling: This was compiled with deal.ii-9.4.2, openmpi-4.1.4 (with gcc7) This is ASPECT, the Advanced Solver for Problems in Earth's ConvecTion.

version 2.5.0-pre (main, 340c0d018) -- . using deal.II 9.4.2 -- . with 32 bit indices and vectorization level 1 (128 bits) -- . using Trilinos 13.2.0 -- . using p4est 2.3.2 -- . running in DEBUG mode -- . running with 1 MPI process

tjhei commented 1 year ago

Thank you. This is indeed harmless, but we should fix the warning regardless.

gassmoeller commented 1 year ago

I tried to fix the warning in #5143, but I couldnt reproduce the warning so I am not sure if the compiler understands the fix. Could you try if #5143 resolves the warning for you?

In any case, like Timo said the warning is completely harmless, the compiler is essentially just telling us: This code is useless, why are you doing this? But it does not understand that for more than zero compositional fields this code is necessary.

bangerth commented 1 year ago

Let's pretend that @gassmoeller 's patch actually fixed this. @mibillen Please reopen if you still have this warning!

mibillen commented 1 year ago

I'm sorry I didn't see this sooner... I have Aspect messages go to a separate mailbox and I needed to move the mailbox where I see it more easily. I compiled the new version of Aspect last week and there were no warnings.