The compiler get ICE in final when compiling at -O3 the code below. Note: this appears to be a regression to gcc 9. --- int a, b, z; int c(int d, int e) { return d && e > 0 && d > 5 - e ? 0 : d + e; } int k(); void h(int); void f(short d) { int g = !(0 < d); h(d); if (b) { unsigned i[1]; i[0] = g = 0; for (; g <= 8; g++) d || k(); if (c(!(i[0] <= z) >= d, d) != a) k(); } } --- during RTL pass: final test.c: In function ‘f’: test.c:20:1: internal compiler error: in aarch64_print_operand, at config/aarch64/aarch64.c:9528 20 | } | ^ 0xde435f aarch64_print_operand ../../gcc/config/aarch64/aarch64.c:9528 0x85acfb output_operand(rtx_def*, int) ../../gcc/final.c:4051 0x85b76f output_asm_insn(char const*, rtx_def**) ../../gcc/final.c:3944 0x85f06f output_asm_insn(char const*, rtx_def**) ../../gcc/final.c:3840 0x85f06f final_scan_insn_1 ../../gcc/final.c:3106 0x85f537 final_scan_insn(rtx_insn*, _IO_FILE*, int, int, int*) ../../gcc/final.c:3152 0x85f7ff final_1 ../../gcc/final.c:2020 0x85ff73 rest_of_handle_final ../../gcc/final.c:4658 0x85ff73 execute ../../gcc/final.c:4736 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions.
Same core issue as 94238, simplify_logical_relational_operation does not validate that the chosen comparison code is valid for the comparison mode. *** This bug has been marked as a duplicate of bug 94238 ***
The master branch has been updated by Jeff Law <law@gcc.gnu.org>: https://gcc.gnu.org/g:75fb811dfaa29d60a897924b0d1629577b90eee7 commit r10-7346-g75fb811dfaa29d60a897924b0d1629577b90eee7 Author: Jeff Law <law@redhat.com> Date: Mon Mar 23 17:55:20 2020 -0600 Verify the code used for the optimized comparison is valid for the comparison's mode. PR rtl-optimization/90275 PR target/94238 PR target/94144 * simplify-rtx.c (comparison_code_valid_for_mode): New function. (simplify_logical_relational_operation): Use it. PR target/94144 PR target/94238 * gcc.c-torture/compile/pr94144.c: New test. * gcc.c-torture/compile/pr94238.c: New test.