[Bug inline-asm/84742] internal compiler error: in process_alt_operands, at lra-constraints.c:2112
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84742 Jakub Jelinek changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED --- Comment #8 from Jakub Jelinek --- Fixed.
[Bug inline-asm/84742] internal compiler error: in process_alt_operands, at lra-constraints.c:2112
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84742 --- Comment #7 from Jakub Jelinek --- Author: jakub Date: Thu Mar 8 20:55:03 2018 New Revision: 258369 URL: https://gcc.gnu.org/viewcvs?rev=258369=gcc=rev Log: PR inline-asm/84742 * recog.c (asm_operand_ok): Return 0 if multi-character constraint has ',' character inside of it. * gcc.target/i386/pr84742-1.c: New test. * gcc.target/i386/pr84742-2.c: New test. Added: trunk/gcc/testsuite/gcc.target/i386/pr84742-1.c trunk/gcc/testsuite/gcc.target/i386/pr84742-2.c Modified: trunk/gcc/ChangeLog trunk/gcc/recog.c trunk/gcc/testsuite/ChangeLog
[Bug inline-asm/84742] internal compiler error: in process_alt_operands, at lra-constraints.c:2112
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84742 --- Comment #6 from Jakub Jelinek --- Created attachment 43599 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43599=edit gcc8-pr84742.patch Untested fix.
[Bug inline-asm/84742] internal compiler error: in process_alt_operands, at lra-constraints.c:2112
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84742 Jakub Jelinek changed: What|Removed |Added Status|NEW |ASSIGNED CC||jakub at gcc dot gnu.org Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org Target Milestone|--- |8.0 --- Comment #5 from Jakub Jelinek --- We have many loops that assume the constraints are sane and it is safe to skip all the CONSTRAINT_LEN characters, so I think it is desirable to catch this early. asm_operand_ok already has: len = CONSTRAINT_LEN (c, constraint); do constraint++; while (--len && *constraint); if (len) return 0; which catches multi-character constraints with '\0' in the middle of it, and rejects those during vregs pass that also removes them: if (asm_noperands (PATTERN (insn)) >= 0) { if (!check_asm_operands (PATTERN (insn))) { error_for_asm (insn, "impossible constraint in %"); /* For asm goto, instead of fixing up all the edges just clear the template and clear input operands (asm goto doesn't have any output operands). */ if (JUMP_P (insn)) { rtx asm_op = extract_asm_operands (PATTERN (insn)); ASM_OPERANDS_TEMPLATE (asm_op) = ggc_strdup (""); ASM_OPERANDS_INPUT_VEC (asm_op) = rtvec_alloc (0); ASM_OPERANDS_INPUT_CONSTRAINT_VEC (asm_op) = rtvec_alloc (0); } else delete_insn (insn); } } So I'm just adding a check for ',' inside such constraints too.
[Bug inline-asm/84742] internal compiler error: in process_alt_operands, at lra-constraints.c:2112
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84742 --- Comment #4 from Vegard Nossum --- So I think the problem is that this loop in lra_set_insn_recog_data() counts the number of commas and uses that as the number of alternatives: 1018 for (p = constraints[0]; *p; p++) 1019 nalt += *p == ','; And then later we can skip over the comma inside preprocess_constraints() because 'T' is not recognised in the switch and then it does: p += CONSTRAINT_LEN (c, p); where CONSTRAINT_LEN for 'T' is 2: static inline size_t insn_constraint_len (char fc, const char *str ATTRIBUTE_UNUSED) { switch (fc) { case 'B': return 2; case 'T': return 2; case 'W': return 2; case 'Y': return 2; default: break; } return 1; } (so the real problematic bit of the constraint is this: "T,")
[Bug inline-asm/84742] internal compiler error: in process_alt_operands, at lra-constraints.c:2112
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84742 --- Comment #3 from Vegard Nossum --- gcc/recog.c:2395 is: 2390 case '0': case '1': case '2': case '3': case '4': 2391 case '5': case '6': case '7': case '8': case '9': 2392 { 2393 char *end; 2394 op_alt[i].matches = strtoul (p, , 10); 2395 op_alt[op_alt[i].matches].matched = i; 2396 p = end; 2397 } 2398 continue; It's a bit weird because I don't see any digits in the constraints in the test case.
[Bug inline-asm/84742] internal compiler error: in process_alt_operands, at lra-constraints.c:2112
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84742 --- Comment #2 from Vegard Nossum --- Created attachment 43598 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43598=edit ASAN output I compiled gcc itself using -fstack-protector-all -fsanitize=address and it occasionally gives me the "heap-use-after-free" error (log attached).
[Bug inline-asm/84742] internal compiler error: in process_alt_operands, at lra-constraints.c:2112
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84742 Martin Sebor changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2018-03-08 CC||msebor at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from Martin Sebor --- I have reproduced it (intermittently) with revisions as recent as r258160, but only with ASLR enabled. The valgrind errors for sparseset_bit_p are expected and go away --with-enable-valgrind-annotations. I don't see any other errors in my report and I can't reproduce it without ASLR or under GDB so there isn't much to go on. $ /opt/notnfs/gcc-bisect/obj/gcc/cc1plus.258160 -quiet -O3 -fpermissive -fno-toplevel-reorder -std=c++14 -o/dev/null t.C during RTL pass: reload t.C: In function ‘void a()’: t.C:10:1: internal compiler error: in process_alt_operands, at lra-constraints.c:2112 } ^ 0x1013ddb process_alt_operands ../../gcc/lra-constraints.c:2112 0x10187ca curr_insn_transform ../../gcc/lra-constraints.c:3860 0x101c13f lra_constraints(bool) ../../gcc/lra-constraints.c:4877 0x1004f6f lra(_IO_FILE*) ../../gcc/lra.c:2419 0xfac579 do_reload ../../gcc/ira.c:5465 0xfaca6c execute ../../gcc/ira.c:5649