Bug 82576 - sbitmap_vector_alloc() not ready for 64 bits
Summary: sbitmap_vector_alloc() not ready for 64 bits
Status: RESOLVED DUPLICATE of bug 97554
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 8.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks: yarpgen
  Show dependency treegraph
 
Reported: 2017-10-17 05:49 UTC by Dmitry Babokin
Modified: 2021-11-01 23:07 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2017-10-17 00:00:00


Attachments
Reproducer (76.04 KB, application/x-xz)
2017-10-17 05:49 UTC, Dmitry Babokin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry Babokin 2017-10-17 05:49:26 UTC
Created attachment 42382 [details]
Reproducer

gcc trunk, rev253744, x86_64.

Trying compile attached test case with UBSAN I get segfault:
during RTL pass: cprop
f.cpp: In function ‘void tf_1_foo()’:
f.cpp:335:3: internal compiler error: Segmentation fault
   }
   ^
0xf4b65f crash_signal
        ../../gcc/gcc/toplev.c:326
0x1684418 sbitmap_vector_alloc(unsigned int, unsigned int)
        ../../gcc/gcc/sbitmap.c:171
0x1562dc3 alloc_cprop_mem
        ../../gcc/gcc/cprop.c:558
0x1562dc3 one_cprop_pass
        ../../gcc/gcc/cprop.c:1818
0x1562dc3 execute_rtl_cprop
        ../../gcc/gcc/cprop.c:1932
0x1562dc3 execute
        ../../gcc/gcc/cprop.c:1970

This is due to sbitmap_vector_alloc() implementation using "unsigned int", instead of size_t. Fixing this make test case compile (even though consuming a lot of memory, about 80Gb).

>g++ -std=c++11 -fsanitize=undefined -fno-sanitize-recover=undefined -w -Werror=uninitialized -O2 -c f.cpp
Comment 1 Martin Liška 2017-10-17 06:48:13 UTC
Confirmed, note that also bitmap.h contains API where we have 'unsigned int'.
I can work on that, do we want to change API of both?
Comment 2 Richard Biener 2017-10-17 09:45:21 UTC
No, I think the public API shouldn't change (we don't want to grow simple_bitmap_def unnecessarily).  Such big sbitmaps do not make sense.
Comment 3 dominik.strasser 2020-12-01 09:38:42 UTC
Still occurs in gcc 10.x
Comment 4 Richard Biener 2020-12-01 10:12:45 UTC
duplicate

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