Bug 107094 - [13 Regression] ICE in require, at machmode.h:297 since r13-2916-gd0b00b63a39108
Summary: [13 Regression] ICE in require, at machmode.h:297 since r13-2916-gd0b00b63a39108
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 13.0
: P3 normal
Target Milestone: 13.0
Assignee: Not yet assigned to anyone
Keywords: ice-on-valid-code
: 107112 107149 (view as bug list)
Depends on:
Reported: 2022-09-30 09:46 UTC by Martin Liška
Modified: 2022-10-07 08:56 UTC (History)
3 users (show)

See Also:
Host: x86_64-linux-gnu
Target: amdgcn-amdhsa
Known to work:
Known to fail:
Last reconfirmed: 2022-09-30 00:00:00


Note You need to log in before you can comment on or make changes to this bug.
Description Martin Liška 2022-09-30 09:46:26 UTC
The following cross compiler crashes:

$ cat amd.i
int _vfwprintf_r_ch;

int btowc();
int __sprint_r();
int iov_len();

_vfwprintf_r() {
  int uio_0, buf;
  for (;;) {
    switch (_vfwprintf_r_ch) {
    case L'c':
      int wc = btowc();
      if (wc)
        goto error;
      if (buf)
        if (++uio_0)

$ ./xgcc -B. amd.i -c -O2 
during RTL pass: postreload
amd.i: In function ‘_vfwprintf_r’:
amd.i:23:1: internal compiler error: in require, at machmode.h:297
   23 | }
      | ^
0xc47789 opt_mode<scalar_int_mode>::require() const
0xcff5c8 void mode_iterator::get_known_wider<scalar_int_mode>(scalar_int_mode*)
0xcf9d81 new_cselib_val
0xcfba7a cselib_lookup_1
0xcfc183 cselib_lookup(rtx_def*, machine_mode, int, machine_mode)
0xcfd498 cselib_record_sets
0xcfe00a cselib_process_insn(rtx_insn*)
0x123eac4 reload_cse_regs_1
0x123e5b4 reload_cse_regs
0x1244156 execute
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Comment 1 Stefan Schulze Frielinghaus 2022-09-30 10:01:39 UTC
Looks like related to PR107088
Comment 2 Martin Liška 2022-10-03 09:23:00 UTC
*** Bug 107112 has been marked as a duplicate of this bug. ***
Comment 3 Martin Liška 2022-10-04 09:28:43 UTC
*** Bug 107149 has been marked as a duplicate of this bug. ***
Comment 4 Tobias Burnus 2022-10-04 10:26:58 UTC
Cross ref: The PR mentioned in comment 1 contains a patch suggestion
that fixes the issue of this PR:

  PR 107088 comment 6 (the patch)
  PR 107088 comment 9 (comment that it fixes the issue)
Comment 5 Tobias Burnus 2022-10-06 21:42:12 UTC
I believe this is now fixed via
commit r13-3105-g5fc4d3e1837ea4850aac6460f563913f1d3fc5b8 for PR 107088
Comment 6 Martin Liška 2022-10-07 08:56:31 UTC
Yes, I can confirm that.