public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c/8467: Bug in sibling call optimization
@ 2002-11-19 12:19 sirl
0 siblings, 0 replies; 7+ messages in thread
From: sirl @ 2002-11-19 12:19 UTC (permalink / raw)
To: Franz.Sirl-kernel, gcc-bugs, gcc-prs, nobody
Synopsis: Bug in sibling call optimization
State-Changed-From-To: open->closed
State-Changed-By: sirl
State-Changed-When: Mon Nov 11 13:37:32 2002
State-Changed-Why:
Fixed.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8467
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: c/8467: Bug in sibling call optimization
@ 2002-11-19 12:16 Franz Sirl
0 siblings, 0 replies; 7+ messages in thread
From: Franz Sirl @ 2002-11-19 12:16 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c/8467; it has been noted by GNATS.
From: Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
To: Mark Mitchell <mark@codesourcery.com>,
"gcc-gnats@gcc.gnu.org" <gcc-gnats@gcc.gnu.org>
Cc: "gcc-bugs@gcc.gnu.org" <gcc-bugs@gcc.gnu.org>,
"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: c/8467: Bug in sibling call optimization
Date: Mon, 11 Nov 2002 22:29:52 +0100
On Monday 11 November 2002 03:23, Mark Mitchell wrote:
> > Branch bootstraps on powerpc-linux-gnu and i686-linux-gnu completed
> > without regressions.
>
> Check this patch in, please, and let me know when it is done.
Committed.
Franz.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: c/8467: Bug in sibling call optimization
@ 2002-11-10 18:36 Mark Mitchell
0 siblings, 0 replies; 7+ messages in thread
From: Mark Mitchell @ 2002-11-10 18:36 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c/8467; it has been noted by GNATS.
From: Mark Mitchell <mark@codesourcery.com>
To: Franz Sirl <Franz.Sirl-kernel@lauterbach.com>,
"gcc-gnats@gcc.gnu.org" <gcc-gnats@gcc.gnu.org>
Cc: "gcc-bugs@gcc.gnu.org" <gcc-bugs@gcc.gnu.org>,
"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: c/8467: Bug in sibling call optimization
Date: Sun, 10 Nov 2002 18:23:29 -0800
> Branch bootstraps on powerpc-linux-gnu and i686-linux-gnu completed
> without regressions.
Check this patch in, please, and let me know when it is done.
Thanks!
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: c/8467: Bug in sibling call optimization
@ 2002-11-09 2:26 Franz Sirl
0 siblings, 0 replies; 7+ messages in thread
From: Franz Sirl @ 2002-11-09 2:26 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c/8467; it has been noted by GNATS.
From: Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
To: gcc-gnats@gcc.gnu.org
Cc: gcc-bugs@gcc.gnu.org,
gcc-patches@gcc.gnu.org,
Mark Mitchell <mark@codesourcery.com>
Subject: Re: c/8467: Bug in sibling call optimization
Date: Sat, 9 Nov 2002 11:24:34 +0100
On Thursday 07 November 2002 22:12, Franz Sirl wrote:
> Hi,
>
> it turns out this bug is easily fixed with an intermediate move insn
> covering the case when DECL_MODE differs from the mode of the DECL_RTL.
>
> Bootstrap on powerpc-linux-gnu is currently runnning.
>
> OK to commit patch&testcase to mainline and branch after the bootstrap
> completed successfully?
>
> Franz.
>
>
> PR c/8467
> * stmt.c (tail_recursion_args): Handle DECL_MODE differing from the
> mode of DECL_RTL case.
Branch bootstraps on powerpc-linux-gnu and i686-linux-gnu completed without
regressions.
Franz.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: c/8467: Bug in sibling call optimization
@ 2002-11-07 13:16 Franz Sirl
0 siblings, 0 replies; 7+ messages in thread
From: Franz Sirl @ 2002-11-07 13:16 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c/8467; it has been noted by GNATS.
From: Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
To: gcc-gnats@gcc.gnu.org
Cc: gcc-bugs@gcc.gnu.org,
gcc-patches@gcc.gnu.org,
Mark Mitchell <mark@codesourcery.com>
Subject: Re: c/8467: Bug in sibling call optimization
Date: Thu, 7 Nov 2002 22:12:01 +0100
--------------Boundary-00=_1K58ZGKQV14TE1LTMPZF
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
Hi,
it turns out this bug is easily fixed with an intermediate move insn covering
the case when DECL_MODE differs from the mode of the DECL_RTL.
Bootstrap on powerpc-linux-gnu is currently runnning.
OK to commit patch&testcase to mainline and branch after the bootstrap
completed successfully?
Franz.
PR c/8467
* stmt.c (tail_recursion_args): Handle DECL_MODE differing from the
mode of DECL_RTL case.
--------------Boundary-00=_1K58ZGKQV14TE1LTMPZF
Content-Type: text/plain;
charset="iso-8859-1";
name="gcc-tailrecursion.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="gcc-tailrecursion.patch"
Index: gcc/stmt.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/stmt.c,v
retrieving revision 1.248.2.4
diff -u -p -r1.248.2.4 stmt.c
--- gcc/stmt.c 17 Apr 2002 01:43:57 -0000 1.248.2.4
+++ gcc/stmt.c 7 Nov 2002 20:51:44 -0000
@@ -3351,8 +3351,18 @@ tail_recursion_args (actuals, formals)
if (GET_MODE (DECL_RTL (f)) == GET_MODE (argvec[i]))
emit_move_insn (DECL_RTL (f), argvec[i]);
else
- convert_move (DECL_RTL (f), argvec[i],
- TREE_UNSIGNED (TREE_TYPE (TREE_VALUE (a))));
+ {
+ rtx tmp = argvec[i];
+
+ if (DECL_MODE (f) != GET_MODE (DECL_RTL (f)))
+ {
+ tmp = gen_reg_rtx (DECL_MODE (f));
+ convert_move (tmp, argvec[i],
+ TREE_UNSIGNED (TREE_TYPE (TREE_VALUE (a))));
+ }
+ convert_move (DECL_RTL (f), tmp,
+ TREE_UNSIGNED (TREE_TYPE (TREE_VALUE (a))));
+ }
}
free_temp_slots ();
--------------Boundary-00=_1K58ZGKQV14TE1LTMPZF--
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: c/8467: Bug in sibling call optimization
@ 2002-11-05 15:26 Franz Sirl
0 siblings, 0 replies; 7+ messages in thread
From: Franz Sirl @ 2002-11-05 15:26 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c/8467; it has been noted by GNATS.
From: Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
To: gcc-gnats@gcc.gnu.org
Cc:
Subject: Re: c/8467: Bug in sibling call optimization
Date: Wed, 6 Nov 2002 00:20:46 +0100
On Tuesday 05 November 2002 21:25, Franz.Sirl-kernel@lauterbach.com wrote:
> >Number: 8467
> >Category: c
> >Synopsis: Bug in sibling call optimization
> >Confidential: no
> >Severity: serious
> >Priority: medium
> >Responsible: unassigned
> >State: open
> >Class: sw-bug
> >Submitter-Id: net
> >Arrival-Date: Tue Nov 05 12:26:00 PST 2002
> >Closed-Date:
> >Last-Modified:
> >Originator: Franz.Sirl-kernel@lauterbach.com
> >Release: gcc-3.2.1pre, gcc-3.3exp
> >Organization:
> >Environment:
>
> powerpc-linux-gnu
>
> >Description:
>
> The appended testcase aborts if compiled with -O2, adding
> -fno-optimize-sibling-calls makes it pass.
>
> This is a regression from gcc-2.95.4.
>
> >How-To-Repeat:
>
> extern void abort (void);
> extern void exit (int);
>
> int aim_callhandler(int sess, int conn, unsigned short family, unsigned
> short type) {
> static int i = 0;
>
> if (!conn)
> return 0;
>
> if (type == 0xffff)
> {
> return 0;
> }
>
> if (i >= 1)
> abort ();
>
> i++;
> return aim_callhandler(sess, conn, family, 0xffff);
> }
>
> int main (void)
> {
> aim_callhandler (0, 1, 0, 0);
> exit (0);
> }
The 4th arg is incorrectly sign-extended during tail recursion. the .rtl dump
with debug_call_placeholder_verbose set to 1 in the debugger:
(call_insn 94 68 96 (call_placeholder 84 0 69 79 (cond [
(const_string "normal") (sequence [
(insn 84 0 86 (set (reg:SI 3 r3)
(reg/v:SI 116)) -1 (nil)
(nil))
(insn 86 84 88 (set (reg:SI 4 r4)
(reg/v:SI 117)) -1 (nil)
(nil))
(insn 88 86 90 (set (reg:SI 5 r5)
(reg/v:SI 118)) -1 (nil)
(nil))
(insn 90 88 91 (set (reg:SI 6 r6)
(const_int 65535 [0xffff])) -1 (nil)
(nil))
(call_insn 91 90 93 (parallel[
(set (reg:SI 3 r3)
(call (mem:SI (symbol_ref:SI ("aim_callhandler")) [0
S4 A8])
(const_int 0 [0x0])))
(use (const_int 0 [0x0]))
(clobber (scratch:SI))
] ) -1 (nil)
(nil)
(expr_list (use (reg:SI 6 r6))
(expr_list (use (reg:SI 5 r5))
(expr_list (use (reg:SI 4 r4))
(expr_list (use (reg:SI 3 r3))
(nil))))))
(insn 93 91 0 (set (reg:SI 137)
(reg:SI 3 r3)) -1 (nil)
(nil))
])
(const_string "tail_recursion") (sequence [
(note 69 0 70 NOTE_INSN_DELETED)
(note 70 69 72 NOTE_INSN_DELETED)
(insn 72 70 74 (set (reg/v:SI 116)
(reg/v:SI 116)) -1 (nil)
(nil))
(insn 74 72 76 (set (reg/v:SI 117)
(reg/v:SI 117)) -1 (nil)
(nil))
(insn 76 74 78 (set (reg/v:SI 118)
(reg/v:SI 118)) -1 (nil)
(nil))
(insn 78 76 80 (set (reg/v:SI 119)
(const_int -1 [0xffffffffffffffff])) -1 (nil)
(nil))
(jump_insn 80 78 81 (set (pc)
(label_ref 79)) -1 (nil)
(nil))
(barrier 81 80 82)
(barrier 82 81 0)
])
])) -1 (nil)
(nil)
(nil))
Note the difference between insn 90 in the "normal" sequence and insn 78 in
the "tail_recursion" sequence! The 0xffff CONST_INT got signed extended, so
the compiler took the "short" type of the 4th arg into account, but ignored
the "unsigned" one.
Franz.
^ permalink raw reply [flat|nested] 7+ messages in thread
* c/8467: Bug in sibling call optimization
@ 2002-11-05 12:26 Franz.Sirl-kernel
0 siblings, 0 replies; 7+ messages in thread
From: Franz.Sirl-kernel @ 2002-11-05 12:26 UTC (permalink / raw)
To: gcc-gnats
>Number: 8467
>Category: c
>Synopsis: Bug in sibling call optimization
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Nov 05 12:26:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Franz.Sirl-kernel@lauterbach.com
>Release: gcc-3.2.1pre, gcc-3.3exp
>Organization:
>Environment:
powerpc-linux-gnu
>Description:
The appended testcase aborts if compiled with -O2, adding -fno-optimize-sibling-calls makes it pass.
This is a regression from gcc-2.95.4.
>How-To-Repeat:
extern void abort (void);
extern void exit (int);
int aim_callhandler(int sess, int conn, unsigned short family, unsigned short type)
{
static int i = 0;
if (!conn)
return 0;
if (type == 0xffff)
{
return 0;
}
if (i >= 1)
abort ();
i++;
return aim_callhandler(sess, conn, family, 0xffff);
}
int main (void)
{
aim_callhandler (0, 1, 0, 0);
exit (0);
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2002-11-11 21:37 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-19 12:19 c/8467: Bug in sibling call optimization sirl
-- strict thread matches above, loose matches on Subject: below --
2002-11-19 12:16 Franz Sirl
2002-11-10 18:36 Mark Mitchell
2002-11-09 2:26 Franz Sirl
2002-11-07 13:16 Franz Sirl
2002-11-05 15:26 Franz Sirl
2002-11-05 12:26 Franz.Sirl-kernel
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).