This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/71678] New: [avr] ICE from switch / case on long long (casesi + DImode)


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

            Bug ID: 71678
           Summary: [avr] ICE from switch / case on long long  (casesi +
                    DImode)
           Product: gcc
           Version: 5.2.1
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gjl at gcc dot gnu.org
  Target Milestone: ---
            Target: avr

Created attachment 38778
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38778&action=edit
ice-casesi.c: C test case

$ avr-gcc -mmcu=atmega128 ice-casesi.c -Os -S -fno-tree-switch-conversion

unsigned char foo (long long x) 
{
    unsigned char y = 0;
    switch (x)
    {
        case 0: y = 67; break;
        case 1: y = 20; break;
        case 2: y = 109; break;
        case 3: y = 33; break;
        case 4: y = 44; break;
        case 5: y = 37; break;
        case 6: y = 10; break;
        case 7: y = 11; break;
    }
    return y;
}

will throw an ICE:

ice-casesi.c: In function 'foo':
ice-casesi.c:16:1: error: unrecognizable insn:
 }
 ^
(insn 55 54 56 4 (parallel [
            (set (reg:HI 47)
                (minus:HI (subreg:HI (subreg:SI (reg:DI 44) 0) 0)
                    (reg:HI 45)))
            (clobber (scratch:QI))
        ]) ice-casesi.c:4 -1
     (nil))
ice-casesi.c:16:1: internal compiler error: in extract_insn, at recog.c:2287

ice-casesi.c:16:1: internal compiler error: Segmentation fault


Problem is the casesi expander and its explicit SUBREG.  Here casesi from
current trunk, but the define_expand looks the same sice r31935:


(define_expand "casesi"
  [(parallel [(set (match_dup 6)
                   (minus:HI (subreg:HI (match_operand:SI 0 "register_operand"
"") 0)
                             (match_operand:HI 1 "register_operand" "")))
              (clobber (scratch:QI))])
   ...


I used avr-gcc 5.2.1 but affected are all versions of avr-gcc (maybe with a
slightly different test case with more cases or so).

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]