SCOREC / core

parallel finite element unstructured meshes
Other
179 stars 63 forks source link

fix gcc 12.3 -werror errors #420

Closed cwsmith closed 4 months ago

cwsmith commented 4 months ago

Building with Gcc 12.3 and all errors enabled results in the following errors:

phLinks.cc

cd /space/cwsmith/pumiTestRhel9Sim/build/phasta && /opt/scorec/spack/rhel9/v0201_4/install/linux-rhel9-x86_64/gcc-12.3.0/mpich-4.1.1-xpoyz4tqgfxtrm6m7qq67q4ccp5pnlre/bin/mpicxx -DHAVE_CLOCK_GETTIME -DHAVE_SIMADVMESHING -DHAVE_SIMMETRIX -DOMPI_SKIP_MPICXX -DPUMI_HAS_ZOLTAN -I/space/cwsmith/pumiTestRhel9Sim/core/phasta -I/space/cwsmith/pumiTestRhel9Sim/core/ma -I/space/cwsmith/pumiTestRhel9Sim/core/apf -I/space/cwsmith/pumiTestRhel9Sim/core/pcu -I/space/cwsmith/pumiTestRhel9Sim/core/pcu/reel -I/space/cwsmith/pumiTestRhel9Sim/core/gmi -I/space/cwsmith/pumiTestRhel9Sim/core/lion -I/space/cwsmith/pumiTestRhel9Sim/core/can -I/space/cwsmith/pumiTestRhel9Sim/core/mth -I/space/cwsmith/pumiTestRhel9Sim/core/mds -I/space/cwsmith/pumiTestRhel9Sim/core/parma -I/space/cwsmith/pumiTestRhel9Sim/core/zoltan -I/space/cwsmith/pumiTestRhel9Sim/core/sam -I/space/cwsmith/pumiTestRhel9Sim/core/pumi -I/opt/scorec/spack/rhel9/v0201_4/install/linux-rhel9-x86_64/gcc-12.3.0/simmetrix-simmodsuite-2024.0-240119dev-7abimo4wnqjk3h53clpzpb4gqljxnl2v/include -I/space/cwsmith/pumiTestRhel9Sim/core/gmi_sim -I/space/cwsmith/pumiTestRhel9Sim/core/apf_sim -g -Werror -Wall -Wextra -Wno-strict-overflow  -O3 -DNDEBUG -std=gnu++11 -MD -MT phasta/CMakeFiles/ph.dir/phLinks.cc.o -MF CMakeFiles/ph.dir/phLinks.cc.o.d -o CMakeFiles/ph.dir/phLinks.cc.o -c /space/cwsmith/pumiTestRhel9Sim/core/phasta/phLinks.cc
In member function 'virtual bool ph::PhastaSharing::isOwned(apf::MeshEntity*)',
    inlined from 'virtual bool ph::PhastaSharing::isOwned(apf::MeshEntity*)' at /space/cwsmith/pumiTestRhel9Sim/core/phasta/phLinks.cc:43:30,
    inlined from 'virtual bool ph::PhastaSharing::isOwned(apf::MeshEntity*)' at /space/cwsmith/pumiTestRhel9Sim/core/phasta/phLinks.cc:40:8,
    inlined from 'void ph::getLinks(apf::Mesh*, int, Links&, BCs&)' at /space/cwsmith/pumiTestRhel9Sim/core/phasta/phLinks.cc:112:23:
/space/cwsmith/pumiTestRhel9Sim/core/phasta/phLinks.cc:42:9: error: array subscript 'ph::PhastaSharing[0]' is partly outside array bounds of 'unsigned char [16]' [-Werror=array-bounds]
   42 |     if (isDG)
      |         ^~~~
In constructor 'ph::PhastaSharing::PhastaSharing(apf::Mesh*)',
    inlined from 'void ph::getLinks(apf::Mesh*, int, Links&, BCs&)' at /space/cwsmith/pumiTestRhel9Sim/core/phasta/phLinks.cc:101:22:
/space/cwsmith/pumiTestRhel9Sim/core/phasta/phLinks.cc:24:39: note: object of size 16 allocated by 'operator new'
   24 |     helperN = new apf::NormalSharing(m);
      |                                       ^
In member function 'virtual bool ph::PhastaSharing::isOwned(apf::MeshEntity*)',
    inlined from 'virtual bool ph::PhastaSharing::isOwned(apf::MeshEntity*)' at /space/cwsmith/pumiTestRhel9Sim/core/phasta/phLinks.cc:43:30,
    inlined from 'virtual bool ph::PhastaSharing::isOwned(apf::MeshEntity*)' at /space/cwsmith/pumiTestRhel9Sim/core/phasta/phLinks.cc:40:8,
    inlined from 'void ph::getLinks(apf::Mesh*, int, Links&, BCs&)' at /space/cwsmith/pumiTestRhel9Sim/core/phasta/phLinks.cc:112:23:
/space/cwsmith/pumiTestRhel9Sim/core/phasta/phLinks.cc:44:12: error: array subscript 'ph::PhastaSharing[0]' is partly outside array bounds of 'unsigned char [16]' [-Werror=array-bounds]
   44 |     return helperM->isOwned(e);
      |            ^~~~~~~
In constructor 'ph::PhastaSharing::PhastaSharing(apf::Mesh*)',
    inlined from 'void ph::getLinks(apf::Mesh*, int, Links&, BCs&)' at /space/cwsmith/pumiTestRhel9Sim/core/phasta/phLinks.cc:101:22:
/space/cwsmith/pumiTestRhel9Sim/core/phasta/phLinks.cc:24:39: note: object of size 16 allocated by 'operator new'
   24 |     helperN = new apf::NormalSharing(m);
      |                                       ^
In member function 'virtual void ph::PhastaSharing::getCopies(apf::MeshEntity*, apf::CopyArray&)',
    inlined from 'virtual void ph::PhastaSharing::getCopies(apf::MeshEntity*, apf::CopyArray&)' at /space/cwsmith/pumiTestRhel9Sim/core/phasta/phLinks.cc:51:25,
    inlined from 'void ph::getLinks(apf::Mesh*, int, Links&, BCs&)' at /space/cwsmith/pumiTestRhel9Sim/core/phasta/phLinks.cc:115:18:
/space/cwsmith/pumiTestRhel9Sim/core/phasta/phLinks.cc:50:9: error: array subscript 'ph::PhastaSharing[0]' is partly outside array bounds of 'unsigned char [16]' [-Werror=array-bounds]
   50 |     if (isDG)
      |         ^~~~
In constructor 'ph::PhastaSharing::PhastaSharing(apf::Mesh*)',
    inlined from 'void ph::getLinks(apf::Mesh*, int, Links&, BCs&)' at /space/cwsmith/pumiTestRhel9Sim/core/phasta/phLinks.cc:101:22:
/space/cwsmith/pumiTestRhel9Sim/core/phasta/phLinks.cc:24:39: note: object of size 16 allocated by 'operator new'
   24 |     helperN = new apf::NormalSharing(m);
      |                                       ^
In member function 'virtual void ph::PhastaSharing::getCopies(apf::MeshEntity*, apf::CopyArray&)',
    inlined from 'virtual void ph::PhastaSharing::getCopies(apf::MeshEntity*, apf::CopyArray&)' at /space/cwsmith/pumiTestRhel9Sim/core/phasta/phLinks.cc:51:25,
    inlined from 'void ph::getLinks(apf::Mesh*, int, Links&, BCs&)' at /space/cwsmith/pumiTestRhel9Sim/core/phasta/phLinks.cc:115:18:
/space/cwsmith/pumiTestRhel9Sim/core/phasta/phLinks.cc:53:7: error: array subscript 'ph::PhastaSharing[0]' is partly outside array bounds of 'unsigned char [16]' [-Werror=array-bounds]
   53 |       helperM->getCopies(e, copies);
      |       ^~~~~~~
In constructor 'ph::PhastaSharing::PhastaSharing(apf::Mesh*)',
    inlined from 'void ph::getLinks(apf::Mesh*, int, Links&, BCs&)' at /space/cwsmith/pumiTestRhel9Sim/core/phasta/phLinks.cc:101:22:
/space/cwsmith/pumiTestRhel9Sim/core/phasta/phLinks.cc:24:39: note: object of size 16 allocated by 'operator new'
   24 |     helperN = new apf::NormalSharing(m);
      |                                       ^
In member function 'virtual void ph::PhastaSharing::getCopies(apf::MeshEntity*, apf::CopyArray&)',
    inlined from 'virtual void ph::PhastaSharing::getCopies(apf::MeshEntity*, apf::CopyArray&)' at /space/cwsmith/pumiTestRhel9Sim/core/phasta/phLinks.cc:51:25,
    inlined from 'void ph::getLinks(apf::Mesh*, int, Links&, BCs&)' at /space/cwsmith/pumiTestRhel9Sim/core/phasta/phLinks.cc:115:18:
/space/cwsmith/pumiTestRhel9Sim/core/phasta/phLinks.cc:51:7: error: array subscript 'ph::PhastaSharing[0]' is partly outside array bounds of 'unsigned char [16]' [-Werror=array-bounds]
   51 |       helperN->getCopies(e, copies);
      |       ^~~~~~~
In constructor 'ph::PhastaSharing::PhastaSharing(apf::Mesh*)',
    inlined from 'void ph::getLinks(apf::Mesh*, int, Links&, BCs&)' at /space/cwsmith/pumiTestRhel9Sim/core/phasta/phLinks.cc:101:22:
