tkchia / gcc-ia16

Fork of Lambertsen & Jenner (& al.)'s IA-16 (Intel 16-bit x86) port of GNU compilers ― added far pointers & more • use https://github.com/tkchia/build-ia16 to build • Ubuntu binaries at https://launchpad.net/%7Etkchia/+archive/ubuntu/build-ia16/ • DJGPP/MS-DOS binaries at https://gitlab.com/tkchia/build-ia16/-/releases • mirror of https://gitlab.com/tkchia/gcc-ia16
GNU General Public License v2.0
173 stars 13 forks source link

ICE on far pointer + integer arithmetic. #4

Closed bartoldeman closed 6 years ago

bartoldeman commented 6 years ago

Since commit b898f780151db6 this code does not compile any more:

char __far *inc(char __far *p)
{
  return &p[1];
}
tst3.c: In function ‘inc’:
tst3.c:4:1: error: unrecognizable insn:
 }
 ^
(insn 8 7 13 2 (set (subreg:HI (reg/f:SI 21 [ _2 ]) 2)
        (subreg:HI (mem/f/c:SI (reg/f:HI 15 virtual-incoming-args) [1 p+0 S4 A16]) 2)) tst3.c:3 -1
     (nil))
tst3.c:4:1: internal compiler error: in extract_insn, at recog.c:2287
0x852e50f _fatal_insn(char const*, rtx_def const*, char const*, int, char const*)
        ../../gcc-ia16/gcc/rtl-error.c:108
0x852e54c _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
        ../../gcc-ia16/gcc/rtl-error.c:116
0x8506eed extract_insn(rtx_insn*)
        ../../gcc-ia16/gcc/recog.c:2287
0x8363599 instantiate_virtual_regs_in_insn
        ../../gcc-ia16/gcc/function.c:1582
0x8363599 instantiate_virtual_regs
        ../../gcc-ia16/gcc/function.c:1950
0x8363599 execute
        ../../gcc-ia16/gcc/function.c:1999
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
tkchia commented 6 years ago

Hello @bartoldeman,

Argh --- that was a silly mistake on my part --- thanks for catching it!

In my pointer arithmetic implementation (ia16_expand_weird_pointer_plus_expr (...)) I was trying to take a (subreg ...) of something that might not be a register.

This should be fixed now in my latest commit (38a0c2b3ab).