]> git.ipfire.org Git - thirdparty/gcc.git/commit
var-tracking: fix uninitialised use of 'in_pending' [PR96404]
authorSergei Trofimovich <siarheit@google.com>
Sun, 2 Aug 2020 11:03:55 +0000 (12:03 +0100)
committerSergei Trofimovich <siarheit@google.com>
Sun, 2 Aug 2020 18:35:47 +0000 (19:35 +0100)
commit6e46b3f3da5c03bc529b3690dd0995927feb9142
treea55dc90d1d343070ee18bfdf8d991e6e3e1ac7db
parentb3b2bf98fffb0760120285e7d883c082fa3c2187
var-tracking: fix uninitialised use of 'in_pending' [PR96404]

r11-2447-g:1212cfad093 ("Improve var-tracking dataflow
iteration order") changed 'in_pending' initialization
from:

    in_pending = sbitmap_alloc (last_basic_block_for_fn (cfun));
    bitmap_ones (in_pending);

to more complex partial bit population algorithm. Due to presence
of uninitialized bits gcc started injecting extra debug entries
in seemigly arbitrary locations and started failing stage2/stage3
bootstrap comparison.

valgrind detected unilitialized bits as:

  Conditional jump or move depends on uninitialised value(s)
     at 0xDBED3B: vt_find_locations() (var-tracking.c:7230)
     by 0xDBF2FB: variable_tracking_main_1() (var-tracking.c:10519)
     ...
   Uninitialised value was created by a heap allocation
     at 0x483779F: malloc (vg_replace_malloc.c:307)
     by 0x14EE80B: xmalloc (xmalloc.c:147)
     by 0x14911F9: sbitmap_alloc(unsigned int) (sbitmap.c:51)
     ...

The fix explicitly initializes 'in_pending' bitmap with zeros.

2020-08-02  Sergei Trofimovich  <siarheit@google.com>

gcc/

PR bootstrap/96404
* var-tracking.c (vt_find_locations): Fully initialize
all 'in_pending' bits.
gcc/var-tracking.c