public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/38469]  New: Wrong code for a function with long long argument returning int.
@ 2008-12-10 10:27 niva at niisi dot msk dot ru
  2008-12-15 21:43 ` [Bug c/38469] " rsandifo at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: niva at niisi dot msk dot ru @ 2008-12-10 10:27 UTC (permalink / raw)
  To: gcc-bugs

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


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

* [Bug c/38469] Wrong code for a function with long long argument returning int.
  2008-12-10 10:27 [Bug c/38469] New: Wrong code for a function with long long argument returning int niva at niisi dot msk dot ru
@ 2008-12-15 21:43 ` rsandifo at gcc dot gnu dot org
  2008-12-18 10:48 ` [Bug target/38469] " niva at niisi dot msk dot ru
  2008-12-20 21:36 ` rsandifo at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: rsandifo at gcc dot gnu dot org @ 2008-12-15 21:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rsandifo at gcc dot gnu dot org  2008-12-15 21:40 -------
I think this was fixed by:

http://gcc.gnu.org/ml/gcc-patches/2006-01/msg01996.html

Could you check whether it works for you?


-- 

rsandifo at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rsandifo at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |WAITING


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


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

* [Bug target/38469] Wrong code for a function with long long argument returning int.
  2008-12-10 10:27 [Bug c/38469] New: Wrong code for a function with long long argument returning int niva at niisi dot msk dot ru
  2008-12-15 21:43 ` [Bug c/38469] " rsandifo at gcc dot gnu dot org
@ 2008-12-18 10:48 ` niva at niisi dot msk dot ru
  2008-12-20 21:36 ` rsandifo at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: niva at niisi dot msk dot ru @ 2008-12-18 10:48 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 973 bytes --]



------- Comment #2 from niva at niisi dot msk dot ru  2008-12-18 10:47 -------
Subject: Re:  Wrong code for a function with long long
        argument returning int.


Unfortunately it doesn't. 

I have added the necessary static functions (reg_truncated_to_mode,
record_truncated_value, check_conversions) which are missing in
combine.c in gcc-4.1.x and the invocation of check_conversions.
But it didn't help.

Gcc-4.1.3 generates proper code for this test if I just substitute the
whole combine.c with the one from gcc-4.2.x (with minimal changes to
conform the infrastructure of gcc-4.1.x).




÷ ðÎÄ, 15/12/2008 × 21:40 +0000, rsandifo at gcc dot gnu dot org ÐÉÛÅÔ: 
> 
> ------- Comment #1 from rsandifo at gcc dot gnu dot org  2008-12-15 21:40 -------
> I think this was fixed by:
> 
> http://gcc.gnu.org/ml/gcc-patches/2006-01/msg01996.html
> 
> Could you check whether it works for you?
> 
> 


-- 


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


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

* [Bug target/38469] Wrong code for a function with long long argument returning int.
  2008-12-10 10:27 [Bug c/38469] New: Wrong code for a function with long long argument returning int niva at niisi dot msk dot ru
  2008-12-15 21:43 ` [Bug c/38469] " rsandifo at gcc dot gnu dot org
  2008-12-18 10:48 ` [Bug target/38469] " niva at niisi dot msk dot ru
@ 2008-12-20 21:36 ` rsandifo at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: rsandifo at gcc dot gnu dot org @ 2008-12-20 21:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rsandifo at gcc dot gnu dot org  2008-12-20 21:35 -------
OK well, thanks for trying.  I'm glad you have a workaround,
even if it's not the one I thought.  (Perhaps it was another
TRULY_NOOP_TRUNCATION combine.c fix.  ISTR there were a few.)

Anyway, the problem is fixed on all open release branches,
so I'm going to close the PR.  Thanks for the report.


-- 

rsandifo at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2008-12-20 21:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-10 10:27 [Bug c/38469] New: Wrong code for a function with long long argument returning int niva at niisi dot msk dot ru
2008-12-15 21:43 ` [Bug c/38469] " rsandifo at gcc dot gnu dot org
2008-12-18 10:48 ` [Bug target/38469] " niva at niisi dot msk dot ru
2008-12-20 21:36 ` rsandifo 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).