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
Status: RESOLVED FIXED
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
URL:
Keywords: ice-on-valid-code
: 107112 107149 (view as bug list)
Depends on:
Blocks:
 
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
Build:
Known to work:
Known to fail:
Last reconfirmed: 2022-09-30 00:00:00


Attachments

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();

void
_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)
          __sprint_r();
    }
    iov_len();
  }
error:
}

$ ./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
	/home/marxin/Programming/gcc/gcc/machmode.h:297
0xcff5c8 void mode_iterator::get_known_wider<scalar_int_mode>(scalar_int_mode*)
	/home/marxin/Programming/gcc/gcc/machmode.h:1124
0xcf9d81 new_cselib_val
	/home/marxin/Programming/gcc/gcc/cselib.cc:1579
0xcfba7a cselib_lookup_1
	/home/marxin/Programming/gcc/gcc/cselib.cc:2315
0xcfc183 cselib_lookup(rtx_def*, machine_mode, int, machine_mode)
	/home/marxin/Programming/gcc/gcc/cselib.cc:2431
0xcfd498 cselib_record_sets
	/home/marxin/Programming/gcc/gcc/cselib.cc:2932
0xcfe00a cselib_process_insn(rtx_insn*)
	/home/marxin/Programming/gcc/gcc/cselib.cc:3159
0x123eac4 reload_cse_regs_1
	/home/marxin/Programming/gcc/gcc/postreload.cc:229
0x123e5b4 reload_cse_regs
	/home/marxin/Programming/gcc/gcc/postreload.cc:72
0x1244156 execute
	/home/marxin/Programming/gcc/gcc/postreload.cc:2347
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.