Bug 33663 - local register variable and memcmp
Summary: local register variable and memcmp
Status: RESOLVED DUPLICATE of bug 11001
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 4.2.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-10-05 03:01 UTC by akr
Modified: 2007-10-05 06:05 UTC (History)
4 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description akr 2007-10-05 03:01:45 UTC
I found "unable to find a register to spill in class 'SIREG'" error by following example.

% cat tst.c
void fun(void)
{
  register int val1 asm("esi");
  int val2;

  if (val2) {
    val2 = memcmp((void*)1, (void*)2, 3);
  }
  baz(val1, val2);
}

% gcc -v -O2 -c tst.c
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.2.1/configure --prefix=/home/src/gcc/gcc-4.2.1 --enable-languages=c
Thread model: posix
gcc version 4.2.1
 /home/src/gcc/gcc-4.2.1/libexec/gcc/i686-pc-linux-gnu/4.2.1/cc1 -quiet -v tst.c -quiet -dumpbase tst.c -mtune=generic -auxbase tst -O2 -version -o /tmp/cctXZKrk.s
ignoring nonexistent directory "/home/src/gcc/gcc-4.2.1/lib/gcc/i686-pc-linux-gnu/4.2.1/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /home/src/gcc/gcc-4.2.1/include
 /home/src/gcc/gcc-4.2.1/lib/gcc/i686-pc-linux-gnu/4.2.1/include
 /usr/include
End of search list.
GNU C version 4.2.1 (i686-pc-linux-gnu)
        compiled by GNU C version 4.2.1.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 192e817f7ff889e169228e9a0338c840
tst.c: In function 'fun':
tst.c:10: error: unable to find a register to spill in class 'SIREG'
tst.c:10: error: this is the insn:
(insn:HI 21 20 22 3 (parallel [
            (set (reg:CC 17 flags)
                (compare:CC (mem:BLK (reg/f:SI 0 ax [62]) [0 S3 A8])
                    (mem:BLK (reg/f:SI 5 di [63]) [0 S3 A8])))
            (use (reg:SI 2 cx [64]))
            (use (const_int 1 [0x1]))
            (use (reg:SI 19 dirflag))
            (clobber (reg/f:SI 0 ax [62]))
            (clobber (reg/f:SI 5 di [63]))
            (clobber (reg:SI 2 cx [64]))
        ]) 528 {*cmpstrnqi_nz_1} (insn_list:REG_DEP_TRUE 17 (insn_list:REG_DEP_TRUE 18 (insn_list:REG_DEP_TRUE 19 (insn_list:REG_DEP_TRUE 20 (nil)))))
    (expr_list:REG_DEAD (reg:SI 19 dirflag)
        (expr_list:REG_DEAD (reg:SI 2 cx [64])
            (expr_list:REG_DEAD (reg/f:SI 0 ax [62])
                (expr_list:REG_DEAD (reg/f:SI 5 di [63])
                    (expr_list:REG_UNUSED (reg:SI 2 cx [64])
                        (expr_list:REG_UNUSED (reg/f:SI 5 di [63])
                            (expr_list:REG_UNUSED (reg/f:SI 0 ax [62])
                                (expr_list:REG_EQUAL (compare:CC (mem:BLK (const_int 1 [0x1]) [0 S3 A8])
                                        (mem:BLK (const_int 2 [0x2]) [0 S3 A8]))
                                    (nil))))))))))
tst.c:10: confused by earlier errors, bailing out
Comment 1 Uroš Bizjak 2007-10-05 06:05:21 UTC
Will be fixed on trunk by http://gcc.gnu.org/ml/gcc-patches/2007-10/msg00269.html

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