public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/22362] New: Register allocation problem in combination with -funit-at-a-time and global register variables
@ 2005-07-08  7:22 peter at hawkins dot emu dot id dot au
  2005-07-08 14:38 ` [Bug target/22362] [3.4/4.0/4.1 Regression] static function calls " pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: peter at hawkins dot emu dot id dot au @ 2005-07-08  7:22 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2005-09-06 20:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-08  7:22 [Bug c/22362] New: Register allocation problem in combination with -funit-at-a-time and global register variables peter at hawkins dot emu dot id dot au
2005-07-08 14:38 ` [Bug target/22362] [3.4/4.0/4.1 Regression] static function calls " pinskia at gcc dot gnu dot org
2005-07-22 21:17 ` pinskia at gcc dot gnu dot org
2005-08-17 12:37 ` bonzini at gcc dot gnu dot org
2005-09-05 13:22 ` jakub at gcc dot gnu dot org
2005-09-06 19:58 ` cvs-commit at gcc dot gnu dot org
2005-09-06 20:03 ` cvs-commit at gcc dot gnu dot org
2005-09-06 20:13 ` [Bug target/22362] [3.4 " pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).