public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/26382]  New: [SH] Bug in GCC-3.4.4 and GCC-3.4.5 for crossjumping.
@ 2006-02-20 14:27 prafullat at kpitcummins dot com
  2006-02-21  2:17 ` [Bug rtl-optimization/26382] " pinskia at gcc dot gnu dot org
  2006-03-06  2:32 ` pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: prafullat at kpitcummins dot com @ 2006-02-20 14:27 UTC (permalink / raw)
  To: gcc-bugs

Hi,

We have found a bug for SuperH when trying for crossjumping and 
"-fif-conversion2" for gcc-3.4.4 and gcc-3.4.5.

Following is the simple test case,

////////////////////////////////////////////
//xfs2.c

1.      void func (void)
2.      {
3.        if (foo3())
4.          {
5.            foo4(0,1,2,3,4);
6.          }
7.        else 
8.          {
9.            if (foo2())
10.            {
11.               foo4(0,1,2,3,5);
12.            }
13.         }
14.       return;
15.     } 
////////////////////////////////////////////
The command line used for compiling the above is as given below;

#sh-elf-gcc -O1 -fomit-frame-pointer -fcrossjumping -fif-conversion2 -S 

////////////////////////////////////////////
        .file   "xfs2.c"
        .text
        .text
        .align 1
        .global _func
        .type   _func, @function
_func:
        sts.l   pr,@-r15
        mov.l   .L7,r0
        jsr     @r0
        nop
        tst     r0,r0
        add     #-4,r15
        bf/s    .L6
        mov     #4,r1
        mov.l   .L8,r0
        jsr     @r0
        nop
        tst     r0,r0
        bt      .L5
        add     #-4,r15         <-- wrong code ?? (additional stack adjustment  
                                                   here)
        mov     #5,r1
.L6:
        mov.l   r1,@r15
        mov     #0,r4
        mov     #1,r5
        mov     #2,r6
        mov.l   .L9,r0
        jsr     @r0
        mov     #3,r7
        add     #4,r15
.L5:
        lds.l   @r15+,pr
        rts     
        nop
.L10:
        .align 2
.L7:
        .long   _foo3
.L8:
        .long   _foo2
.L9:
        .long   _foo4
        .size   _func, .-_func
        .ident  "GCC: (GNU) 3.4.4"
////////////////////////////////////////////

This code work fine if branch is taken at line number "3". 
But program crashes if branch is not taken.

We have found workaround of using option "fno-crossjumping" OR 
"fno-if-conversion2". 

It seems that, it is a bug in gcc analysis when it tries to optimize 
the code for "crossjumping" as well as using most effective form 
of target specific conditional branching (like bt/s and bf/s ). 

We have further noticed that, this bug does not exist for following,
1. gcc-3.4.4/5 for x86 targets. 
2. gcc-4.0 for SuperH target (also, no crossjumping takes place)

We would like to fix this for SH in gcc-3.4.5. 
I would highly appreciate if someone can guide me to fix this bug.

Thanks in advance.

Regards,
Prafulla Thakare
KPIT Cummins InfoSystems Ltd.
Pune, India

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Free download of GNU based tool-chains for Renesas' SH and H8 Series.
The following site also offers free technical support to its users. 
Visit http://www.kpitgnutools.com for details. 
Latest versions of KPIT GNU tools were released on February 1, 2006.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


-- 
           Summary: [SH] Bug in GCC-3.4.4 and GCC-3.4.5 for crossjumping.
           Product: gcc
           Version: 3.4.5
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: prafullat at kpitcummins dot com
 GCC build triplet: i686-pc-linux
  GCC host triplet: i686-pc-linux
GCC target triplet: sh-unknown-elf


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


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

* [Bug rtl-optimization/26382] [SH] Bug in GCC-3.4.4 and GCC-3.4.5 for crossjumping.
  2006-02-20 14:27 [Bug c/26382] New: [SH] Bug in GCC-3.4.4 and GCC-3.4.5 for crossjumping prafullat at kpitcummins dot com
@ 2006-02-21  2:17 ` pinskia at gcc dot gnu dot org
  2006-03-06  2:32 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-21  2:17 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |normal
          Component|c                           |rtl-optimization
           Keywords|                            |wrong-code
      Known to fail|                            |3.4.5
      Known to work|                            |4.0.0


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


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

* [Bug rtl-optimization/26382] [SH] Bug in GCC-3.4.4 and GCC-3.4.5 for crossjumping.
  2006-02-20 14:27 [Bug c/26382] New: [SH] Bug in GCC-3.4.4 and GCC-3.4.5 for crossjumping prafullat at kpitcummins dot com
  2006-02-21  2:17 ` [Bug rtl-optimization/26382] " pinskia at gcc dot gnu dot org
@ 2006-03-06  2:32 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-06  2:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-03-06 02:32 -------
Fixed in 4.0.0.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.0.0


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


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

end of thread, other threads:[~2006-03-06  2:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-20 14:27 [Bug c/26382] New: [SH] Bug in GCC-3.4.4 and GCC-3.4.5 for crossjumping prafullat at kpitcummins dot com
2006-02-21  2:17 ` [Bug rtl-optimization/26382] " pinskia at gcc dot gnu dot org
2006-03-06  2:32 ` 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).