Skip to content

Commit

Permalink
Potential uninitialised variable bug in E3SM buildlib files.
Browse files Browse the repository at this point in the history
At least with my computer, the compilation was crashing because
netcdf_args could be uninitialised because it was defined inside
an if/elif block that had no else.
  • Loading branch information
mpaiao committed Dec 23, 2024
1 parent fa90280 commit 66cb598
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions share/build/buildlib.mct
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ def buildlib(bldroot, installpath, case):
netcdf_args = f"NETCDF_PATH={os.environ['NETCDF_PATH']} "
elif "NETCDF_C_PATH" in os.environ:
netcdf_args = f"NETCDF_PATH={os.environ['NETCDF_C_PATH']} "
else:
netcdf_args = f" "

config_cmd = f"{mct_path}/configure CC={cc} FC={fc} MPICC={mcc} MPIFC={mfc} FCFLAGS='{fflags}' CPPDEFS='{cppdefs}' CFLAGS='{cflags}' LDFLAGS='{ldflags}' {config_args} {netcdf_args} --srcdir {mct_path}"

Expand Down
2 changes: 2 additions & 0 deletions share/build/buildlib.mpi-serial
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ def buildlib(bldroot, installpath, case):
netcdf_args = f"NETCDF_PATH={os.environ['NETCDF_PATH']} "
elif "NETCDF_C_PATH" in os.environ:
netcdf_args = f"NETCDF_PATH={os.environ['NETCDF_C_PATH']} "
else:
netcdf_args = f" "

config_cmd = f"{mpi_serial_path}/configure CC={cc} FC={fc} FCFLAGS='{fflags}' CPPDEFS='{cppdefs}' CFLAGS='{cflags}' LDFLAGS='{ldflags}' {config_args} {netcdf_args} --srcdir {mpi_serial_path}"

Expand Down

0 comments on commit 66cb598

Please sign in to comment.