Compilation issues on gcc 9.1.1 [-Werror=stringop-truncation] #6720
Last updated: 2019-09-02 16:05:27 +0200
Date: 2019-06-26 10:10:35 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36
Compiling Apr2019 tip on FC30, gcc (GCC) 9.1.1 20190503
In file included from /usr/include/string.h:494,
Date: 2019-06-26 15:03:02 +0200
For complete details, see https//devmonetdborg/hg/MonetDB?cmd=changeset;node=c15ea2e68434
Date: 2019-06-26 17:09:38 +0200
There is one more strncpy (which triggers the same compilation issue) at monetdb5/modules/mal/mdb.c:703
Fixing this on top of your previous commit makes it compile correctly.
Date: 2019-06-26 18:10:54 +0200
I didn't get that error. However if I fix it in mdb.c:703, the error will be thrown elsewhere, because we use strncpy in many places.
Date: 2019-06-26 18:40:41 +0200
Mh, strange. I got only an error on that one and after fixing it I got no more errors.
Are you using gcc 9?
In any case, isn't it a good idea to change all occurrences of strncp into memcpy? strncpy will keep giving compilation errors. As far as I know, the only advantage of strncpy is that it pads the destination with 0s if the string is shorter than n. But in most cases that's not needed.
Date: 2019-07-15 10:44:45 +0200
Changing all strncpy calls to memcpy is not a priority. What is a priority is making sure the system compiles cleanly on as many environments as is reasonable (which includes the latest gcc).
The text was updated successfully, but these errors were encountered: