Some warnings when installing on macOS X

Compiler issues (Intel compiler, mpicc, etc.), data libraries and everything needed to get Serpent running is discussed here

Some warnings when installing on macOS X

Postby topefo » Fri Nov 02, 2018 12:56 pm

I just want to share the following experience when installing Serpent2 version 2.1.30 on the macOS X platform.
I also apologise for this long message.

I am at the moment using macOS X Sierra (version 10.12.6) with gcc version:

Petri@Toms-iMac: ~/Development/serpent2/src/2.1.30 > gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 9.0.0 (clang-900.0.39.2)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Petri@Toms-iMac: ~/Development/serpent2/src/2.1.30 >

I have used Homebrew package manager to install OpenMp and GD libraries and made the following changes to
the Serpent2 Makefile based on the recommendation from Homebrew:

CC = gcc
#CFLAGS = -Wall -ansi -ffast-math -O3
CFLAGS = -Wall -ansi -std=c99 -ffast-math -O3
LDFLAGS = -lm

# Parallel calculation using Open MP:

CFLAGS += -DOPEN_MP
#CFLAGS += -fopenmp
#LDFLAGS += -fopenmp
CFLAGS += -I/usr/local/opt/libomp/include -Xpreprocessor -fopenmp
LDFLAGS += -L/usr/local/opt/libomp/lib -lomp

The compilation terminates successfully with the "Serpent 2 Compiled OK.” message at the end and I can run
the sss2 -version command (although I have not tried a real case yet):

Petri@Toms-iMac: ~/Development/serpent2/src/2.1.30 > sss2 -version

_ .-=-. .-=-. .-==-.
{ } __ .' O o '. .' O o '. / -<' )--<
{ } .' O'. / o .-. O \ / o .-. O \ / .---`
{ } / .-. o\ /O / \ o\ /O / \ o\ /O /
\ `-` / \ O`-'o / \ O`-'o / \ O`-`o /
`-.-` '.____.' `._____.' `.____.'

Serpent 2 beta

A Continuous-energy Monte Carlo Reactor Physics Burnup Calculation Code

- Version 2.1.30 (February 14, 2018) -- Contact: serpent@vtt.fi

- Reference: J. Leppanen, et al. "The Serpent Monte Carlo code: Status,
development and applications in 2013." Ann. Nucl. Energy,
82 (2015) 142-150.

- Compiled Oct 21 2018 12:08:54

- MPI Parallel calculation mode not available

- OpenMP Parallel calculation mode available

- Geometry and mesh plotting available

- Default data path not set

Petri@Toms-iMac: ~/Development/serpent2/src/2.1.30 >

However, I get some unexpected warnings during compile time, I have listed them below.
Did someone have similar experiences? Do someone have any suggestions regarding them,
are they due to a old gcc-version? Can they really be ignored?

Many thanks!
/Petri

gcc -Wall -ansi -std=c99 -ffast-math -O3 -DOPEN_MP -I/usr/local/opt/libomp/include -Xpreprocessor -fopenmp -pedantic -c boundaryconditions.c
boundaryconditions.c:552:12: warning: variable 'i' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
else if ((type == SURF_HEXXC) || (type == SURF_HEXXPRISM))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
boundaryconditions.c:702:8: note: uninitialized use occurs here
if ((i == 0) && (j == 0) && (k == 0))
^
boundaryconditions.c:552:8: note: remove the 'if' if its condition is always true
else if ((type == SURF_HEXXC) || (type == SURF_HEXXPRISM))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
boundaryconditions.c:36:28: note: initialize the variable 'i' to silence this warning
long surf, param, type, i, j, k, bc0, bc1, bc2, bc3, ptr;
^
= 0
1 warning generated.

gcc -Wall -ansi -std=c99 -ffast-math -O3 -DOPEN_MP -I/usr/local/opt/libomp/include -Xpreprocessor -fopenmp -pedantic -c initdata.c
initdata.c:84:3: warning: implicit declaration of function 'setlinebuf' is invalid in C99 [-Wimplicit-function-declaration]
setlinebuf(outp);
^
1 warning generated.

gcc -Wall -ansi -std=c99 -ffast-math -O3 -DOPEN_MP -I/usr/local/opt/libomp/include -Xpreprocessor -fopenmp -pedantic -c polynomialzernike.c
polynomialzernike.c:75:7: warning: absolute value function 'abs' given an argument of type 'long' but has parameter of type 'int' which may cause truncation of value [-Wabsolute-value]
if (abs(m) > n)
^
polynomialzernike.c:75:7: note: use function 'labs' instead
if (abs(m) > n)
^~~
labs
polynomialzernike.c:372:7: warning: absolute value function 'abs' given an argument of type 'long' but has parameter of type 'int' which may cause truncation of value [-Wabsolute-value]
if (abs(m) > n)
^
polynomialzernike.c:372:7: note: use function 'labs' instead
if (abs(m) > n)
^~~
labs
2 warnings generated.

gcc -Wall -ansi -std=c99 -ffast-math -O3 -DOPEN_MP -I/usr/local/opt/libomp/include -Xpreprocessor -fopenmp -pedantic -c processcompton.c
processcompton.c:267:17: warning: explicitly assigning value of variable of type 'double' to itself [-Wself-assign]
dummy = dummy; /* Avoid compiler warning */
~~~~~ ^ ~~~~~
processcompton.c:73:11: warning: variable 'Ndata' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (fgets(linebuf, Nbuf, fp)) {
^~~~~~~~~~~~~~~~~~~~~~~~
processcompton.c:119:33: note: uninitialized use occurs here
ptr0 = ReallocMem(DATA_ARRAY, Ndata);
^~~~~
processcompton.c:73:7: note: remove the 'if' if its condition is always true
if (fgets(linebuf, Nbuf, fp)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
processcompton.c:68:10: warning: variable 'Ndata' is used uninitialized whenever 'while' loop exits because its condition is false [-Wsometimes-uninitialized]
while (fgets(linebuf, Nbuf, fp)) {
^~~~~~~~~~~~~~~~~~~~~~~~
processcompton.c:119:33: note: uninitialized use occurs here
ptr0 = ReallocMem(DATA_ARRAY, Ndata);
^~~~~
processcompton.c:68:10: note: remove the condition if it is always true
while (fgets(linebuf, Nbuf, fp)) {
^~~~~~~~~~~~~~~~~~~~~~~~
1
processcompton.c:31:19: note: initialize the variable 'Ndata' to silence this warning
long i, j, Ndata, ptr0, ptr1, Nss, Npz, idx, pzminidx, Npzlin, Npzlog,
^
= 0
3 warnings generated.

gcc -Wall -ansi -std=c99 -ffast-math -O3 -DOPEN_MP -I/usr/local/opt/libomp/include -Xpreprocessor -fopenmp -pedantic -c readifcregmesh.c
readifcregmesh.c:217:12: warning: variable 'nx' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
else if (n == MESH_TYPE_ORTHOGONAL)
^~~~~~~~~~~~~~~~~~~~~~~~~
readifcregmesh.c:239:8: note: uninitialized use occurs here
np = nx*ny*nz;
^~
readifcregmesh.c:217:8: note: remove the 'if' if its condition is always true
else if (n == MESH_TYPE_ORTHOGONAL)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
readifcregmesh.c:25:10: note: initialize the variable 'nx' to silence this warning
long nx, ny, nz, i, j, k, nr, tmplist, rholist;
^
= 0
readifcregmesh.c:217:12: warning: variable 'ny' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
else if (n == MESH_TYPE_ORTHOGONAL)
^~~~~~~~~~~~~~~~~~~~~~~~~
readifcregmesh.c:239:11: note: uninitialized use occurs here
np = nx*ny*nz;
^~
readifcregmesh.c:217:8: note: remove the 'if' if its condition is always true
else if (n == MESH_TYPE_ORTHOGONAL)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
readifcregmesh.c:25:14: note: initialize the variable 'ny' to silence this warning
long nx, ny, nz, i, j, k, nr, tmplist, rholist;
^
= 0
2 warnings generated.

gcc -Wall -ansi -std=c99 -ffast-math -O3 -DOPEN_MP -I/usr/local/opt/libomp/include -Xpreprocessor -fopenmp -pedantic -c readwwdmesh.c
readwwdmesh.c:619:16: warning: variable 'nx' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
else if ((mty == MESH_TYPE_ORTHOGONAL) ||
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
readwwdmesh.c:642:12: note: uninitialized use occurs here
if ((nx < 1) || (nx > 1000000))
^~
readwwdmesh.c:619:12: note: remove the 'if' if its condition is always true
else if ((mty == MESH_TYPE_ORTHOGONAL) ||
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
readwwdmesh.c:30:41: note: initialize the variable 'nx' to silence this warning
long i, j, k, np, l, m, ne[2], mty, nx, ny, nz, nmax, nf, ng, i0, j0, k0;
^
= 0
1 warning generated.

gcc -Wall -ansi -std=c99 -ffast-math -O3 -DOPEN_MP -I/usr/local/opt/libomp/include -Xpreprocessor -fopenmp -pedantic -c samplemeshdelnu.c
samplemeshdelnu.c:353:34: warning: variable 'u' is uninitialized when used here [-Wuninitialized]
if ((cell = WhereAmI(x, y, z, u, v, w, id)) < VALID_PTR)
^
samplemeshdelnu.c:31:18: note: initialize the variable 'u' to silence this warning
double E, mu, u, v, w, wgt2, val;
^
= 0.0
samplemeshdelnu.c:353:37: warning: variable 'v' is uninitialized when used here [-Wuninitialized]
if ((cell = WhereAmI(x, y, z, u, v, w, id)) < VALID_PTR)
^
samplemeshdelnu.c:31:21: note: initialize the variable 'v' to silence this warning
double E, mu, u, v, w, wgt2, val;
^
= 0.0
samplemeshdelnu.c:353:40: warning: variable 'w' is uninitialized when used here [-Wuninitialized]
if ((cell = WhereAmI(x, y, z, u, v, w, id)) < VALID_PTR)
^
samplemeshdelnu.c:31:24: note: initialize the variable 'w' to silence this warning
double E, mu, u, v, w, wgt2, val;
^
= 0.0
3 warnings generated.

gcc -Wall -ansi -std=c99 -ffast-math -O3 -DOPEN_MP -I/usr/local/opt/libomp/include -Xpreprocessor -fopenmp -pedantic -c samplereaction.c
samplereaction.c:204:8: warning: variable 'rea' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (TMS == TMS_MODE_MG)
^~~~~~~~~~~~~~~~~~
samplereaction.c:223:20: note: uninitialized use occurs here
totxs = MacroXS(rea, E, id);
^~~
samplereaction.c:204:4: note: remove the 'if' if its condition is always false
if (TMS == TMS_MODE_MG)
^~~~~~~~~~~~~~~~~~~~~~~
samplereaction.c:28:16: note: initialize the variable 'rea' to silence this warning
long lst, rea, rls, ptr, i, nuc, ng, TMS, mt;
^
= 0
1 warning generated.

gcc -Wall -ansi -std=c99 -ffast-math -O3 -DOPEN_MP -I/usr/local/opt/libomp/include -Xpreprocessor -fopenmp -pedantic -c samplesrcpoint.c
samplesrcpoint.c:335:19: warning: variable 'wgt1' is used uninitialized whenever 'for' loop exits because its condition is false [-Wsometimes-uninitialized]
for (n = 0; n < MAX_SRC_RESAMPLE; n++)
^~~~~~~~~~~~~~~~~~~~
samplesrcpoint.c:1027:30: note: uninitialized use occurs here
WDB[part + PARTICLE_WGT] = wgt1;
^~~~
samplesrcpoint.c:335:19: note: remove the condition if it is always true
for (n = 0; n < MAX_SRC_RESAMPLE; n++)
^~~~~~~~~~~~~~~~~~~~
samplesrcpoint.c:30:42: note: initialize the variable 'wgt1' to silence this warning
double xt, yt, zt, t, dummy, wgt0, wgt1, Emin, Emax, meanw, meanb, val;
^
= 0.0
samplesrcpoint.c:335:19: warning: variable 'wgt' is used uninitialized whenever 'for' loop exits because its condition is false [-Wsometimes-uninitialized]
for (n = 0; n < MAX_SRC_RESAMPLE; n++)
^~~~~~~~~~~~~~~~~~~~
samplesrcpoint.c:1057:50: note: uninitialized use occurs here
ScoreMesh(part, mat, 0.0, -1.0, x, y, z, E, t, wgt, -1.0, id);
^~~
samplesrcpoint.c:335:19: note: remove the condition if it is always true
for (n = 0; n < MAX_SRC_RESAMPLE; n++)
^~~~~~~~~~~~~~~~~~~~
samplesrcpoint.c:29:43: note: initialize the variable 'wgt' to silence this warning
double rnd, mu, x, y, z, u, v, w, E, wgt, xmin, xmax, ymin, ymax, zmin, zmax;
^
= 0.0
2 warnings generated.

gcc -Wall -ansi -std=c99 -ffast-math -O3 -DOPEN_MP -I/usr/local/opt/libomp/include -Xpreprocessor -fopenmp -pedantic -c testxs.c
testxs.c:604:7: warning: implicit declaration of function 'setlinebuf' is invalid in C99 [-Wimplicit-function-declaration]
setlinebuf(outp);
^
1 warning generated.
topefo
 
Posts: 1
Joined: Fri Nov 02, 2018 12:33 pm

Return to Compiling and installing Serpent

Who is online

Users browsing this forum: No registered users and 2 guests