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

            Bug ID: 84742
           Summary: internal compiler error: in process_alt_operands, at
                    lra-constraints.c:2112
           Product: gcc
           Version: 8.0.1
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: inline-asm
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vegard.nossum at gmail dot com
  Target Milestone: ---

Created attachment 43580
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43580&action=edit
valgrind output

Input:

void a() {
  char b;
  asm volatile ("" :
"+fm<rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggx<gT,ggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg"
(b));
  {
    try {
    } catch (char ()) {
    }
  }
}

Output:

$ xgcc -x c++ -S -std=c++14 -O3 -fpermissive -fno-toplevel-reorder -
during RTL pass: reload
<stdin>: In function 'void a()':
<stdin>:9:1: internal compiler error: in process_alt_operands, at
lra-constraints.c:2112
0x289cf5b process_alt_operands
        /home/vegard/git/gcc/gcc/lra-constraints.c:2112
0x28a6043 curr_insn_transform
        /home/vegard/git/gcc/gcc/lra-constraints.c:3860
0x28b93b6 lra_constraints(bool)
        /home/vegard/git/gcc/gcc/lra-constraints.c:4877
0x2829984 lra(_IO_FILE*)
        /home/vegard/git/gcc/gcc/lra.c:2419
0x2608794 do_reload
        /home/vegard/git/gcc/gcc/ira.c:5465
0x2608794 execute
        /home/vegard/git/gcc/gcc/ira.c:5649

$ xgcc --version
xgcc (GCC) 8.0.1 20180306 (experimental)

Built from git 11a93d7a09b871b3b9a2eb108eb91ad83d94e070 (r258271).

This one is a bit of a weird one. It doesn't reproduce with "trunk" on
godbolt.org for me and the crash itself is indeterministic. Sometimes the
compiler doesn't print anything and it returns 0, sometimes it hangs after
printing "during RTL pass: reload", and sometimes it gives the splat above
(about 1 in every 10 runs, I'd say). I recommend running it in a loop to
increase the chances of reproducing.

Valgrind shows a bunch of errors, this is the first one:

==31845== Conditional jump or move depends on uninitialised value(s)
==31845==    at 0x2757C74: sparseset_bit_p (sparseset.h:147)
==31845==    by 0x2757C74: mark_pseudo_regno_live(int) (ira-lives.c:289)
==31845==    by 0x2760800: process_bb_node_lives(ira_loop_tree_node*)
(ira-lives.c:1140)
==31845==    by 0x2677F7D: ira_traverse_loop_tree(bool, ira_loop_tree_node*,
void (*)(ira_loop_tree_node*), void (*)(ira_loop_tree_node*))
(ira-build.c:1806)
==31845==    by 0x276BED9: ira_create_allocno_live_ranges() (ira-lives.c:1565)
==31845==    by 0x2687F08: ira_build() (ira-build.c:3429)
==31845==    by 0x2640C54: ira (ira.c:5295)
==31845==    by 0x2640C54: (anonymous namespace)::pass_ira::execute(function*)
(ira.c:5606)
==31845==    by 0x2B7EDA7: execute_one_pass(opt_pass*) (passes.c:2497)
==31845==    by 0x2B84CFB: execute_pass_list_1(opt_pass*) [clone .constprop.89]
(passes.c:2586)
==31845==    by 0x2B85DA0: execute_pass_list_1 (passes.c:2587)
==31845==    by 0x2B85DA0: execute_pass_list(function*, opt_pass*)
(passes.c:2597)
==31845==    by 0x19A118E: cgraph_node::expand() (cgraphunit.c:2139)
==31845==    by 0x19AA5A7: expand_all_functions (cgraphunit.c:2275)
==31845==    by 0x19AA5A7: symbol_table::compile() [clone .part.56]
(cgraphunit.c:2624)
==31845==    by 0x19B84D7: compile (cgraphunit.c:2537)
==31845==    by 0x19B84D7: symbol_table::finalize_compilation_unit()
(cgraphunit.c:2717)

I've attached a full valgrind log as well, in case that helps.

Test case was minimised by C-Reduce.

Reply via email to