Bug 102020 - [12 regression] analyzer/malloc-callbacks.c fails since r12-3052
Summary: [12 regression] analyzer/malloc-callbacks.c fails since r12-3052
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: analyzer (show other bugs)
Version: 12.0
: P3 normal
Target Milestone: 12.0
Assignee: David Malcolm
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-08-23 08:43 UTC by Christophe Lyon
Modified: 2021-08-23 12:09 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2021-08-23 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christophe Lyon 2021-08-23 08:43:03 UTC
Since r12-3052 (g:e92d0ff6b5e6d4b95c04fc3e326d40efeb136086), there is a new failure:
FAIL: gcc.dg/analyzer/malloc-callbacks.c (test for excess errors)
Excess errors:
/gcc/testsuite/gcc.dg/analyzer/malloc-callbacks.c:72:3: warning: double-'free' of 'ptr' [CWE-415] [-Wanalyzer-double-free]


Seen on arm and aarch64
Comment 1 Martin Liška 2021-08-23 08:50:11 UTC
I'm pretty sure it's caused by a typo in the code:

build/gcc/analyzer/diagnostic-manager.cc:2108:21: warning: variable 'caller_var' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] 

+                else
+                  callee_var = callee_model->get_representative_tree (sval);

This should be likely 'caller_var'.
Comment 2 GCC Commits 2021-08-23 11:50:17 UTC
The master branch has been updated by Ankur saini <arsenic@gcc.gnu.org>:

https://gcc.gnu.org/g:537878152ded8b7d271333b803b36c27a9aea8d2

commit r12-3076-g537878152ded8b7d271333b803b36c27a9aea8d2
Author: Ankur Saini <arsenic@sourceware.org>
Date:   Mon Aug 23 17:03:29 2021 +0530

    analyzer: Fix PR analyzer/102020
    
    2021-08-23  Ankur Saini  <arsenic@sourceware.org>
    
    gcc/analyzer/ChangeLog:
            PR analyzer/102020
            * diagnostic-manager.cc
            (diagnostic_manager::prune_for_sm_diagnostic)<case EK_CALL_EDGE>: Fix typo.
    
    gcc/testsuite/ChangeLog:
            PR analyzer/102020
            * gcc.dg/analyzer/malloc-callbacks.c : Fix faulty test.
Comment 3 Martin Liška 2021-08-23 12:09:32 UTC
Fixed now.