https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82045
rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2017-08-31 Assignee|unassigned at gcc dot gnu.org |rsandifo at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #7 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> --- (In reply to r...@cebitec.uni-bielefeld.de from comment #6) > >> --- Comment #4 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot > >> gnu.org> --- > > [...] > >>> Natively, I can easily reproduce the ICE with > >>> > >>> $ cc1 -fpreprocessed libgcc2.i -quiet -mcpu=v9 -o libgcc2.s > >>> > >>> Please note that I'm using a 32-bit compiler; maybe the problem doesn't > >>> occur on a 64-bit host? > >> > >> That's certainly a possibility, although I don't *think* we changed > >> anything in terms of variable sizes. > > > > Just to be sure, I've just built a bi-arch sparcv9-sun-solaris2.11 > > compiler: the 64-bit _multc3.o builds just fine, but the compiler ICEs > > for the 32-bit just as the 32-bit compiler does. > > On top of that, I've tried both x86_64-pc-linux-gnu x > sparc-sun-solaris2.11 and i686-pc-linux-gnu x > sparc-sun-solaris2.11 compilers. Both compile the preprocessed input > just fine. > > I've now run the native cc1 under gdb. This is the full stacktrace: > > #0 fancy_abort (file=file@entry=0x2b86f8 > "/var/gcc/reghunt/trunk/gcc/calls.c", line=line@entry=4563, > function=function@entry=0x2b8fa0 <emit_library_call_value_1(int, rtx_def*, > rtx_def*, libcall_type, machine_mode, int, void*)::__FUNCTION__> > "emit_library_call_value_1") at /var/gcc/reghunt/trunk/gcc/diagnostic.c:1487 > #1 0x005a06dc in emit_library_call_value_1 (retval=retval@entry=0, > orgfun=orgfun@entry=0xfa98e540, value=value@entry=0x0, > fn_type=fn_type@entry=LCT_NORMAL, outmode=outmode@entry=E_SImode, > nargs=nargs@entry=2, p=0xffbfdfc4, p@entry=0xffbfdfbc) at > /var/gcc/reghunt/trunk/gcc/calls.c:4562 > #2 0x005a69ac in emit_library_call (orgfun=orgfun@entry=0xfa98e540, > fn_type=fn_type@entry=LCT_NORMAL, outmode=outmode@entry=E_SImode, > nargs=nargs@entry=2) at /var/gcc/reghunt/trunk/gcc/calls.c:5146 > #3 0x00eac154 in sparc_emit_float_lib_cmp (x=x@entry=0xfa98c948, > y=0xfa98c960, comparison=NE) at > /var/gcc/reghunt/trunk/gcc/config/sparc/sparc.c:8144 > #4 0x00eac3d0 in emit_scc_insn (operands=operands@entry=0xffbfe098) at > /var/gcc/reghunt/trunk/gcc/config/sparc/sparc.c:3170 > #5 0x0104c5d0 in gen_cstoretf4 (operand0=0xfa98c978, operand1=0xfa98e530, > operand2=0xfa98c948, operand3=0xfa98c960) at > /var/gcc/reghunt/trunk/gcc/config/sparc/sparc.md:779 > #6 0x0099b108 in insn_gen_fn::operator() (a3=<optimized out>, a2=<optimized > out>, a1=<optimized out>, a0=<optimized out>, this=0x50a0) at > /var/gcc/reghunt/trunk/gcc/recog.h:303 > #7 maybe_gen_insn (icode=icode@entry=CODE_FOR_cstoretf4, nops=nops@entry=4, > ops=ops@entry=0xffbfe1d8) at /var/gcc/reghunt/trunk/gcc/optabs.c:7046 > #8 0x0099b6ec in maybe_expand_insn (icode=icode@entry=CODE_FOR_cstoretf4, > nops=nops@entry=4, ops=ops@entry=0xffbfe1d8) at > /var/gcc/reghunt/trunk/gcc/optabs.c:7076 > #9 0x006eaea4 in emit_cstore (target=target@entry=0xfa9830e0, > icode=icode@entry=CODE_FOR_cstoretf4, code=code@entry=NE, > mode=mode@entry=E_TFmode, compare_mode=compare_mode@entry=E_TFmode, > unsignedp=unsignedp@entry=0, x=0xfa98c948, x@entry=0xfa98e4d0, y=0xfa98c960, > y@entry=0xfa98e4f0, normalizep=normalizep@entry=1, > target_mode=target_mode@entry=E_QImode) at > /var/gcc/reghunt/trunk/gcc/expmed.c:5325 > #10 0x006eb5f0 in emit_store_flag_1 (target=target@entry=0xfa9830e0, > code=NE, op0=op0@entry=0xfa98e4d0, op1=op1@entry=0xfa98e4f0, > mode=mode@entry=E_TFmode, unsignedp=unsignedp@entry=0, > normalizep=normalizep@entry=1, target_mode=target_mode@entry=E_QImode) at > /var/gcc/reghunt/trunk/gcc/expmed.c:5563 > #11 0x006eb050 in emit_store_flag (target=target@entry=0xfa9830e0, > code=code@entry=NE, op0=op0@entry=0xfa98e4d0, op1=op1@entry=0xfa98e4f0, > mode=mode@entry=E_TFmode, unsignedp=unsignedp@entry=0, normalizep=<optimized > out>, normalizep@entry=1) at /var/gcc/reghunt/trunk/gcc/expmed.c:5823 > #12 0x006ec308 in emit_store_flag_force (target=target@entry=0xfa9830e0, > code=code@entry=NE, op0=0xfa98e4d0, op1=0xfa98e4f0, > mode=mode@entry=E_TFmode, unsignedp=unsignedp@entry=0, normalizep=<optimized > out>, normalizep@entry=1) at /var/gcc/reghunt/trunk/gcc/expmed.c:5956 > #13 0x00713fe0 in do_store_flag (mode=<optimized out>, target=0xfa9830e0, > ops=0xffbfe458) at /var/gcc/reghunt/trunk/gcc/expr.c:11511 > #14 expand_expr_real_2 (ops=ops@entry=0xffbfe500, > target=target@entry=0xfa9830e0, tmode=<optimized out>, > modifier=modifier@entry=EXPAND_NORMAL) at > /var/gcc/reghunt/trunk/gcc/expr.c:9259 > #15 0x005b968c in expand_gimple_stmt_1 (stmt=0xfa89a2a0) at > /var/gcc/reghunt/trunk/gcc/cfgexpand.c:3691 > #16 expand_gimple_stmt (stmt=stmt@entry=0xfa89a2a0) at > /var/gcc/reghunt/trunk/gcc/cfgexpand.c:3751 > #17 0x005bd820 in expand_gimple_basic_block (bb=0xfa9780c0, > disable_tail_calls=disable_tail_calls@entry=false) at > /var/gcc/reghunt/trunk/gcc/cfgexpand.c:5753 > #18 0x005c2a7c in (anonymous namespace)::pass_expand::execute > (this=<optimized out>, fun=0xfa970000) at > /var/gcc/reghunt/trunk/gcc/cfgexpand.c:6360 > #19 0x009c380c in execute_one_pass (pass=pass@entry=0x15d9b60) at > /var/gcc/reghunt/trunk/gcc/passes.c:2495 > #20 0x009c41c0 in execute_pass_list_1 (pass=0x15d9b60, pass@entry=0x15d7440) > at /var/gcc/reghunt/trunk/gcc/passes.c:2584 > #21 0x009c425c in execute_pass_list (fn=0xfa970000, pass=0x15d7440) at > /var/gcc/reghunt/trunk/gcc/passes.c:2595 > #22 0x00601bd4 in cgraph_node::expand (this=0xfa80e0d8) at > /var/gcc/reghunt/trunk/gcc/cgraphunit.c:2054 > #23 0x00603a1c in output_in_order () at > /var/gcc/reghunt/trunk/gcc/cgraphunit.c:2296 > #24 symbol_table::compile (this=0xfa80e000) at > /var/gcc/reghunt/trunk/gcc/cgraphunit.c:2537 > #25 0x006067e4 in symbol_table::finalize_compilation_unit (this=0xfa80e000) > at /var/gcc/reghunt/trunk/gcc/cgraphunit.c:2631 > #26 0x00ace800 in compile_file () at /var/gcc/reghunt/trunk/gcc/toplev.c:496 > #27 0x00ad1128 in do_compile () at /var/gcc/reghunt/trunk/gcc/toplev.c:2037 > #28 toplev::main (this=this@entry=0xffbfea36, argc=argc@entry=7, > argv=argv@entry=0xffbfea9c) at /var/gcc/reghunt/trunk/gcc/toplev.c:2172 > #29 0x012428d0 in main (argc=7, argv=0xffbfea9c) at > /var/gcc/reghunt/trunk/gcc/main.c:39 > > At the gcc_assert, I have > > p/x mode > $17 = 0xffbfdfd4 > (gdb) p *val > $18 = {code = REG, mode = E_TFmode, jump = 0, call = 0, unchanging = 0, > volatil = 0, in_struct = 0, used = 0, frame_related = 0, return_val = 0, u2 > = {original_regno = 354, insn_uid = 354, symbol_ref_flags = 354, > var_location_status = (VAR_INIT_STATUS_INITIALIZED | unknown: 352), num_elem > = 354}, u = {fld = {{rt_int = 354, rt_uint = 354, rt_str = 0x162 <error: > Cannot access memory at address 0x162>, rt_rtx = 0x162, rt_rtvec = 0x162, > rt_type = 354, rt_addr_diff_vec_flags = {min_align = 0, base_after_vec = 0, > min_after_vec = 0, max_after_vec = 0, min_after_base = 0, max_after_base = > 0, offset_unsigned = 0, scale = 1}, rt_cselib = 0x162, rt_tree = 0x162, > rt_bb = 0x162, rt_mem = 0x162, rt_constant = 0x162, rt_cfi = 0x162}}, hwint > = {1520446713775}, reg = {regno = 354, nregs = 1, unused = 11513775, attrs = > 0x0}, block_sym = {fld = {{rt_int = 354, rt_uint = 354, rt_str = 0x162 > <error: Cannot access memory at address 0x162>, rt_rtx = 0x162, rt_rtvec = > 0x162, rt_type = 354, rt_addr_diff_vec_flags = {min_align = 0, > base_after_vec = 0, min_after_vec = 0, max_after_vec = 0, min_after_base = > 0, max_after_base = 0, offset_unsigned = 0, scale = 1}, rt_cselib = 0x162, > rt_tree = 0x162, rt_bb = 0x162, rt_mem = 0x162, rt_constant = 0x162, rt_cfi > = 0x162}, {rt_int = 28290991, rt_uint = 28290991, rt_str = 0x1afafaf <error: > Cannot access memory at address 0x1afafaf>, rt_rtx = 0x1afafaf, rt_rtvec = > 0x1afafaf, rt_type = 28290991, rt_addr_diff_vec_flags = {min_align = 1, > base_after_vec = 1, min_after_vec = 0, max_after_vec = 1, min_after_base = > 0, max_after_base = 1, offset_unsigned = 1, scale = 175}, rt_cselib = > 0x1afafaf, rt_tree = 0x1afafaf, rt_bb = 0x1afafaf, rt_mem = 0x1afafaf, > rt_constant = 0x1afafaf, rt_cfi = 0x1afafaf}}, block = 0x0, offset = > 11582255486992739}, rv = {cl = 0, decimal = 0, sign = 0, signalling = 0, > canonical = 0, uexp = 354, sig = {28290991, 0, 2947526575, 2696704, 355}}, > fv = {data = {low = 1520446713775, high = 2947526575}, mode = 2696704}, hwiv > = {elem = {1520446713775}}}} > > No idea why the mode value would be corrupted here: > sparc_emit_float_lib_cmp passes in a TFmode at this point. Ah! Thanks for debugging it. I guess the problem is that we're passing the new machine_mode classes through ... and interpreting them as int in emit_library_call_value_1. This will only work on ABIs that pass the two in the same way. I think we'll need to replace the interface with one that takes the arguments in some other way.