Re: [PATCH] avoid GCC 10 warning -Wstringop-truncation

2020-07-30 Thread Chris Johns
On 31/7/20 3:52 am, Sebastian Huber wrote: > On 30/07/2020 18:05, Gedare Bloom wrote: > >> On Thu, Jul 30, 2020 at 9:55 AM Sebastian Huber >> wrote: >>> On 30/07/2020 17:53, Gedare Bloom wrote: >>> On Thu, Jul 30, 2020 at 9:44 AM Sebastian Huber   wrote: > On 30/07/2020 13:36, Asc

Re: [PATCH] avoid GCC 10 warning -Wstringop-truncation

2020-07-30 Thread Gedare Bloom
On Thu, Jul 30, 2020 at 11:52 AM Sebastian Huber wrote: > > On 30/07/2020 18:05, Gedare Bloom wrote: > > > On Thu, Jul 30, 2020 at 9:55 AM Sebastian Huber > > wrote: > >> On 30/07/2020 17:53, Gedare Bloom wrote: > >> > >>> On Thu, Jul 30, 2020 at 9:44 AM Sebastian Huber > >>> wrote: > On 3

Re: [PATCH] avoid GCC 10 warning -Wstringop-truncation

2020-07-30 Thread Sebastian Huber
On 30/07/2020 18:05, Gedare Bloom wrote: On Thu, Jul 30, 2020 at 9:55 AM Sebastian Huber wrote: On 30/07/2020 17:53, Gedare Bloom wrote: On Thu, Jul 30, 2020 at 9:44 AM Sebastian Huber wrote: On 30/07/2020 13:36, Aschref Ben-Thabet wrote: diff --git a/testsuites/psxtests/psxndbm01/init.

Re: [PATCH] avoid GCC 10 warning -Wstringop-truncation

2020-07-30 Thread Sebastian Huber
On 30/07/2020 18:37, Joel Sherrill wrote: My recollection is that memcpy is undefined on overlapping memory regions. Yes. You should use memmove. A bigger question is why do these overlap and the code still thinks the copy is needed. strncpy() has the same problem with overlapping strings.

Re: [PATCH] avoid GCC 10 warning -Wstringop-truncation

2020-07-30 Thread Joel Sherrill
My recollection is that memcpy is undefined on overlapping memory regions. You should use memmove. A bigger question is why do these overlap and the code still thinks the copy is needed. --joel On Thu, Jul 30, 2020 at 10:37 AM Gedare Bloom wrote: > This looks good to me. memcpy followed by exp

Re: [PATCH] avoid GCC 10 warning -Wstringop-truncation

2020-07-30 Thread Gedare Bloom
On Thu, Jul 30, 2020 at 9:55 AM Sebastian Huber wrote: > > On 30/07/2020 17:53, Gedare Bloom wrote: > > > On Thu, Jul 30, 2020 at 9:44 AM Sebastian Huber > > wrote: > >> On 30/07/2020 13:36, Aschref Ben-Thabet wrote: > >> > >>> diff --git a/testsuites/psxtests/psxndbm01/init.c > >>> b/testsuite

Re: [PATCH] avoid GCC 10 warning -Wstringop-truncation

2020-07-30 Thread Sebastian Huber
On 30/07/2020 17:53, Gedare Bloom wrote: On Thu, Jul 30, 2020 at 9:44 AM Sebastian Huber wrote: On 30/07/2020 13:36, Aschref Ben-Thabet wrote: diff --git a/testsuites/psxtests/psxndbm01/init.c b/testsuites/psxtests/psxndbm01/init.c index a13afa7315..b524aff0df 100644 --- a/testsuites/psxte

Re: [PATCH] avoid GCC 10 warning -Wstringop-truncation

2020-07-30 Thread Gedare Bloom
On Thu, Jul 30, 2020 at 9:44 AM Sebastian Huber wrote: > > On 30/07/2020 13:36, Aschref Ben-Thabet wrote: > > > diff --git a/testsuites/psxtests/psxndbm01/init.c > > b/testsuites/psxtests/psxndbm01/init.c > > index a13afa7315..b524aff0df 100644 > > --- a/testsuites/psxtests/psxndbm01/init.c > > +

Re: [PATCH] avoid GCC 10 warning -Wstringop-truncation

2020-07-30 Thread Sebastian Huber
On 30/07/2020 13:36, Aschref Ben-Thabet wrote: From: Aschref Ben Thabet GCC 10 warns about an overlapping using strncpy. -> Replace some calls of strncpy with a memcpy to avoid this issue. --- cpukit/libblock/src/bdpart-mount.c | 4 ++-- testsuites/psxtests/psxndbm01/init.c | 2 +- 2 file

Re: [PATCH] avoid GCC 10 warning -Wstringop-truncation

2020-07-30 Thread Sebastian Huber
On 30/07/2020 13:36, Aschref Ben-Thabet wrote: diff --git a/testsuites/psxtests/psxndbm01/init.c b/testsuites/psxtests/psxndbm01/init.c index a13afa7315..b524aff0df 100644 --- a/testsuites/psxtests/psxndbm01/init.c +++ b/testsuites/psxtests/psxndbm01/init.c @@ -218,7 +218,7 @@ rtems_task Init(r

Re: [PATCH] avoid GCC 10 warning -Wstringop-truncation

2020-07-30 Thread Gedare Bloom
This looks good to me. memcpy followed by explicit delimiter assignment is better than strncpy. however, note below: On Thu, Jul 30, 2020 at 5:36 AM Aschref Ben-Thabet wrote: > > From: Aschref Ben Thabet > > GCC 10 warns about an overlapping using strncpy. > -> Replace some calls of strncpy with