This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/26382] New: [SH] Bug in GCC-3.4.4 and GCC-3.4.5 for crossjumping.
- From: "prafullat at kpitcummins dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 20 Feb 2006 14:26:51 -0000
- Subject: [Bug c/26382] New: [SH] Bug in GCC-3.4.4 and GCC-3.4.5 for crossjumping.
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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