Bug 98378 - new valgrind error for ./gcc.c-torture/execute/pr60960.c
Summary: new valgrind error for ./gcc.c-torture/execute/pr60960.c
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 11.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-12-18 17:26 UTC by David Binderman
Modified: 2020-12-19 13:19 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Binderman 2020-12-18 17:26:51 UTC
Last week's valgrind build of trunk gcc, hash 97b56dece7413839,
compiled ./gcc.c-torture/execute/pr60960.c fine.

This week's valgrind build of trunk gcc, hash dc00689332f023d9
doesn't. This is what it does:

==471616== Conditional jump or move depends on uninitialised value(s)
==471616==    at 0x15CF3B5: (anonymous namespace)::find_bswap_or_nop_finalize((anonymous namespace)::symbolic_number*, unsigned long*, unsigned long*) (gimple-ssa-store-merging.c:807)

Source code gimple-ssa-store-merging.c:807 is

  if (n->base_addr)

Flag -O2 used on source code file gcc.c-torture/execute/pr60960.c
Comment 1 David Binderman 2020-12-18 17:35:52 UTC
git bisect in progress. Trying hash f23753c710d54fdf.
Comment 2 David Binderman 2020-12-18 17:58:27 UTC
Looks good. Trying 0dd48296433763ba
Comment 3 David Binderman 2020-12-18 18:28:56 UTC
Looks bad. Trying 571d3fb1f40fa85c
Comment 4 David Binderman 2020-12-18 18:51:53 UTC
Looks bad. Trying 5137d1ae6a1fe4a3
Comment 5 David Binderman 2020-12-18 19:04:18 UTC
I am struggling to make further progress with this one.

Commit cd676dfa57e643a4f7d8445e6ebad0f21cf3fd84 looks suspicious,
since it is the only one that changes anything in compiler source code
file gimple-ssa-store-merging.c in the good .. bad range.

Jakub, your best advice sought, please.
Comment 6 David Binderman 2020-12-18 19:09:25 UTC
Testsuite file ./gcc.c-torture/execute/simd-6.c, with flag -O2,
has similar problems with a valgrind version of gcc trunk.
Comment 7 GCC Commits 2020-12-19 11:48:20 UTC
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:9032d2b2414ed22e53a9980a51b835d3caf83c48

commit r11-6269-g9032d2b2414ed22e53a9980a51b835d3caf83c48
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Sat Dec 19 12:46:40 2020 +0100

    bswap: Fix up a thinko with empty CONSTRUCTORs [PR98378]
    
    The code I've added recently in find_bswap_or_nop for VECTOR CONSTRUCTORs
    is missing punt on an important case - namely empty CONSTRUCTORs, because in that
    case the loop will not initialize *n and the code after the loop will then
    use the uninitialized structure.
    
    2020-12-19  Jakub Jelinek  <jakub@redhat.com>
    
            PR tree-optimization/98378
            * gimple-ssa-store-merging.c (find_bswap_or_nop): Punt if CONSTRUCTOR
            has no elements.
Comment 8 David Binderman 2020-12-19 12:47:38 UTC
I can provide, if requested, a list of other testsuite files
that fail in the same way.

This might be a good sanity check for Jakub's fix.

Otherwise, I suggest that this bug could be marked as fixed.
Comment 9 Jakub Jelinek 2020-12-19 13:19:00 UTC
.