[Bug c/38469] New: Wrong code for a function with long long argument returning int.

niva at niisi dot msk dot ru gcc-bugzilla@gcc.gnu.org
Wed Dec 10 10:27:00 GMT 2008


We used the snapshot gcc-4.1-20080630.

The command line is:
mips64-none-elf-gcc-4.1.3 -O1 -mabi=o64 lltst.c -fverbose-asm -S 

The source file is:

int equ(unsigned long long rc)
{
         if ((rc & 0x00000000ffffffffULL) == 0x00000000ULL)
                 return 1;

         return 0;
}

The assembler code generated is such that the result of the "equ" function
depends on the high part of the argument while it shouldn't:

equ:
        .frame  $sp,0,$31               # vars= 0, regs= 0/0, args= 0, gp= 0
        .mask   0x00000000,0
        .fmask  0x00000000,0
        .set    noreorder
        .set    nomacro

        j       $31
        sltu    $2,$4,1  # <result>, rc

        .set    macro
        .set    reorder
        .end    equ

It seems that the wrong code is produced after the "combine" RTL pass.


-- 
           Summary: Wrong code for a function with long long argument
                    returning int.
           Product: gcc
           Version: 4.1.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: niva at niisi dot msk dot ru
 GCC build triplet: i386-redhat-linux
  GCC host triplet: i386-redhat-linux
GCC target triplet: mips64-none-elf


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



More information about the Gcc-bugs mailing list