https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121572

--- Comment #5 from Sergei Trofimovich <slyfox at gcc dot gnu.org> ---
(In reply to H.J. Lu from comment #4)
> Created attachment 62133 [details]
> A patch
> 
> Please test this.

ICEs on `mpfr-4.2.2` when applied to master. `cvise` extracted this thing:

// $ cat agm.c.c
typedef enum { MPFR_RNDN } mpfr_rnd_t;
typedef int mpfr_t[1];
long __gmpfr_emin, mpfr_agm_expo_0;
_Thread_local long __gmpfr_emax;
int mpfr_agm_compare, mpfr_agm___trans_tmp_1;
mpfr_t mpfr_agm_u;
void mpfr_mul(int *, int, int, mpfr_rnd_t);
int mpfr_agm(int op1) {
  int op2 = 0;
  if (__builtin_expect(mpfr_agm_compare == 0, 0))
    return 0;
  if (mpfr_agm_compare > 0) {
    int t = op1;
    op2 = t;
  }
  mpfr_agm_expo_0 = __gmpfr_emax;
  for (;;) {
  retry:
    mpfr_mul(mpfr_agm_u, op1, op2, MPFR_RNDN);
    if (0)
      goto retry;
    if (__builtin_expect(mpfr_agm___trans_tmp_1, 1))
      break;
  }
  __gmpfr_emin = __gmpfr_emax;
  return 0;
}

Crashes as:

$ gcc/xgcc -Bgcc -c agm.c.c -O2 -fPIC -Wall
during RTL pass: x86_cse
agm.c.c: In function ‘mpfr_agm’:
agm.c.c:27:1: internal compiler error: in ix86_place_single_tls_call, at
config/i386/i386-features.cc:3918
   27 | }
      | ^
0x25ef8f0 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
        ???:0
0x25e4672 internal_error(char const*, ...)
        ???:0
0x25ecdb0 fancy_abort(char const*, int, char const*)
        ???:0
0x1670cbc ix86_place_single_tls_call(rtx_def*, rtx_def*, x86_cse_kind,
bitmap_head*, rtx_def*)
        ???:0
0x16774ec (anonymous namespace)::pass_x86_cse::execute(function*)
        ???:0

Reply via email to