Re: [R-pkg-devel] truncating strings on purpose

2024-12-16 Thread Ivan Krylov via R-package-devel
Dear Brad, Kurt, В Fri, 13 Dec 2024 18:08:27 + Brad Eck пишет: > The bad news is that following the gcc docs on avoid the warning did > not seem to work: I have asked on Libera.Chat's #gcc and was told that the "middle-end" warnings [1] (which include -Wstringop-truncation) should not count

Re: [R-pkg-devel] truncating strings on purpose

2024-12-13 Thread Brad Eck
Hi Ivan, List, Thanks for the suggestion, and for the pointer on duplicating the error. The good news is that I am able to trigger the warning locally now. The bad news is that following the gcc docs on avoid the warning did not seem to work: gcc -std=gnu99 -fsanitize=undefined -fno-omit-frame-p

Re: [R-pkg-devel] truncating strings on purpose

2024-12-11 Thread Iris Simmons
You could use memcpy instead. That gets rids of the type checking though. You could also define something like char * my_strncpy ( char * destination, const char * source, size_t num ) { return (char *) memcpy(destination, source, num) } to keep the type checking. On Wed, Dec 11, 2024, 07:12 Brad

Re: [R-pkg-devel] truncating strings on purpose

2024-12-11 Thread Ivan Krylov via R-package-devel
В Wed, 11 Dec 2024 12:12:11 + Brad Eck пишет: > Found the following significant warnings: > input2.c:863:5: warning: ‘__builtin_strncpy’ output may be > truncated copying 225 bytes from a string of length 255 > [-Wstringop-truncation] > Where the truncation warnings appear, I am truncati