Project

General

Profile

Bug #2683

GCC 8.1 warnings

Added by Roland Schulz about 1 year ago. Updated 12 months ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
Affected version - extra info:
Affected version:
Difficulty:
uncategorized
Close

Description

The TNG warnings make sense why we don't see them in Jenkins. The only gcc 8 configuration is without TNG. For the other warnings I'm not sure. I don't have a local 8.2 install to test whether this is an issue with 8.1 or some other difference to the Jenkins configuration.

[459/1186] Building C object src/gromacs/CMakeFiles/tng_io_obj.dir/__/external/tng_io/src/lib/tng_io.c.o
../src/external/tng_io/src/lib/tng_io.c: In function ‘tng_time_get_str’:
../src/external/tng_io/src/lib/tng_io.c:15187:24: warning: ‘%02d’ directive output may be truncated writing between 2 and 11 bytes into a region of size between 0 and 16 [-Wformat-truncation=]
              "%4d-%02d-%02d %02d:%02d:%02d",
                        ^~~~
../src/external/tng_io/src/lib/tng_io.c:374:22: note: ‘snprintf’ output between 20 and 72 bytes into a destination of size 24
 #define TNG_SNPRINTF snprintf
                      ^
../src/external/tng_io/src/lib/tng_io.c:15186:5: note: in expansion of macro ‘TNG_SNPRINTF’
     TNG_SNPRINTF(time, TNG_MAX_DATE_STR_LEN,
     ^~~~~~~~~~~~
[713/1186] Building CXX object src/gromacs/CMakeFiles/libgromacs.dir/fileio/checkpoint.cpp.o
../src/gromacs/fileio/checkpoint.cpp: In function ‘int do_cpt_files(XDR*, gmx_bool, std::vector<gmx_file_position_t>*, FILE*, int)’:
../src/gromacs/fileio/checkpoint.cpp:1778:25: warning: ‘char* strncpy(char*, const char*, size_t)’ output may be truncated copying 1023 bytes from a string of length 1023 [-Wstringop-truncation]
             std::strncpy(outputfile.filename, buf.data(), buf.size()-1);
             ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[794/1186] Building CXX object src/gromacs/CMakeFiles/libgromacs.dir/gmxpreprocess/gen_vsite.cpp.o
../src/gromacs/gmxpreprocess/gen_vsite.cpp: In function ‘void read_vsite_database(const char*, t_vsiteconf**, int*, t_vsitetop**, int*)’:
../src/gromacs/gmxpreprocess/gen_vsite.cpp:282:36: warning: ‘char* strncpy(char*, const char*, size_t)’ output may be truncated copying 31 bytes from a string of length 4095 [-Wstringop-truncation]
                             strncpy(vsitetoplist[i].resname, dirstr, MAXNAME-1);
                             ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/gromacs/gmxpreprocess/gen_vsite.cpp:302:36: warning: ‘char* strncpy(char*, const char*, size_t)’ output may be truncated copying 31 bytes from a string of length 31 [-Wstringop-truncation]
                             strncpy(vsitetoplist[i].angle[k].atom1, s1, MAXNAME-1);
                             ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/gromacs/gmxpreprocess/gen_vsite.cpp:303:36: warning: ‘char* strncpy(char*, const char*, size_t)’ output may be truncated copying 31 bytes from a string of length 31 [-Wstringop-truncation]
                             strncpy(vsitetoplist[i].angle[k].atom2, s2, MAXNAME-1);
                             ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/gromacs/gmxpreprocess/gen_vsite.cpp:304:36: warning: ‘char* strncpy(char*, const char*, size_t)’ output may be truncated copying 31 bytes from a string of length 31 [-Wstringop-truncation]
                             strncpy(vsitetoplist[i].angle[k].atom3, s3, MAXNAME-1);
                             ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/gromacs/gmxpreprocess/gen_vsite.cpp:293:36: warning: ‘char* strncpy(char*, const char*, size_t)’ output may be truncated copying 31 bytes from a string of length 31 [-Wstringop-truncation]
                             strncpy(vsitetoplist[i].bond[k].atom1, s1, MAXNAME-1);
                             ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/gromacs/gmxpreprocess/gen_vsite.cpp:294:36: warning: ‘char* strncpy(char*, const char*, size_t)’ output may be truncated copying 31 bytes from a string of length 31 [-Wstringop-truncation]
                             strncpy(vsitetoplist[i].bond[k].atom2, s2, MAXNAME-1);
                             ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/gromacs/gmxpreprocess/gen_vsite.cpp:247:36: warning: ‘char* strncpy(char*, const char*, size_t)’ output may be truncated copying 31 bytes from a string of length 31 [-Wstringop-truncation]
                             strncpy(vsiteconflist[nvsite].atomtype, s1, MAXNAME-1);
                             ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/gromacs/gmxpreprocess/gen_vsite.cpp:249:36: warning: ‘char* strncpy(char*, const char*, size_t)’ output may be truncated copying 31 bytes from a string of length 31 [-Wstringop-truncation]
                             strncpy(vsiteconflist[nvsite].nextheavytype, s2, MAXNAME-1);
                             ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/gromacs/gmxpreprocess/gen_vsite.cpp:250:36: warning: ‘char* strncpy(char*, const char*, size_t)’ output may be truncated copying 31 bytes from a string of length 31 [-Wstringop-truncation]
                             strncpy(vsiteconflist[nvsite].dummymass, s3, MAXNAME-1);
                             ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/gromacs/gmxpreprocess/gen_vsite.cpp:237:36: warning: ‘char* strncpy(char*, const char*, size_t)’ output may be truncated copying 31 bytes from a string of length 31 [-Wstringop-truncation]
                             strncpy(vsiteconflist[nvsite].atomtype, s1, MAXNAME-1);
                             ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[795/1186] Building CXX object src/gromacs/CMakeFiles/libgromacs.dir/gmxana/gmx_tune_pme.cpp.o
../src/gromacs/gmxana/gmx_tune_pme.cpp: In function ‘void make_benchmark_tprs(const char*, char**, int64_t, int64_t, real, real, bool, const int*, t_inputinfo*, FILE*)’:
../src/gromacs/gmxana/gmx_tune_pme.cpp:1078:21: warning: ‘char* strncpy(char*, const char*, size_t)’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
         std::strncpy(fn_bench_tprs[j], fn_sim_tpr, std::strlen(fn_sim_tpr)-std::strlen(".tpr"));
         ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/gromacs/gmxana/gmx_tune_pme.cpp:1078:63: note: length computed here
         std::strncpy(fn_bench_tprs[j], fn_sim_tpr, std::strlen(fn_sim_tpr)-std::strlen(".tpr"));
                                                    ~~~~~~~~~~~^~~~~~~~~~~~
[955/1186] Building CXX object src/gromacs/CMakeFiles/libgromacs.dir/gmxana/gmx_wham.cpp.o
In function ‘void calc_cumulatives(t_UmbrellaWindow*, int, t_UmbrellaOptions*, const char*, const char*)’,
    inlined from ‘void do_bootstrapping(const char*, const char*, const char*, const char*, char*, double*, t_UmbrellaWindow*, int, t_UmbrellaOptions*)’ at ../src/gromacs/gmxana/gmx_wham.cpp:1669:29:
../src/gromacs/gmxana/gmx_wham.cpp:1274:16: warning: ‘char* strncpy(char*, const char*, size_t)’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
         sprintf(fn, "%s_cumul.xvg", std::strncpy(buf, fnhist, std::strlen(fnhist)-4));
         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/gromacs/gmxana/gmx_wham.cpp: In function ‘void do_bootstrapping(const char*, const char*, const char*, const char*, char*, double*, t_UmbrellaWindow*, int, t_UmbrellaOptions*)’:
../src/gromacs/gmxana/gmx_wham.cpp:1274:74: note: length computed here
         sprintf(fn, "%s_cumul.xvg", std::strncpy(buf, fnhist, std::strlen(fnhist)-4));
                                                               ~~~~~~~~~~~^~~~~~~~
In function ‘void print_histograms(const char*, t_UmbrellaWindow*, int, int, t_UmbrellaOptions*, const char*)’,
    inlined from ‘void do_bootstrapping(const char*, const char*, const char*, const char*, char*, double*, t_UmbrellaWindow*, int, t_UmbrellaOptions*)’ at ../src/gromacs/gmxana/gmx_wham.cpp:1715:29:
../src/gromacs/gmxana/gmx_wham.cpp:1516:16: warning: ‘char* strncpy(char*, const char*, size_t)’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
         sprintf(fn, "%s_bs%d.xvg", std::strncpy(buf, fnhist, std::strlen(fnhist)-4), bs_index);
         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/gromacs/gmxana/gmx_wham.cpp: In function ‘void do_bootstrapping(const char*, const char*, const char*, const char*, char*, double*, t_UmbrellaWindow*, int, t_UmbrellaOptions*)’:
../src/gromacs/gmxana/gmx_wham.cpp:1516:73: note: length computed here
         sprintf(fn, "%s_bs%d.xvg", std::strncpy(buf, fnhist, std::strlen(fnhist)-4), bs_index);
                                                              ~~~~~~~~~~~^~~~~~~~

Associated revisions

Revision e26e0599 (diff)
Added by Paul Bauer 12 months ago

Fix gcc-8 warnings

Changed copying of temporary file names to use gmx::Path, changed
copying of C character arrays to use std::copy. Annotated code where
safer string copying was needed.

Did not try to fix the warnings in tng.

Fixes #2683

Change-Id: I431b55dfa39a654fb9f20a78470f190da7666993

History

#1 Updated by Mark Abraham about 1 year ago

  • Target version changed from 2019-beta1 to 2019-beta2

#2 Updated by Paul Bauer about 1 year ago

  • Target version changed from 2019-beta2 to 2019-beta3

Any progress on this one?

#3 Updated by Mark Abraham about 1 year ago

Not yet. Once we're done with the beta, can you work on these please Paul?

#4 Updated by Paul Bauer about 1 year ago

Will work on this later today

#5 Updated by Paul Bauer about 1 year ago

  • Target version changed from 2019-beta3 to 2019-rc1

Wont be in time for beta3

#6 Updated by Paul Bauer about 1 year ago

I just tried reproducing this with gcc-8.2.0-8 on Debian, and the warnings don't show up (compiling with -Werror to make sure).
What are the build options here?

#7 Updated by Paul Bauer about 1 year ago

ok, the warnings only show up in a release build :)

#8 Updated by Gerrit Code Review Bot 12 months ago

Gerrit received a related patchset '1' for Issue #2683.
Uploader: Paul Bauer ()
Change-Id: gromacs~release-2019~I431b55dfa39a654fb9f20a78470f190da7666993
Gerrit URL: https://gerrit.gromacs.org/8745

#9 Updated by Paul Bauer 12 months ago

  • Status changed from New to Resolved

#10 Updated by Mark Abraham 12 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF