public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "dmalcolm at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug analyzer/104434] Analyzer doesn't know about "pure" and "const" functions Date: Mon, 07 Feb 2022 22:45:03 +0000 [thread overview] Message-ID: <bug-104434-4-7EGRzx9qbY@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-104434-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104434 --- Comment #1 from David Malcolm <dmalcolm at gcc dot gnu.org> --- Seen on https://github.com/xianyi/OpenBLAS/blob/c5f280a7f0e875d83833d895b2b8b0e341efabf4/lapack-netlib/LAPACKE/src/lapacke_cgbbrd_work.c where the code has: if( LAPACKE_lsame( vect, 'b' ) || LAPACKE_lsame( vect, 'p' ) ) { pt_t = (lapack_complex_float*) LAPACKE_malloc( sizeof(lapack_complex_float) * ldpt_t * MAX(1,n) ); ...snip... } [...snip lots of code...] if( LAPACKE_lsame( vect, 'b' ) || LAPACKE_lsame( vect, 'p' ) ) { LAPACKE_free( pt_t ); } where the analyzer considers the execution path where the conditions guarding the malloc and the free are first true, and then false. LAPACKE_lsame is a case-insensitive comparison, implemented in its own source file. I think if it were marked as "pure", the analyzer could fix this without needing LTO.
next prev parent reply other threads:[~2022-02-07 22:45 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-02-07 22:43 [Bug analyzer/104434] New: " dmalcolm at gcc dot gnu.org 2022-02-07 22:45 ` dmalcolm at gcc dot gnu.org [this message] 2022-02-23 14:06 ` [Bug analyzer/104434] " dmalcolm at gcc dot gnu.org 2022-02-23 21:06 ` dmalcolm at gcc dot gnu.org 2022-02-23 23:52 ` cvs-commit at gcc dot gnu.org 2022-02-23 23:59 ` dmalcolm at gcc dot gnu.org 2022-02-28 14:44 ` dmalcolm at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-104434-4-7EGRzx9qbY@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).