Re: [RFC] analyzer: allocation size warning

2022-06-22 Thread David Malcolm via Gcc
On Wed, 2022-06-22 at 16:57 +0200, Tim Lange wrote: > The checker reaches region-model.cc#3083 in my patch with the >   impl_region_model_context > on the 'after' node of create_buffer() but then discards the warning > inside > impl_region_model_context::warn because m_stmt is null. Even if m_stmt

Re: [RFC] analyzer: allocation size warning

2022-06-22 Thread Tim Lange
The checker reaches region-model.cc#3083 in my patch with the impl_region_model_context on the 'after' node of create_buffer() but then discards the warning inside impl_region_model_context::warn because m_stmt is null. Even if m_stmt were not be NULL at the 'after' node, my warning would be

Re: [RFC] analyzer: allocation size warning

2022-06-21 Thread David Malcolm via Gcc
On Tue, 2022-06-21 at 22:00 +0200, Tim Lange wrote: > On Sat Jun 18, 2022 at 12:13 AM CEST, David Malcolm wrote: > > On Fri, 2022-06-17 at 22:23 +0200, Tim Lange wrote: > > > On Fri, Jun 17, 2022 at 01:48:09PM -0400, David Malcolm wrote: > > > > On Fri, 2022-06-17 at 17:54 +0200, Tim Lange wrote:

Re: [RFC] analyzer: allocation size warning

2022-06-21 Thread Tim Lange
On Sat Jun 18, 2022 at 12:13 AM CEST, David Malcolm wrote: > On Fri, 2022-06-17 at 22:23 +0200, Tim Lange wrote: > > On Fri, Jun 17, 2022 at 01:48:09PM -0400, David Malcolm wrote: > > > On Fri, 2022-06-17 at 17:54 +0200, Tim Lange wrote: > > [...snip...] > > > > > > > > I have resent the patch

Re: [RFC] analyzer: allocation size warning

2022-06-17 Thread David Malcolm via Gcc
On Fri, 2022-06-17 at 22:23 +0200, Tim Lange wrote: > On Fri, Jun 17, 2022 at 01:48:09PM -0400, David Malcolm wrote: > > On Fri, 2022-06-17 at 17:54 +0200, Tim Lange wrote: [...snip...] > > > > I have resent the patch using git send-email as a reply to my original > message. > The new message

Re: [RFC] analyzer: allocation size warning

2022-06-17 Thread David Malcolm via Gcc
On Fri, 2022-06-17 at 21:23 +0200, Tim Lange wrote: > > > On Fr, Jun 17 2022 at 22:45:42 +0530, Prathamesh Kulkarni > wrote: > > On Fri, 17 Jun 2022 at 21:25, Tim Lange wrote: > > > > > >  Hi everyone, > > Hi Tim, > > Thanks for posting the POC patch! > > Just a couple of comments (inline) >

Re: [RFC] analyzer: allocation size warning

2022-06-17 Thread Tim Lange
On Fri, Jun 17, 2022 at 01:48:09PM -0400, David Malcolm wrote: > On Fri, 2022-06-17 at 17:54 +0200, Tim Lange wrote: > > Hi everyone, > > Hi Tim. > > Thanks for the patch. > > Various comments inline below, throughout... > > > > > tracked in PR105900 [0], I'd like to add support for a new

Re: [RFC] analyzer: allocation size warning

2022-06-17 Thread Tim Lange
On Fr, Jun 17 2022 at 22:45:42 +0530, Prathamesh Kulkarni wrote: On Fri, 17 Jun 2022 at 21:25, Tim Lange wrote: Hi everyone, Hi Tim, Thanks for posting the POC patch! Just a couple of comments (inline) Hi Prathamesh, thanks for looking at it. tracked in PR105900 [0], I'd like to

Re: [RFC] analyzer: allocation size warning

2022-06-17 Thread David Malcolm via Gcc
On Fri, 2022-06-17 at 17:54 +0200, Tim Lange wrote: > Hi everyone, Hi Tim. Thanks for the patch. Various comments inline below, throughout... > > tracked in PR105900 [0], I'd like to add support for a new warning on > dubious allocation sizes. The new checker emits a warning when the >

Re: [RFC] analyzer: allocation size warning

2022-06-17 Thread Prathamesh Kulkarni via Gcc
On Fri, 17 Jun 2022 at 21:25, Tim Lange wrote: > > Hi everyone, Hi Tim, Thanks for posting the POC patch! Just a couple of comments (inline) > > tracked in PR105900 [0], I'd like to add support for a new warning on > dubious allocation sizes. The new checker emits a warning when the > allocation

[RFC] analyzer: allocation size warning

2022-06-17 Thread Tim Lange
Hi everyone, tracked in PR105900 [0], I'd like to add support for a new warning on dubious allocation sizes. The new checker emits a warning when the allocation size is not a multiple of the type's size. With the checker, following mistakes are detected: int *arr = malloc(3); // forgot to