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

            Bug ID: 82576
           Summary: sbitmap_vector_alloc() not ready for 64 bits
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: babokin at gmail dot com
  Target Milestone: ---

Created attachment 42382
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42382&action=edit
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

Reply via email to