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

            Bug ID: 119786
           Summary: UBSAN error in reorg.cc's note_delay_statistics index
                    2 out of bounds for type 'int [2]'
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sjames at gcc dot gnu.org
  Target Milestone: ---

With bootstrap-ubsan on sparc64-unknown-linux-gnu (trunk):
```
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior
/root/gcc/gcc/reorg.cc:632:52
/root/gcc/gcc/reorg.cc:635:59: runtime error: index 2 out of bounds for type
'int [2]'
    #0 0x000003b04fb4 in note_delay_statistics /root/gcc/gcc/reorg.cc:635
    #1 0x000003b486e4 in fill_simple_delay_slots /root/gcc/gcc/reorg.cc:2190
    #2 0x000003b58824 in make_return_insns /root/gcc/gcc/reorg.cc:3615
    #3 0x000003b58824 in dbr_schedule /root/gcc/gcc/reorg.cc:3715
    #4 0x000003b58824 in rest_of_handle_delay_slots /root/gcc/gcc/reorg.cc:3839
    #5 0x000003b58824 in execute /root/gcc/gcc/reorg.cc:3868
    #6 0x00000361e3e8 in execute_one_pass(opt_pass*)
/root/gcc/gcc/passes.cc:2659
    #7 0x00000362132c in execute_pass_list_1 /root/gcc/gcc/passes.cc:2768
    #8 0x000003621370 in execute_pass_list_1 /root/gcc/gcc/passes.cc:2769
    #9 0x000003621370 in execute_pass_list_1 /root/gcc/gcc/passes.cc:2769
    #10 0x0000036214b8 in execute_pass_list(function*, opt_pass*)
/root/gcc/gcc/passes.cc:2779
    #11 0x000001d8b2d0 in cgraph_node::expand()
/root/gcc/gcc/cgraphunit.cc:1859
    #12 0x000001d8b2d0 in cgraph_node::expand()
/root/gcc/gcc/cgraphunit.cc:1812
    #13 0x000001da917c in expand_all_functions /root/gcc/gcc/cgraphunit.cc:2042
    #14 0x000001da917c in symbol_table::compile()
/root/gcc/gcc/cgraphunit.cc:2418
    #15 0x000001da917c in symbol_table::compile()
/root/gcc/gcc/cgraphunit.cc:2327
    #16 0x000001dab90c in symbol_table::finalize_compilation_unit()
/root/gcc/gcc/cgraphunit.cc:2607
    #17 0x000004021de4 in compile_file /root/gcc/gcc/toplev.cc:479
    #18 0x0000004319c8 in do_compile /root/gcc/gcc/toplev.cc:2208
    #19 0x0000004319c8 in toplev::main(int, char**)
/root/gcc/gcc/toplev.cc:2371
    #20 0x000000436300 in main /root/gcc/gcc/main.cc:39
    #21 0xfff800010152c660  (/usr/lib64/libc.so.6+0x2c660)
    #22 0xfff800010152c768 in __libc_start_main (/usr/lib64/libc.so.6+0x2c768)
    #23 0x0000004367d0 in _start (/tmp/build/gcc/cc1plus+0x4367d0
```

```
~/gcc/configure --enable-host-shared --enable-languages=c,c++,jit
--disable-multilib --host=sparc64-unknown-linux-gnu
--build=sparc64-unknown-linux-gnu --enable-checking=yes,extra,rtl
--with-buildfg-config="bootstrap-ubsan"
```

Reply via email to