[Bug analyzer/94999] internal compiler error: in saved_diagnostic

dmalcolm at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri May 8 13:14:46 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94999

David Malcolm <dmalcolm at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|UNCONFIRMED                 |RESOLVED
             Blocks|                            |95006

--- Comment #1 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Thanks for filing this.

I'm able to reproduce this with the revision in question
(f883c46b4877f637e0fa5025b4d6b5c9040ec566), but it's fixed in GCC 10.1

It's an assertion failure here:

#1  0x000000000242ee44 in ana::saved_diagnostic::saved_diagnostic
(this=0x3c6ca60, sm=0x0, enode=0x3ce0b20, 
    snode=0x332a110, stmt=0x0, stmt_finder=0x0, var=<tree 0x0>, state=0,
d=0x3cff4e0)
    at ../../src/gcc/analyzer/diagnostic-manager.cc:84
84        gcc_assert (m_stmt || m_stmt_finder);

when handling a false positive from -Wanalyzer-use-of-uninitialized-value,
which I removed in r10-8012-g78b9783774bfd3540f38f5b1e3c7fc9f719653d7.

The diagnostic is generated when analyzing the return from mk_entry to
memory_ensure_mapped_range on this code:

static struct entry
mk_entry(uint64_t start, uint64_t end)
{
    return (struct entry) {safe_calloc(end - start, 1), start, end};
}

I think -fanalyzer is failing to handle a CONSTRUCTOR tree code (on those
{...}), and thus is erroneously treating the return value as uninitialized,
when the code looks correct to me.

The failure to handle CONSTRUCTOR tree codes is PR analyzer/94447, so I'm going
to close this out as a duplicate of that bug; clearly it needs to be fixed in
order to reimplement -Wanalyzer-use-of-uninitialized-value; adding to the
analyzer-uninit tracker bug.

*** This bug has been marked as a duplicate of bug 94447 ***


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95006
[Bug 95006] Reimplement -Wanalyzer-use-of-uninitialized-value


More information about the Gcc-bugs mailing list