/space/cwsmith/pumiTestRhel9Sim/core/phasta/phLinks.cc:24:39: note: object of size 16 allocated by 'operator new'
   24 |     helperN = new apf::NormalSharing(m);
      |                                       ^
cc1plus: all warnings being treated as errors
make[2]: *** [phasta/CMakeFiles/ph.dir/build.make:135: phasta/CMakeFiles/ph.dir/phLinks.cc.o] Error 1
make[2]: Leaving directory '/space/cwsmith/pumiTestRhel9Sim/build'
make[1]: *** [CMakeFiles/Makefile2:1323: phasta/CMakeFiles/ph.dir/all] Error 2
make[1]: Leaving directory '/space/cwsmith/pumiTestRhel9Sim/build'
make: *** [Makefile:149: all] Error 2

convert.cc

[ 62%] Building CXX object test/CMakeFiles/convert.dir/convert.cc.o
cd /space/cwsmith/pumiTestRhel9Sim/build/test && /opt/scorec/spack/rhel9/v0201_4/install/linux-rhel9-x86_64/gcc-12.3.0/mpich-4.1.1-xpoyz4tqgfxtrm6m7qq67q4ccp5pnlre/bin/mpicxx -DHAVE_CLOCK_GETTIME -DHAVE_SIMMETRIX -DOMPI_SKIP_MPICXX -DPUMI_HAS_ZOLTAN -I/space/cwsmith/pumiTestRhel9Sim/build/gmi_sim -I/space/cwsmith/pumiTestRhel9Sim/core/lion -I/space/cwsmith/pumiTestRhel9Sim/core/pcu -I/space/cwsmith/pumiTestRhel9Sim/core/pcu/reel -I/space/cwsmith/pumiTestRhel9Sim/core/gmi -I/opt/scorec/spack/rhel9/v0201_4/install/linux-rhel9-x86_64/gcc-12.3.0/simmetrix-simmodsuite-2024.0-240119dev-7abimo4wnqjk3h53clpzpb4gqljxnl2v/include -I/space/cwsmith/pumiTestRhel9Sim/core/gmi_sim -I/space/cwsmith/pumiTestRhel9Sim/core/can -I/space/cwsmith/pumiTestRhel9Sim/core/mth -I/space/cwsmith/pumiTestRhel9Sim/core/apf -I/space/cwsmith/pumiTestRhel9Sim/core/apf_sim -I/space/cwsmith/pumiTestRhel9Sim/core/mds -I/space/cwsmith/pumiTestRhel9Sim/core/parma -I/space/cwsmith/pumiTestRhel9Sim/core/zoltan -I/space/cwsmith/pumiTestRhel9Sim/core/pumi -I/space/cwsmith/pumiTestRhel9Sim/core/ma -I/space/cwsmith/pumiTestRhel9Sim/core/crv -I/space/cwsmith/pumiTestRhel9Sim/core/spr -I/space/cwsmith/pumiTestRhel9Sim/core/ree -I/space/cwsmith/pumiTestRhel9Sim/core/sam -I/space/cwsmith/pumiTestRhel9Sim/core/phasta -g -Werror -Wall -Wextra -Wno-strict-overflow  -O3 -DNDEBUG -std=gnu++11 -MD -MT test/CMakeFiles/convert.dir/convert.cc.o -MF CMakeFiles/convert.dir/convert.cc.o.d -o CMakeFiles/convert.dir/convert.cc.o -c /space/cwsmith/pumiTestRhel9Sim/core/test/convert.cc
/space/cwsmith/pumiTestRhel9Sim/core/test/convert.cc: In function 'void addFathersTag(pGModel, pParMesh, apf::Mesh*, const char*)':
/space/cwsmith/pumiTestRhel9Sim/core/test/convert.cc:360:19: error: unused variable 'exists' [-Werror=unused-variable]
  360 |         const int exists = EN_getDataPtr((pEntity)vrts[i],myFather,(void**)&fatherIdPtr);
      |                   ^~~~~~
cc1plus: all warnings being treated as errors
make[2]: *** [test/CMakeFiles/convert.dir/build.make:79: test/CMakeFiles/convert.dir/convert.cc.o] Error 1
make[2]: Leaving directory '/space/cwsmith/pumiTestRhel9Sim/build'
make[1]: *** [CMakeFiles/Makefile2:2751: test/CMakeFiles/convert.dir/all] Error 2
make[1]: Leaving directory '/space/cwsmith/pumiTestRhel9Sim/build'
make: *** [Makefile:149: all] Error 2
cwsmith commented 4 months ago

/runtests

cwsmith commented 4 months ago

/runtests