Bug 94144 - ICE on aarch64-linux-gnu: in aarch64_print_operand at gcc/config/aarch64/aarch64.c:9528
Summary: ICE on aarch64-linux-gnu: in aarch64_print_operand at gcc/config/aarch64/aarc...
Status: RESOLVED DUPLICATE of bug 94238
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 10.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-11 15:42 UTC by Andrea Corallo
Modified: 2020-03-23 23:59 UTC (History)
1 user (show)

See Also:
Host:
Target: aarch64
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrea Corallo 2020-03-11 15:42:01 UTC
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.
Comment 1 Jeffrey A. Law 2020-03-23 19:02:18 UTC
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 ***
Comment 2 CVS Commits 2020-03-23 23:59:46 UTC
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.