Compile the following program with -O3 on FreeBSD or Linux, x86:

///////////////

#include <stdlib.h>
#include <string.h>

register long foo asm("esi");
register long bar asm("edi");

char * crash_me_baby(char *str) {
        char *path = malloc(1024 + strlen(str));
        return path;
}

///////////////

This results in an error like the following:

test.c:10: error: unable to find a register to spill in class 'DIREG'
test.c:10: error: this is the insn:
(insn:HI 16 83 17 2 (parallel [
            (set (reg:SI 2 cx [66])
                (unspec:SI [
                        (mem:BLK (reg/v/f:SI 63 [ suffix ]) [0 A8])
                        (reg:QI 0 ax [70])
                        (const_int 1 [0x1])
                        (reg:SI 2 cx [69])
                    ] 20))
            (use (reg:SI 19 dirflag))
            (clobber (reg/f:SI 68 [ suffix ]))
            (clobber (reg:CC 17 flags))
        ]) 530 {*strlenqi_1} (insn_list:REG_DEP_TRUE 6 (insn_list:REG_DEP_TRUE
12 (insn_list:REG_DEP_TRUE 14 (insn_list:REG_DEP_TRUE 15 (nil)))))
    (expr_list:REG_DEAD (reg:SI 19 dirflag)
        (expr_list:REG_DEAD (reg:SI 2 cx [69])
            (expr_list:REG_DEAD (reg:QI 0 ax [70])
                (expr_list:REG_UNUSED (reg:CC 17 flags)
                    (expr_list:REG_UNUSED (reg/f:SI 68 [ suffix ])
                        (expr_list:REG_EQUAL (unspec:SI [
                                    (mem:BLK (reg/v/f:SI 63 [ suffix ]) [0 A8])
                                    (reg:QI 0 ax [70])
                                    (const_int 1 [0x1])
                                    (reg:SI 2 cx [69])
                                ] 20)
                            (nil))))))))


-- 
           Summary: Internal compiler error with register global variables
           Product: gcc
           Version: 4.2.1
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: slava at factorcode dot org
 GCC build triplet: i386-unknown-freebsd6.2
  GCC host triplet: i386-unknown-freebsd6.2
GCC target triplet: i386-unknown-freebsd6.2


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33096

Reply via email to