[m-dev.] [Fwd: [Bug c/22362] New: Register allocation problem in combination with -funit-at-a-time and global register variables]

Peter Hawkins peter at hawkins.emu.id.au
Fri Jul 8 17:27:32 AEST 2005


I just submitted this GCC bug report:

-------- Original Message --------
Subject: 	[Bug c/22362] New: Register allocation problem in combination 
with -funit-at-a-time and global register variables
Date: 	8 Jul 2005 07:21:53 -0000
From: 	peter at hawkins dot emu dot id dot au <gcc-bugzilla at gcc.gnu.org>
Reply-To: 	gcc-bugzilla at gcc.gnu.org
To: 	peter at hawkins.emu.id.au



Hi...

I'm using debian's unstable gcc 4.0:
$ gcc -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f95,objc,ada,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib --enable-nls
--without-included-gettext --enable-threads=posix --program-suffix=-4.0
--enable-__cxa_atexit --enable-libstdcxx-allocator=mt --enable-clocale=gnu
--enable-libstdcxx-debug --enable-java-gc=boehm --enable-java-awt=gtk
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.0-1.4.2.0/jre --enable-mpfr
--disable-werror --enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.0.1 20050701 (prerelease) (Debian 4.0.0-12)

I'm trying to compile the following code (which is a reduced test case generated
from mercury_deep_copy.c in the Mercury compiler version ROTD 20050707 from
http://www.cs.mu.oz.au/mercury/):

register unsigned int reg0 __asm__("esi");
register unsigned int reg1 __asm__("edi");
register unsigned int reg2 __asm__("ebx");

static unsigned int
MR_deep_copy_typeclass_info(unsigned int *typeclass_info,
    void *lower_limit, void *upper_limit)
{
    int i;

    for (i = 5; i > 0; i--)
    {
        typeclass_info[i] = (unsigned int) MR_deep_copy_typeclass_info(
            (unsigned int *)typeclass_info[i], lower_limit, lower_limit);
    }
    return 0;
}

unsigned int func(void)
{
    return MR_deep_copy_typeclass_info(0, 0, 0);
}

using this command line:
$ gcc -c test3.c -O -funit-at-a-time

which produces this:
test3.c: In function 'MR_deep_copy_typeclass_info':
test3.c:17: error: unable to find a register to spill in class 'GENERAL_REGS'
test3.c:17: error: this is the insn:
(insn 27 26 28 1 (set (reg:SI 0 ax)
        (mem:SI (plus:SI (reg:SI 70)
                (const_int 4 [0x4])) [0 S4 A32])) 41 {*movsi_1}
(insn_list:REG_DEP_TRUE 22 (nil))
    (nil))
test3.c:17: confused by earlier errors, bailing out

The same code compiles with -O1 and no -funit-at-a-time. It also compiles with
gcc-3.4, so this is a gcc 4 regression. I suspect this means -funit-at-a-time
behaves badly under high register pressure.

=)
Peter

-- 
           Summary: Register allocation problem in combination with -funit-
                    at-a-time and global register variables
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: peter at hawkins dot emu dot id dot au
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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

------- You are receiving this mail because: -------
You reported the bug, or are watching the reporter.

--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list