NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

port-alpha/58505: GCC 12.4.0 on alpha broken at -O2



>Number:         58505
>Category:       port-alpha
>Synopsis:       GCC 12.4.0 on alpha broken at -O2
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-alpha-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jul 28 21:00:00 +0000 2024
>Originator:     Tobias Nygren
>Release:        10.99.11
>Organization:
>Environment:
>Description:
It cross compiles OK, but natively ./build.sh fails
immediately when bootstrapping make.

pc164sx# gcc -c -O2 -o test.o test.c
during GIMPLE pass: thread
print2.c: In function 'func':
print2.c:4:1: internal compiler error: Segmentation fault
    4 | func()

Changing a < 10 to a < 2 in the reproducer hides the problem.
Loop optimizer problem?
>How-To-Repeat:
//---8<---
int aaa(void);
void func() {
        int a, b = 0;
        for (a = 0; a < 10; a++) {
                        if (b  >= 10) {
                                aaa();
                        }
                b += aaa();
        }
}
//---8<---

Starting program: /usr/libexec/cc1 -fpreprocessed test.i -quiet -dumpbase test.c -dumpbase-ext .c -O2 -version -o test.s
...
Program received signal SIGSEGV, Segmentation fault.
0x00000001205d24d8 in ipa_edge_within_scc(cgraph_edge*) ()
(gdb) bt
#0  0x00000001205d24d8 in ipa_edge_within_scc(cgraph_edge*) ()
#1  0x0000000120f19c88 in path_range_query::range_defined_in_block(irange&, tree_node*, basic_block_def*) ()
#2  0x0000000120f1a240 in path_range_query::compute_ranges_in_phis(basic_block_def*) ()
#3  0x0000000120f1a548 in path_range_query::compute_ranges_in_block(basic_block_def*) ()
#4  0x0000000120f1ac08 in path_range_query::compute_ranges(vec<basic_block_def*, va_heap, vl_ptr> const&, bitmap_head const*) ()
#5  0x0000000120ea2b58 in back_threader::find_taken_edge_cond(vec<basic_block_def*, va_heap, vl_ptr> const&, gcond*) ()
#6  0x0000000120ea3a7c in back_threader::maybe_register_path() ()
#7  0x0000000120ea4240 in back_threader::find_paths_to_names(basic_block_def*, bitmap_head*) ()
#8  0x0000000120ea45c8 in back_threader::resolve_phi(gphi*, bitmap_head*) [clone .part.0] ()
#9  0x0000000120ea40d4 in back_threader::find_paths_to_names(basic_block_def*, bitmap_head*) ()
#10 0x0000000120ea4738 in back_threader::find_paths(basic_block_def*, tree_node*) ()
#11 0x0000000120ea4a54 in back_threader::thread_blocks() ()
#12 0x0000000120ea4af4 in (anonymous namespace)::pass_thread_jumps::execute(function*) ()
#13 0x00000001203a4048 in execute_one_pass(opt_pass*) ()
#14 0x00000001203a4c70 in execute_pass_list_1(opt_pass*) ()
#15 0x00000001203a4c8c in execute_pass_list_1(opt_pass*) ()
#16 0x00000001203a4d04 in execute_pass_list(function*, opt_pass*) ()
#17 0x0000000120c8d760 in cgraph_node::expand() ()
#18 0x0000000120c8f654 in symbol_table::compile() [clone .part.0] ()
#19 0x0000000120c92d50 in symbol_table::finalize_compilation_unit() ()
#20 0x00000001202ed338 in compile_file() ()
#21 0x00000001214eef1c in toplev::main(int, char**) ()
#22 0x00000001214ed230 in main ()

>Fix:
Workaround is to compile at -O1 or at -O2 with some of the threading passes disabled (-fdisable-tree-thread2 helps in this particular case).



Home | Main Index | Thread Index | Old Index