AtChem / AtChem2

Atmospheric chemistry box-model for the MCM
MIT License
59 stars 22 forks source link

Compilation warning #488

Open rs028 opened 1 year ago

rs028 commented 1 year ago

Doesn't appear to be serious. Compilation ends with the following warning message:

gfortran-11 -o atchem2 -Jobj -Iobj src/dataStructures.f90 src/argparse.f90 src/interpolationFunctions.f90 src/configFunctions.f90 src/inputFunctions.f90 src/outputFunctions.f90 src/atmosphereFunctions.f90 src/solarFunctions.f90 src/constraintFunctions.f90 src/solverFunctions.f90 src/parameterModules.f90 src/atchem2.f90 -ffree-form -fimplicit-none -Wall -Wpedantic -fcheck=all -fPIC -O2 -Lcvode/lib -Lopenlibm-0.8.1 -Wl,-R,/usr/lib/:cvode/lib:openlibm-0.8.1 -lopenlibm -lsundials_fcvode -lsundials_cvode -lsundials_fnvecserial -lsundials_nvecserial -ldl
src/inputFunctions.f90:1081:35:

 1081 |     speciesNames = getSpeciesList()
      |                                   ^
Warning: ‘speciesnames.offset’ may be used uninitialized [-Wmaybe-uninitialized]
src/inputFunctions.f90:1077:64:

 1077 |     character(len=maxSpecLength), allocatable :: speciesNames(:), constrainedNames(:)
      |                                                                ^
note: ‘speciesnames’ declared here
src/inputFunctions.f90:1081:35:

 1081 |     speciesNames = getSpeciesList()
      |                                   ^
Warning: ‘speciesnames.dim[0].lbound’ may be used uninitialized [-Wmaybe-uninitialized]
src/inputFunctions.f90:1077:64:

 1077 |     character(len=maxSpecLength), allocatable :: speciesNames(:), constrainedNames(:)
      |                                                                ^
note: ‘speciesnames’ declared here
spco commented 1 year ago

I don't think this is worth worrying about - we compile with a lot of warning flags, and so this I believe is spurious. The compiler just can't rule out the possibility.

rs028 commented 1 year ago

Yeah I had a quick look at the affected code, but it seems to me you can't initialize the array there because we don't know yet its dimensions (I think!). Anyways it doesn't seem to affect anything other than being a bit annoying.