Re: GSoC: Working on the static analyzer

2022-01-26 Thread David Malcolm via Gcc
On Mon, 2022-01-24 at 01:41 +0530, Mir Immad wrote: > Hi, sir. > > I've been trying to understand the static analyzer's code. I spent most > of > my time learning the state machine's API. I learned how state machine's > on_stmt is supposed to "recognize" specific functions and how > on_transition

Re: GSoC: Working on the static analyzer

2022-01-26 Thread David Malcolm via Gcc
On Mon, 2022-01-24 at 19:49 +0530, Ankur Saini wrote: > The following can be a possible example of a case where the analyzer > fails > to understand POSIX file-descriptor API. > > - - - > #include > #include > > void test() > { >     int fd; >     fd = open("foo.txt", O_RDONLY | O_CREAT); > } >

Re: GSoC: Working on the static analyzer

2022-01-29 Thread David Malcolm via Gcc
On Sat, 2022-01-29 at 20:22 +0530, Mir Immad wrote: > Thank you for the detailed information. > > I've been looking into the integer posix  file descriptor APIs and I > decided to write proof-of-concept  checker for them. (not caring > about > errno). The checker tracks the fd returned by open(),

Re: Bisecting

2022-01-30 Thread David Malcolm via Gcc
On Sun, 2022-01-30 at 01:09 +, Jonathan Wakely via Gcc wrote: > On Sat, 29 Jan 2022, 20:25 Søren Holm via Gcc, wrote: > > > Hi > > > > I believe I have found some kind of bug in GCC. The target is a > > cortex-m7 CPU. I do not have an isolated test software so I'm > > thinking > > of bisecti

Re: [PATCH] testsuite: avoid analyzer asm failures on non-Linux

2022-02-07 Thread David Malcolm via Gcc
On Mon, 2022-02-07 at 18:08 +0100, FX wrote: > Hi David, > > > Thanks.  I extended your patch as follows, which works successfully > > for > > me on x86_64-pc-linux-gnu. > > > > Does the following look OK for the analyzer asm failures on > > x86_64-apple-darwin? > > Sorry for the late reply… yes

Re: GSoC: Working on the static analyzer

