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

            Bug ID: 79131
           Summary: [7 Regression] ICE: in extract_constrain_insn, at
                    recog.c:2213, big-endian ARM
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: arnd at linaro dot org
  Target Milestone: ---

A variant of pr79058, which is already fixed by r244535, but a couple remain,
and also bisect to r243578:

$ cat /home/arnd/creduce/0x6F389A53/sufile-0x6F389A53.i
long long a;
enum { NILFS_SEGMENT_USAGE_ACTIVE, NILFS_SEGMENT_USAGE_DIRTY } b;
void nilfs_sufile_mod_counter(long long p1) {
  long c = p1;
  unsigned d = __builtin_bswap64(a);
  a = __builtin_bswap64(d + c);
}
void nilfs_sufile_do_free() {
  int e, f;
  e = __builtin_bswap32(b) & 1 << NILFS_SEGMENT_USAGE_DIRTY;
  f = e;
  nilfs_sufile_mod_counter(f ? -1 : 0);
}

$ /home/arnd/cross-gcc/bin/arm-linux-gnueabi-gcc-7.0.0 -c -Wall -O2
-mbig-endian /home/arnd/creduce/0x6F389A53/sufile-0x6F389A53.i
/home/arnd/creduce/0x6F389A53/sufile-0x6F389A53.i: In function
'nilfs_sufile_do_free':
/home/arnd/creduce/0x6F389A53/sufile-0x6F389A53.i:13:1: error: insn does not
satisfy its constraints:
 }
 ^
(insn 31 28 54 2 (set (reg:DI 0 r0 [141])
        (and:DI (reg:DI 1 r1 [orig:139+-4 ] [139])
            (const_int 1 [0x1])))
"/home/arnd/creduce/0x6F389A53/sufile-0x6F389A53.i":12 79 {*anddi3_insn}
     (nil))
/home/arnd/creduce/0x6F389A53/sufile-0x6F389A53.i:13:1: internal compiler
error: in extract_constrain_insn, at recog.c:2213
0x98ef23 _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
        /home/arnd/git/gcc/gcc/rtl-error.c:108
0x98ef4f _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
        /home/arnd/git/gcc/gcc/rtl-error.c:119
0x96361d extract_constrain_insn(rtx_insn*)
        /home/arnd/git/gcc/gcc/recog.c:2213
0x940a3c reload_cse_simplify_operands
        /home/arnd/git/gcc/gcc/postreload.c:391
0x943845 reload_cse_simplify
        /home/arnd/git/gcc/gcc/postreload.c:179
0x943845 reload_cse_regs_1
        /home/arnd/git/gcc/gcc/postreload.c:218
0x943913 reload_cse_regs
        /home/arnd/git/gcc/gcc/postreload.c:64
0x943913 execute
        /home/arnd/git/gcc/gcc/postreload.c:2342

For completeness, here are the three other reduced files that have the same
symptom:

$ cat 0x2F25F020/sufile-0x2F25F020.i
struct nilfs_segment_usage {
  int su_flags;
} a;
enum { NILFS_SEGMENT_USAGE_ACTIVE, NILFS_SEGMENT_USAGE_DIRTY } fn1();
int b;
void fn2(int *, long long);
void fn3() {
  int c, d;
  struct nilfs_segment_usage e = a;
  fn1();
  c = e.su_flags & 1 << NILFS_SEGMENT_USAGE_DIRTY;
  d = c;
  fn2(&b, d ? -1 : 0);
}

$ cat 0xB0981CD0/sufile-0xB0981CD0.i
long a;
struct {
  int su_flags;
} * b;
struct nilfs_segment_usage *e;
void fn1();
enum { NILFS_SEGMENT_USAGE_ACTIVE, NILFS_SEGMENT_USAGE_DIRTY } fn2() {
  return b->su_flags & 1 << NILFS_SEGMENT_USAGE_DIRTY;
}
void fn3(long long p1) {
  fn1();
  long c = p1;
  unsigned d = a;
  a = d + c;
}
void fn4() {
  void *f;
  int g;
  f = fn1;
  e = f;
  g = fn2();
  fn3(g ? -1 : 0);
}

$ cat 0xDD0D5D68/sufile-0xDD0D5D68.i
long a;
struct nilfs_segment_usage {
  int su_flags;
};
void *b;
enum {
  NILFS_SEGMENT_USAGE_ACTIVE,
  NILFS_SEGMENT_USAGE_DIRTY
} fn1(struct nilfs_segment_usage *p1) {
  return p1->su_flags & 1 << NILFS_SEGMENT_USAGE_DIRTY;
}
struct nilfs_segment_usage *fn2();
void fn3(long long p1) {
  b = 0;
  long c = p1;
  unsigned d = a;
  a = d + c;
}
void fn4() {
  struct nilfs_segment_usage *e;
  int f;
  e = fn2();
  f = fn1(e);
  fn3(f ? -1 : 0);
}

Reply via email to