Re: [PATCH] analyzer: consider empty ranges and zero byte accesses [PR106845]

2022-09-11 Thread Tim Lange
> ...it took me a moment to realize that the analyzer "sees" that this is > "main", and thus buf_size is 0. > > Interestingly, if I rename it to not be "main" (and thus buf_size could > be non-zero), we still don't complain: > https://godbolt.org/z/PezfTo9Mz > Presumably this is a known

Re: [PATCH] analyzer: consider empty ranges and zero byte accesses [PR106845]

2022-09-11 Thread David Malcolm via Gcc-patches
On Sun, 2022-09-11 at 10:21 +0200, Bernhard Reutner-Fischer wrote: > On 11 September 2022 10:04:51 CEST, David Malcolm via Gcc-patches > wrote: > > > > +++ b/gcc/testsuite/gcc.dg/analyzer/pr106845.c > > > @@ -0,0 +1,11 @@ > > > +int buf_size; > > > + > > > +int > > > +main (void) > > > +{ > > >

Re: [PATCH] analyzer: consider empty ranges and zero byte accesses [PR106845]

2022-09-11 Thread Bernhard Reutner-Fischer via Gcc-patches
On 11 September 2022 10:04:51 CEST, David Malcolm via Gcc-patches wrote: >> +++ b/gcc/testsuite/gcc.dg/analyzer/pr106845.c >> @@ -0,0 +1,11 @@ >> +int buf_size; >> + >> +int >> +main (void) >> +{ >> +  char buf[buf_size]; >> + >> +  __builtin_memset ([1], 0, buf_size); >> + >> +  return 0; >>

Re: [PATCH] analyzer: consider empty ranges and zero byte accesses [PR106845]

2022-09-11 Thread David Malcolm via Gcc-patches
On Sun, 2022-09-11 at 00:19 +0200, Tim Lange wrote: > Hi, > > see my patch below for a fix of pr106845.  I decided to allow > bit_ranges > and byte_ranges to have a size of zero and rather only add an > assertion > to the functions that assume a non-zero size.  That way is more > elegant in > the

[PATCH] analyzer: consider empty ranges and zero byte accesses [PR106845]

2022-09-10 Thread Tim Lange
Hi, see my patch below for a fix of pr106845. I decided to allow bit_ranges and byte_ranges to have a size of zero and rather only add an assertion to the functions that assume a non-zero size. That way is more elegant in the caller than restricting byte_range to only represent non-empty