2022-02-13 Thread David Malcolm via Gcc
On Sun, 2022-02-13 at 21:16 +0530, Mir Immad wrote: > Hi, > > I wanted some clarification on bifurcating the exploded graph at call > to > open(). > Should the analyzer warn for code like this "when open fails" (like > strchr > does when  'strchr' returns NULL) > > int fd = open("NOFILE", O_RDONL

Re: GSoC: Working on the static analyzer

2022-02-13 Thread David Malcolm via Gcc
On Sun, 2022-02-13 at 17:57 -0500, David Malcolm wrote: > On Sun, 2022-02-13 at 21:16 +0530, Mir Immad wrote: > > Hi, > > > > I wanted some clarification on bifurcating the exploded graph at > > call > > to > > open(). > > Should the analyzer warn for code like this "when open fails" (like > > str

Uninit warnings due to optimizing short-circuit conditionals

2022-02-14 Thread David Malcolm via Gcc
[CCing Mark in the hopes of insight from the valgrind side of things] There is a false positive from -Wanalyzer-use-of-uninitialized-value on gcc.dg/analyzer/pr102692.c here: ‘fix_overlays_before’: events 1-3 | | 75 | while (tail | | | 76 | && (

Re: Uninit warnings due to optimizing short-circuit conditionals

2022-02-14 Thread David Malcolm via Gcc
On Mon, 2022-02-14 at 09:26 -0700, Jeff Law wrote: > > > On 2/14/2022 8:57 AM, David Malcolm via Gcc wrote: > > [CCing Mark in the hopes of insight from the valgrind side of things] > > > > There is a false positive from -Wanalyzer-use-of-uninitialized-value > >

Re: Uninit warnings due to optimizing short-circuit conditionals

2022-02-14 Thread David Malcolm via Gcc
On Mon, 2022-02-14 at 17:57 +0100, Mark Wielaard wrote: > Hi David, > > On Mon, 2022-02-14 at 10:57 -0500, David Malcolm wrote: > > [CCing Mark in the hopes of insight from the valgrind side of > > things] > > Adding Julian to CC so he can correct me if I say something silly. > > > There is a fa

Re: Request easy bug fix

2022-02-15 Thread David Malcolm via Gcc
On Tue, 2022-02-15 at 12:55 +, Jonathan Wakely via Gcc wrote: > On Tue, 15 Feb 2022 at 12:34, Baruch Burstein via Gcc < > gcc@gcc.gnu.org> > wrote: > > > Hi, > > > > I hope it is not inappropriate to call attention to a specific bug. > > https://gcc.gnu.org/bugzilla//show_bug.cgi?id=85487. >

Re: Uninit warnings due to optimizing short-circuit conditionals

2022-02-15 Thread David Malcolm via Gcc
On Tue, 2022-02-15 at 14:28 +0100, Richard Biener wrote: > On Tue, Feb 15, 2022 at 2:00 PM Julian Seward > wrote: > > > > Sorry for the delayed response.  I've been paging this all back in. > > > > I first saw this problem when memcheck-ing Firefox as compiled by > > Clang, some > > years back. 

Re: GCC GSoC 2022: Call for project ideas and mentors

2022-02-21 Thread David Malcolm via Gcc
On Sun, 2022-02-20 at 12:19 +0100, Thomas Schwinge wrote: > Hi David! > > On 2022-01-07T12:41:17-0500, David Malcolm via Fortran < > fort...@gcc.gnu.org> wrote: > > I'd like to (again) mentor a project relating to the GCC static > > analyzer: > >   https://gcc.gnu.org/wiki/DavidMalcolm/StaticAnal

__attribute__ ((access, ...)) vs __attribute__ ((nonnull))

2022-03-09 Thread David Malcolm via Gcc
We gained __attribute__ ((access, ...)) in GCC 10: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html which identifies one of the pointer/reference arguments of a function as being accessed according to an access-mode: read_only, read_write, write_only, or none. We also have __at

[PATCH] Document that the 'access' and 'nonnull' attributes are independent

2022-03-09 Thread David Malcolm via Gcc
On Wed, 2022-03-09 at 13:30 -0800, Andrew Pinski wrote: > On Wed, Mar 9, 2022 at 1:25 PM David Malcolm via Gcc > wrote: > > > > We gained __attribute__ ((access, ...)) in GCC 10: > >   > > https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html > >

[PATCH v2] Document that the 'access' and 'nonnull' attributes are independent

2022-03-23 Thread David Malcolm via Gcc
On Mon, 2022-03-14 at 16:18 -0600, Martin Sebor wrote: > On 3/9/22 14:57, David Malcolm via Gcc wrote: > > On Wed, 2022-03-09 at 13:30 -0800, Andrew Pinski wrote: > > > On Wed, Mar 9, 2022 at 1:25 PM David Malcolm via Gcc > > > wrote: > > > > > > &

[PATCH v3] Document that the 'access' and 'nonnull' attributes are independent

2022-03-25 Thread David Malcolm via Gcc
On Wed, 2022-03-23 at 17:52 +0100, Sebastian Huber wrote: > On 23/03/2022 17:31, Martin Sebor via Gcc-patches wrote: > > > > The concern is that the constraints implied by atttributes access > > and > > nonnull are independent of each other. I would suggest to document > > that without talking ab

Re: GSoC: Extending the Static Analysis Pass

2022-04-04 Thread David Malcolm via Gcc
On Sun, 2022-04-03 at 17:56 +0200, Tim Lange wrote: > Hi everyone, > Hi David, Hi Tim > > I'm interested in extending the static analysis pass as a GSoC > project. Excellent. > Short introduction of me: I'm Tim, currently doing my master in > computer science with focus on IT security at TU D

Re: [PATCH v3] Document that the 'access' and 'nonnull' attributes are independent

2022-04-05 Thread David Malcolm via Gcc
On Fri, 2022-03-25 at 14:38 -0600, Martin Sebor wrote: > On 3/25/22 12:45, David Malcolm wrote: > > On Wed, 2022-03-23 at 17:52 +0100, Sebastian Huber wrote: > > > On 23/03/2022 17:31, Martin Sebor via Gcc-patches wrote: > > > > > > > > The concern is that the constraints implied by atttributes >

Re: GSoC: Working on the static analyzer

2022-04-08 Thread David Malcolm via Gcc
On Mon, 2022-04-04 at 21:46 +0530, Mir Immad wrote: > Hi David, > > Sorry for such late reply. I've been busy with classes and exams. > > As the contributor applications are opening, I would like to put > forward a > proposal for a medium project for extending the static analyzer to work > with P

Re: GSoC proposal for extending static analyzer

2022-04-15 Thread David Malcolm via Gcc
On Fri, 2022-04-15 at 19:58 +0530, Mir Immad wrote: > I've submitted a proposal for extending the static analyzer to support > posix fd APIs on GSoC website. Here is the Google docs link (gdocs > < > https://docs.google.com/document/d/188zxPUsuYcF-uGVYL_G1s2RVtHhJSZeQ4sha40H7374/edit?usp=sharing >

Re: GSoC proposal for extending static analyzer

2022-04-16 Thread David Malcolm via Gcc
On Fri, 2022-04-15 at 22:36 +0530, Mir Immad wrote: > I've updated the link on the repo -- > https://mirimmad.github.io/zeta-lang. > > > You don't give many specifics in your personal decription.  One thing > > I'm not seeing is a sense of how proficient you are in various > > programming langua

Re: GSoC thoughts on C++ static analyzer support

2022-04-16 Thread David Malcolm via Gcc
On Fri, 2022-04-15 at 22:27 +0300, Φώτης Βαλασιάδης via Gcc wrote: > Hello all, Hi! > > I am interested in said project, and I'd like to ask. > > Is said project limited to providing static analysis for heap > allocations > and file handles?  To be clear I am asking whether or not there are > g

Updates to my GCC Newbies Guide

2022-05-18 Thread David Malcolm via Gcc
The generated HTML for my GCC Newbies Guide is now at: https://gcc-newbies-guide.readthedocs.io/en/latest/ as I seem to be unable to update the dmalcolm.fedorapeople.org subdomain where I used to upload the HTML. Please update any links you see to it to point to the new location. I've also refr

Re: Adding log files to gcc dump and adding testcase-rtl

2022-05-25 Thread David Malcolm via Gcc
On Wed, 2022-05-25 at 10:25 +0530, RICHU NORMAN wrote: > Hi, > I am a beginner in gcc. I am trying to add an instruction to riscv- > gcc.It > would be helpful could help with a few tips . Hi Richu - welcome to GCC development. FWIW I've written a guide for new GCC contributors which you might fin

Re: Adding log files to gcc dump and adding testcase-rtl

2022-05-25 Thread David Malcolm via Gcc
On Wed, 2022-05-25 at 06:44 -0400, David Malcolm wrote: > On Wed, 2022-05-25 at 10:25 +0530, RICHU NORMAN wrote: > > Hi, > > I am a beginner in gcc. I am trying to add an instruction to riscv- > > gcc.It > > would be helpful could help with a few tips . > > Hi Richu - welcome to GCC development. >

Re: Adding log files to gcc dump and adding testcase-rtl

2022-05-25 Thread David Malcolm via Gcc
On Wed, 2022-05-25 at 16:32 +0530, RICHU NORMAN wrote: > This is great, thank you so much! You're welcome. > I am also looking for support regarding adding instructions for the > target > machine. That's something I've not done (my expertise is mostly in the frontends and diagnostics). With tha

Re: GSoC: Getting started

2022-06-01 Thread David Malcolm via Gcc
On Wed, 2022-06-01 at 23:22 +0530, Mir Immad wrote: > HI everyone, > > I'm Immad Mir -- one of the GSoC students this year. I'll be working on > adding static analysis support for POSIX file description APIs this > summer. Welcome Immad - I'm looking forward to helping you on this project. For r

Re: GSoC

2022-06-09 Thread David Malcolm via Gcc
On Thu, 2022-06-09 at 11:04 +0200, Tim Lange wrote: > Hi everyone, > > my name is Tim and I'm also working on the static analyzer this summer. Hi Tim - and welcome to GCC development. > Some of you might already noticed my nooby questions in the IRC ;). > Specifically, I'll be working on extendi

Re: fanalyzer: debugging zero state machine

2022-06-09 Thread David Malcolm via Gcc
On Thu, 2022-06-09 at 16:49 +0200, Tim Lange wrote: > >  > On Mi, Jun 8 2022 at 11:12:52 -0400, David Malcolm > wrote: >  > > On Wed, 2022-06-08 at 01:42 +0200, Tim Lange wrote: >  > > >  > > Hi Dave, Hi Tim; various responses inline below... >  > > >  > > I did spent some time to think about

New "Diving into GCC internals" section in newbies guide

2022-06-10 Thread David Malcolm via Gcc
I've written a large new chunk of documentation for my GCC newbies guide, called "Diving into GCC internals", which can be seen at: https://gcc-newbies-guide.readthedocs.io/en/latest/diving-into-gcc-internals.html Hope this is helpful; please let me know if you see any mistakes, or if there's roo

Re: New "Diving into GCC internals" section in newbies guide

2022-06-12 Thread David Malcolm via Gcc
On Sat, 2022-06-11 at 02:35 +0200, Eric Botcazou wrote: > > Hope this is helpful; please let me know if you see any mistakes, > > or if > > there's room for improvement > > Nice work!  In the "inside cc1" chapter, I think that IR is usually > meant for > "Intermediate Representation" rather than

Re: fanalyzer: debugging zero state machine

2022-06-13 Thread David Malcolm via Gcc
On Sun, 2022-06-12 at 20:27 +0200, Tim Lange wrote: > > > On Do, Jun 9 2022 at 13:40:06 -0400, David Malcolm > wrote: > > On Thu, 2022-06-09 at 16:49 +0200, Tim Lange wrote: > > > > > >   > On Mi, Jun 8 2022 at 11:12:52 -0400, David Malcolm > > >   wrote: > > >   > > On Wed, 2022-06-08 at 01:4

Re: GSoC: Getting started

2022-06-16 Thread David Malcolm via Gcc
On Wed, 2022-06-01 at 14:50 -0400, David Malcolm wrote: > On Wed, 2022-06-01 at 23:22 +0530, Mir Immad wrote: > > HI everyone, > > > > I'm Immad Mir -- one of the GSoC students this year. I'll be working > > on > > adding static analysis support for POSIX file description APIs this > > summer. >

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 > alloca

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 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: [PATCH] static analysis support for posix file desccriptor APIs

2022-06-21 Thread David Malcolm via Gcc
Hi Immad, thanks for this patch. Overall, looks like you're making good progress. Various notes and nitpicks inline below, throughout... On Tue, 2022-06-21 at 22:00 +0530, Mir Immad wrote: [...snip...] > > diff --git a/gcc/analyzer/analyzer.opt b/gcc/analyzer/analyzer.opt > index 23dfc797cea.

Re: [PATCH] static analysis support for posix file desccriptor APIs

2022-06-21 Thread David Malcolm via Gcc
On Tue, 2022-06-21 at 18:50 +, Joseph Myers wrote: > On Tue, 21 Jun 2022, David Malcolm via Gcc wrote: > > > So ultimately that's something we want to fix, though exactly how, > > I'm > > not quite sure; we presumably want to look up the target's >

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-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: [PATCH] analyzer PR 106003

2022-06-23 Thread David Malcolm via Gcc
On Fri, 2022-06-24 at 00:00 +0530, Mir Immad wrote: Thanks for the updated patch. This is close to being ready. One big issue is the target hook idea for isolating the target's definition of the O_* flags as per Joseph's suggestion here: https://gcc.gnu.org/pipermail/gcc/2022-June/238961.html

Re: [PATCH] static analysis support for posix file desccriptor APIs

2022-06-24 Thread David Malcolm via Gcc
On Thu, 2022-06-23 at 23:58 +0530, Mir Immad wrote: >  Hi Dave, > Thanks for the suggestions, > > I changed most of the things that you suggested, however reporting > for > warnings like close of known invalid fd was problematic: > > consider the following code: > > if (fd >= 0) > { write (fd,..

Re: [PATCH] analyzer PR 106003

2022-06-26 Thread David Malcolm via Gcc
Thanks for the updated patch. Various comments inline below. Sorry if this seems nitpicky in places. I think the patch is nearly ready; please write a ChangeLog entry for the next one (none of my proposed changes are going to affect what the ChangeLog will look like, apart from new test case fil

Re: [PATCH] analyzer PR 106003

2022-06-27 Thread David Malcolm via Gcc
Thanks for the updated patch. Various notes below; mostly nits, but I realized there's a logic error in fd_state_machine::on_condition that I hadn't spotted before... [...snip...] > diff --git a/gcc/analyzer/ChangeLog b/gcc/analyzer/ChangeLog > index 53b3ffb487b..d30e94f2f62 100644 > --- a/gcc/a

Re: [PATCH v2] analyzer: add allocation size checker

2022-06-29 Thread David Malcolm via Gcc
On Wed, 2022-06-29 at 17:39 +0200, Tim Lange wrote: > Hi, Thanks for the updated patch. Overall, looks nearly ready; various nits inline below, throughout... > > I've addressed most of the points from the review. > * The allocation size warning warns whenever region_model::get_capacity > retu

Analyzer wiki page moved

2022-06-30 Thread David Malcolm via Gcc
On our wiki I've renamed: https://gcc.gnu.org/wiki/DavidMalcolm/StaticAnalyzer to: https://gcc.gnu.org/wiki/StaticAnalyzer since it's not just me working on the analyzer. I've updated all the internal links within the wiki accordingly; please update any external links you see. Thanks Dave

Re: [PATCH v3] analyzer: add allocation size checker [PR105900]

2022-06-30 Thread David Malcolm via Gcc
On Fri, 2022-07-01 at 00:11 +0200, Tim Lange wrote: > Hi, > > here's the updated patch that should address all the comments from the > v2. > > - Tim > > This patch adds an checker that warns about code paths in which a > buffer is > assigned to a incompatible type, i.e. when the allocated buffer

Re: [PATCH] PR 106003

2022-07-02 Thread David Malcolm via Gcc
On Sat, 2022-07-02 at 19:34 +0530, Mir Immad wrote: > From 62b7b7736975172f03b30783436fbc9217324223 Mon Sep 17 00:00:00 2001 > From: mir > Date: Sat, 2 Jul 2022 15:04:37 +0530 > Subject: [PATCH] analyzer: implement five new warnings for misuse of > POSIX >  file descriptor APIs [PR106003]. > > Th

Re: [PATCH] PR 106003

2022-07-03 Thread David Malcolm via Gcc
On Sun, 2022-07-03 at 14:36 +0530, Mir Immad wrote: > Thank you. > I've committed the patch, and it is covered by the  Developer > Certificate > of Origin (DCO). Excellent - thanks. Congratulations on getting your first patch into GCC! Dave

Re: analyzer: implement five new warnings for misuse of POSIX

2022-07-03 Thread David Malcolm via Gcc
On Sun, 2022-07-03 at 02:46 +, Jay K wrote: >  > check for double "close" of a FD (CWE-1341). >  > check for read/write of a closed file descriptor >   >  These sound good but kinda non general or incomplete to me. >  I mean, isn't the "right" thing, to disallow passing >  a closed fd to "al

Re: jit and cross-compilers (use and configuration).

2022-07-06 Thread David Malcolm via Gcc
On Sun, 2022-06-26 at 14:06 +0100, Iain Sandoe wrote: > Hi Dave, folks, > > It seems to me that it is plausible that one could use the JIT in a > heterogenous system, e.g. an x86_64-linux-host with some kind of co- > processor which is supported as a GCC target (and therefore can be > loaded with

[RFC] Using std::unique_ptr and std::make_unique in our code

2022-07-08 Thread David Malcolm via Gcc
std::unique_ptr is C++11, and I'd like to use it in the gcc/analyzer subdirectory, at least. The following patch eliminates a bunch of "takes ownership" comments and manual "delete" invocations in favor of simply using std::unique_ptr. The problem is that the patch makes use of std::make_unique,

Re: [RFC] Using std::unique_ptr and std::make_unique in our code

2022-07-11 Thread David Malcolm via Gcc
On Mon, 2022-07-11 at 11:56 +0100, Pedro Alves wrote: > Hi! > > On 2022-07-08 9:46 p.m., David Malcolm via Gcc wrote: > > -   pending_diagnostic *d, > > +   > > std::unique_ptr d, > > I see that y

Adding file descriptor attribute(s) to gcc and glibc

2022-07-12 Thread David Malcolm via Gcc
On Tue, 2022-07-12 at 23:03 +0530, Mir Immad wrote: [cross-posting to the glibc development mailing list; updating subject accordingly] > Hi everyone, Hi Immad, GCC developers, and glibc developers. glibc developers: Immad is a GSoC student, he's been adding checks for file-descriptor-based API

Re: Adding file descriptor attribute(s) to gcc and glibc

2022-07-12 Thread David Malcolm via Gcc
On Tue, 2022-07-12 at 18:16 -0400, David Malcolm wrote: > On Tue, 2022-07-12 at 23:03 +0530, Mir Immad wrote: > > [cross-posting to the glibc development mailing list; updating subject > accordingly] > > > Hi everyone, > > Hi Immad, GCC developers, and glibc developers. > > glibc developers: Im

Re: Adding file descriptor attribute(s) to gcc and glibc

2022-07-13 Thread David Malcolm via Gcc
On Wed, 2022-07-13 at 09:37 +0100, Szabolcs Nagy wrote: > The 07/12/2022 18:25, David Malcolm via Libc-alpha wrote: > > On Tue, 2022-07-12 at 18:16 -0400, David Malcolm wrote: > > > On Tue, 2022-07-12 at 23:03 +0530, Mir Immad wrote: > > > GCC's attribute syntax here: > > >   https://gcc.gnu.org/on

Re: Adding file descriptor attribute(s) to gcc and glibc

2022-07-13 Thread David Malcolm via Gcc
On Wed, 2022-07-13 at 14:05 +0200, Florian Weimer wrote: > * Szabolcs Nagy via Gcc: [adding Immad back to the CC list] > > > to be honest, i'd expect interesting fd bugs to be > > dynamic and not easy to statically analyze. > > the use-after-unchecked-open maybe useful. i would > > not expect th

Re: Adding file descriptor attribute(s) to gcc and glibc

2022-07-13 Thread David Malcolm via Gcc
On Wed, 2022-07-13 at 16:01 +0200, Florian Weimer wrote: > * David Malcolm: > > > On Wed, 2022-07-13 at 14:05 +0200, Florian Weimer wrote: > > > * Szabolcs Nagy via Gcc: > > > > [adding Immad back to the CC list] > > > > > > > > > to be honest, i'd expect interesting fd bugs to be > > > > dynam

Re: Adding file descriptor attribute(s) to gcc and glibc

2022-07-13 Thread David Malcolm via Gcc
On Wed, 2022-07-13 at 22:26 +0530, Mir Immad wrote: > Hi everyone, > > Reading through the thread, I feel the following attributes look good > and > similar to what I've done: > > __attribute__ ((fd_arg(N))) > __attribute__ ((fd_arg_read(N))) > __attribute__ ((fd_arg_write(N))) > > I believe how

Re: Adding file descriptor attribute(s) to gcc and glibc

2022-07-14 Thread David Malcolm via Gcc
On Thu, 2022-07-14 at 09:30 +0100, Szabolcs Nagy wrote: > The 07/13/2022 12:55, David Malcolm wrote: > > On Wed, 2022-07-13 at 16:01 +0200, Florian Weimer wrote: > > > * David Malcolm: > > GCC trunk's -fanalyzer implements the new warnings via a state > > machine > > for file-descriptor values; it

Re: [PATCH] analyzer PR 106003

2022-07-14 Thread David Malcolm via Gcc
On Thu, 2022-06-23 at 19:20 -0400, David Malcolm wrote: > On Fri, 2022-06-24 at 00:00 +0530, Mir Immad wrote: [...snip...] > > + > > +enum access_mode > > +fd_state_machine::get_access_mode_from_flag (int flag) const > > +{ > > +  /* FIXME: this code assumes the access modes on the host and > > +

Re: rust non-free-compatible trademark

2022-07-18 Thread David Malcolm via Gcc
On Mon, 2022-07-18 at 20:35 +0100, lkcl via Gcc wrote: > (apologies top-posting, strange mobile mailer). i would expect in that > case that the Rust Foundation to work closely with Certification Mark > Licensees, and to come to an accommodation, defining a subset if > necessary. > > if the gcc dev

Setting up editors for the GNU/GCC coding style?

2022-07-28 Thread David Malcolm via Gcc
Is there documentation on setting up text editors to work with our coding style? A lot of the next generation of developers aren't using vi or emacs; they's using VS Code, CLion, and other editors. Does anyone have docs on e.g. how to set up VS Code, CLion, etc (IntelliJ ?) to work well on GCC's

Re: Rust front-end

2022-10-04 Thread David Malcolm via Gcc
On Tue, 2022-10-04 at 13:29 +0100, Philip Herron wrote: > Hi everyone, > > As the cut-off for merging is coming up in November, quite a few of > our patches have not been reviewed yet. > > There are a few main issues that have been raised so far, and we are > fixing those at the moment in prepara

Re: [PATCH RESEND 0/1] RFC: P1689R5 support

2022-10-13 Thread David Malcolm via Gcc
On Mon, 2022-10-10 at 16:21 -0400, Jason Merrill wrote: > On 10/4/22 11:11, Ben Boeckel wrote: > > This patch adds initial support for ISO C++'s [P1689R5][], a format > > for > > describing C++ module requirements and provisions based on the > > source > > code. This is required because compiling C

Re: [PATCH v2 1/3] libcpp: reject codepoints above 0x10FFFF

2022-10-28 Thread David Malcolm via Gcc
On Thu, 2022-10-27 at 19:16 -0400, Ben Boeckel wrote: > Unicode does not support such values because they are unrepresentable > in > UTF-16. Wikipedia pointed me to RFC 3629, which was when UTF-8 introduced this restriction, whereas libcpp was implementing the higher upper limit from the earlier,

Re: [PATCH v2 2/3] libcpp: add a function to determine UTF-8 validity of a C string

2022-10-28 Thread David Malcolm via Gcc
On Thu, 2022-10-27 at 19:16 -0400, Ben Boeckel wrote: > This simplifies the interface for other UTF-8 validity detections > when a > simple "yes" or "no" answer is sufficient. > > Signed-off-by: Ben Boeckel > --- >  libcpp/ChangeLog  |  6 ++ >  libcpp/charset.cc | 18 ++ >  lib

Re: Announcement: Porting the Docs to Sphinx - 9. November 2022

2022-11-11 Thread David Malcolm via Gcc
On Mon, 2022-10-17 at 15:28 +0200, Martin Liška wrote: > Hello. > > Based on the very positive feedback I was given at the Cauldron > Sphinx Documentation BoF, > I'm planning migrating the documentation on 9th November. There are > still some minor comments > from Sandra when it comes to the PDF o

Re: why does gcc jit require pthread?

2022-11-15 Thread David Malcolm via Gcc
[Fixing typo in the Subject ("git" -> "jit" ); CCing jit mailing list] On Fri, 2022-11-11 at 17:16 +, Jonathan Wakely wrote: > On Mon, 7 Nov 2022 at 13:51, Jonathan Wakely wrote: > > > > On Mon, 7 Nov 2022 at 13:33, LIU Hao wrote: > > > > > > 在 2022-11-07 20:57, Jonathan Wakely 写道: > > > > I

Re: -fanalyzer: Questions on C vs CPP + use of GCC attr's like malloc()/access()

2022-11-25 Thread David Malcolm via Gcc
On Wed, 2022-11-23 at 20:49 -0500, Gavin Ray via Gcc wrote: > Hey all, just a few questions about the fantastic GCC Static > Analyzer: Hi! > > - It's stated that support for C++ vs C is very limited. Does this > apply if >   you're writing C++ that is very similar-looking to C and uses few > of

Re: -fanalyzer: Questions on C vs CPP + use of GCC attr's like malloc()/access()

2022-11-26 Thread David Malcolm via Gcc
On Sat, 2022-11-26 at 17:47 +, Jonathan Wakely wrote: > On Sat, 26 Nov 2022, 15:48 Gavin Ray, wrote: > > > I was using if (fd != -1) and was still getting the warning which > > confused > > me > > My suggestion was maybe to add the exact condition the fd analyzer > > is > > looking for to the

Re: Code generation: How to define file-scope static variables?

2022-11-28 Thread David Malcolm via Gcc
On Mon, 2022-11-28 at 15:28 -0600, Robert Dubner wrote: > I am part of a team working on a COBOL front end for GCC. > > By reverse engineering other front ends, I learned, some months ago, > how > to create a function_decl GENERIC node that is the root of a GENERIC > tree > describing an entire fu

Re: [BUG] missing warning for pointer arithmetic out of bounds

2022-12-13 Thread David Malcolm via Gcc
On Tue, 2022-12-13 at 20:15 +0100, Alejandro Colomar via Gcc wrote: > > > On 12/13/22 20:08, Alejandro Colomar wrote: > > Hi! > > > > For the following program: > > > > > > $ cat buf.c > > #include > > > > int main(void) > > { > > char *p, buf[5]; > > > >   

Re: GSoC: Interest in taking the `-ftime-trace` project

2023-02-09 Thread David Malcolm via Gcc
On Wed, 2023-02-08 at 10:57 +0200, Kristiyan Stoimenov via Gcc wrote: > Hello, > > I would like to ask whether I could be part of the upcoming GSoC. I > have > been wanting to contribute to the project for some time now and I > think > that this would be a nice opportunity for that. > > I have lo

Re: Missed warning (-Wuse-after-free)

2023-02-16 Thread David Malcolm via Gcc
On Thu, 2023-02-16 at 15:35 +0100, Alejandro Colomar via Gcc wrote: > Hi! > > I was preparing an example program of a use-after-realloc bug, > when I found that GCC doesn't warn in a case where it should. > > > alx@debian:~/tmp$ cat realloc.c > #include > #include > #include > #include > #in

Re: Missed warning (-Wuse-after-free)

2023-02-17 Thread David Malcolm via Gcc
On Thu, 2023-02-16 at 22:48 -0500, Siddhesh Poyarekar wrote: > On 2023-02-16 10:15, David Malcolm via Gcc wrote: > > I'm not convinced that it's useful to the end-user to warn about > > the > > "use of q itself" case. > > FWIW, -Wuse-after-free

Re: [GSoC][Static Analyzer] Some questions and request for a small patch to work on

2023-02-21 Thread David Malcolm via Gcc
On Tue, 2023-02-21 at 22:26 +0100, Shengyu Huang via Gcc wrote: > Dear all, Hi Shengyu, and welcome. > > I want to work on the Static Analyzer project and just started to > read the documentation these days,  Excellent! I'm the author/maintainer of the analyzer, so I would mentor any such GSoC

Re: [GSoC][Static Analyzer] Some questions and request for a small patch to work on

2023-02-22 Thread David Malcolm via Gcc
On Wed, 2023-02-22 at 15:11 +0100, Shengyu Huang wrote: > Hi Dave, > > > > But a better place to look would probably be in our bugzilla; see > > the > > links on the wiki page: > >  https://gcc.gnu.org/wiki/StaticAnalyzer  > > The "open bugs" list currently has 41 "RFE" bugs ("request for > > enh

Re: [GSoC][Static Analyzer] Some questions and request for a small patch to work on

2023-02-28 Thread David Malcolm via Gcc
On Tue, 2023-02-28 at 10:18 +0100, Shengyu Huang wrote: > Hi Dave, > > Do you want me to follow the steps 7-10 > (https://gcc-newbies-guide.readthedocs.io/en/latest/how-to-improve-th > e-location-of-a-diagnostic.html) or tell you where I add the code > simply? Basically, I added > > warning_at (D

Re: [GSoC][Static Analyzer] Ideas for proposal

2023-02-28 Thread David Malcolm via Gcc
On Tue, 2023-02-28 at 15:46 +0100, Shengyu Huang wrote: > Hi Dave, > > > On 22 Feb 2023, at 15:11, Shengyu Huang > > wrote: > > > > > But a better place to look would probably be in our bugzilla; see > > > the > > > links on the wiki page: > > >  https://gcc.gnu.org/wiki/StaticAnalyzer  > > > Th

Re: [GSoC][Static Analyzer] Some questions and request for a small patch to work on

2023-03-01 Thread David Malcolm via Gcc
On Wed, 2023-03-01 at 12:16 +0100, Shengyu Huang wrote: > Hi Dave, > > > On 1 Mar 2023, at 00:59, David Malcolm wrote: > > > > Did you get it to output your messages? > > > > > Yes, I chose to emit the warning before the supergraph or exploded > graph is created (I guess this is enough, right

Re: [GSOC] Looking for small patch/project to work on

2023-03-06 Thread David Malcolm via Gcc
On Sat, 2023-03-04 at 08:11 +0530, Rishi Raj via Gcc wrote: > Hi everyone, Hi, and welcome! > > My name is Rishi Raj, and I am a third-year undergraduate studying > Computer > Science and Engineering at the Indian Institute of Technology > Kharagpur in > India. I wish to participate in this year

Re: Request for participation in GSoC

2023-03-06 Thread David Malcolm via Gcc
On Sat, 2023-03-04 at 20:56 +0530, Priyabrata Mondal via Gcc wrote: >   Respected sir, >    I am Priyabrata Mondal, an M.tech student in Electric > Transportation at the Indian Institute of Technology(IIT), Mandi. I > want to > participate in Google Summer of Code 2023 by contributing to th

Re: [GSoC] Introduction and query on LTO object emmission project

2023-03-06 Thread David Malcolm via Gcc
On Fri, 2023-03-03 at 19:28 +0100, Jan Hubicka via Gcc wrote: > Hello, > > Hi! I've been interested in compiler development for a while, and > > would love to > > work with any of you as part of GSoC, or even just as a side- > > project on my own. > > > > I'm an 18 year-old student going into univ

Re: [GSoC][Static Analyzer] Ideas for proposal

2023-03-13 Thread David Malcolm via Gcc
On Sun, 2023-03-12 at 23:20 +0100, Shengyu Huang wrote: > Hi Dave, > > > > > > > 4. What’s the most interesting to me are PR103533 > > > (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103533), > > > > Turning on taint detection by default would be a great project.  It > > would be good to run the

Re: Static Analyzer: correlate state for different region/svalue for reporting

2023-03-15 Thread David Malcolm via Gcc
On Wed, 2023-03-15 at 16:24 +0100, Pierrick Philippe wrote: > Hi everyone, Hi Pierrick > > I have some question regarding the analyzer. > I'm currently working on an fully out-of-tree static analyzer plugin. > I started development on commit tagged as /basepoints/gcc-13/, but > recently moved m

Re: [GSoC] Interest in project ideas and request for a small patch

2023-03-15 Thread David Malcolm via Gcc
On Wed, 2023-03-15 at 17:35 +0100, Benjamin Priour via Gcc wrote: > Hi, > I'm Benjamin and I have been looking around the mail list and the > code base > since last December, where I had to write a simple Deca compiler > within a > month as a team. Next paragraph is me introducing myself -ranting >

Re: Static Analyzer: correlate state for different region/svalue for reporting

2023-03-16 Thread David Malcolm via Gcc
On Thu, 2023-03-16 at 09:54 +0100, Pierrick Philippe wrote: > On 15/03/2023 17:26, David Malcolm wrote: > > On Wed, 2023-03-15 at 16:24 +0100, Pierrick Philippe wrote: [...snip...] > > > > > > An ana::svalue is a pattern of bits (possibly symbolic, such as > > "the > > constant 42" or "the init

Re: [GSOC] getting "gdb: unrecognized option '-dumpdir'' while trying to debug gcc using gdb

2023-03-20 Thread David Malcolm via Gcc
On Mon, 2023-03-20 at 22:36 +0530, Rishi Raj wrote: > I am sorry for the previous messed-up reply :(. I was trying to reply > back > to my previous mail thread but mistakenly replied to the entire > digest::((. > Thanks, David and Martin, for the heads up, and I am sorry for the > late > reply due

Re: [GSoC][Static Analyzer] First proposal draft and a few more questions/requests

2023-03-20 Thread David Malcolm via Gcc
On Mon, 2023-03-20 at 18:28 +0100, Shengyu Huang wrote: > Hi Dave, > > Thanks for always getting back to me so promptly! I am drafting the > proposal today. Here is the link: > > https://docs.google.com/document/d/1MRI1R5DaX8kM6DaqRQsEri5Mx2FvHmWv13qe1W0Bj0g/ > > (The proposal was first written

Re: [Static Analyzer] Loop handling - False positive for malloc-sm

2023-03-20 Thread David Malcolm via Gcc
On Mon, 2023-03-20 at 13:28 +0100, Pierrick Philippe wrote: > Hi everyone, > > I'm still playing around with the analyzer, and wanted to have a look > at > loop handling. > I'm using a build from /trunk/ branch (/20230309/). > > Here is my analyzed code: > > ''' > 1| #include > 2| int main(voi

Re: [Static Analyzer] Loop handling - False positive for malloc-sm

2023-03-22 Thread David Malcolm via Gcc
On Tue, 2023-03-21 at 09:21 +0100, Pierrick Philippe wrote: > On 21/03/2023 00:30, David Malcolm wrote: > > On Mon, 2023-03-20 at 13:28 +0100, Pierrick Philippe wrote: > > > Hi everyone, > > > > > > I'm still playing around with the analyzer, and wanted to have a > > > look > > > at > > > loop han

Re: [Static Analyzer] Loop handling - False positive for malloc-sm

2023-03-22 Thread David Malcolm via Gcc
On Tue, 2023-03-21 at 11:01 +0100, Shengyu Huang wrote: > Hi Dave, > > > I implemented my own approach, with a "widening_svalue" subclass of > > symbolic value.  This is widening in the Abstract Interpretation > > sense, > > (as opposed to the bitwise operations sense): if I see multiple > > value

Re: [GSoC] Interest and initial proposal for project on reimplementing cpychecker as -fanalyzer plugin

2023-03-26 Thread David Malcolm via Gcc
On Sat, 2023-03-25 at 15:38 -0400, Eric Feng via Gcc wrote: > Hi GCC community, > > For GSoC, I am extremely interested in working on the selected > project > idea with respect to extending the static analysis pass. In > particular, porting gcc-python-plugin's cpychecker to a plugin for > GCC > -f

Re: [GSoC][Static Analyzer] First proposal draft and a few more questions/requests

2023-03-26 Thread David Malcolm via Gcc
On Sun, 2023-03-26 at 18:03 +0200, Shengyu Huang wrote: > Hi Dave, > > (I forgot to cc the list in the last email and it was too late to > unsend. Sorry for sending you the same email again.) > > > On 20 Mar 2023, at 23:50, David Malcolm > > mailto:dmalc...@redhat.com>> wrote: > > > > I think if

Re: [GSoC] Interest and initial proposal for project on reimplementing cpychecker as -fanalyzer plugin

2023-03-28 Thread David Malcolm via Gcc
On Tue, 2023-03-28 at 08:08 -0400, Eric Feng wrote: > My apologies. Forgot to CC the mailing list in my previous e-mail. > Original reply below: > > ___ > > > Hi David, > > Thank you for your feedback! > > > [...snip...] > > > > > > Error-handling checking: Various checks for common er

Re: -Wanalyzer-malloc-leak false positives

2023-03-29 Thread David Malcolm via Gcc
On Wed, 2023-03-29 at 15:20 +0200, Alejandro Colomar via Gcc wrote: > Hi! > > With both GCC 12.2.0 (Debian), and GCC 13.0.1 20230315 (built from > source), > I can reproduce these false positives. > > The reproducer program is a small program that checks a password > against a > hardcoded string,

Re: [GSoC] A bunch of questions about sm-malloc behavior, and proposition of a GSoC subject.

2023-03-29 Thread David Malcolm via Gcc
On Thu, 2023-03-30 at 00:50 +0200, Benjamin Priour wrote: > Hi David, > > I've been playing around with sm-malloc on C++ samples. Note that the analyzer doesn't properly work yet on C++; see: https://gcc.gnu.org/bugzilla/showdependencytree.cgi?id=97110 I'm hoping to address much of this in GCC

Re: [GSoC][analyzer-c++] Enable enough C++ support for self-analysis

2023-04-02 Thread David Malcolm via Gcc
On Sat, 2023-04-01 at 01:33 +0200, Benjamin Priour wrote: > Hi David, > > > On Thu, Mar 30, 2023 at 2:04 AM David Malcolm > wrote: > > I think working on the C++ enablement prerequisites in the analyzer > > would make more sense.  I'd planned to do this myself for GCC 14, > > but > > there are p

<    1   2   3   >