User account creation filtered due to spam.

Bug 33096 - Internal compiler error with register global variables
Summary: Internal compiler error with register global variables
Status: RESOLVED DUPLICATE of bug 11001
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.2.1
: P3 major
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-17 07:55 UTC by Slava Pestov
Modified: 2007-08-17 09:03 UTC (History)
3 users (show)

See Also:
Host: i386-unknown-freebsd6.2
Target: i386-unknown-freebsd6.2
Build: i386-unknown-freebsd6.2
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Test case (146 bytes, text/plain)
2007-08-17 07:56 UTC, Slava Pestov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Slava Pestov 2007-08-17 07:55:26 UTC
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))))))))
Comment 1 Slava Pestov 2007-08-17 07:56:42 UTC
Created attachment 14068 [details]
Test case

This is a test case for the bug. Compile with -O1, -O2 or -O3 to trigger it.

With -O0, it compiles fine.
Comment 2 Andrew Pinski 2007-08-17 09:03:37 UTC

*** This bug has been marked as a duplicate of 11001 ***