This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Committed: Fix distribute_loop
- From: Richard Guenther <richard dot guenther at gmail dot com>
- To: Joern Rennecke <amylaar at spamcop dot net>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sat, 23 Jan 2010 13:36:18 +0100
- Subject: Re: Committed: Fix distribute_loop
- References: <20100123073057.pzhu5vatj40sw44w-nzlynne@webmail.spamcop.net>
On Sat, Jan 23, 2010 at 1:30 PM, Joern Rennecke <amylaar@spamcop.net> wrote:
> distribute_loop uses the variable "res" to compute the result
> before returning it. ?The return type is int, but the variable
> res was declared "bool". ?When configuring with
> --enable-build-with-cxx, this code is compiled with g++, which
> takes bool more seriously; an assignment of 2 to a bool variable
> would result in true, binary representation 00000001, so that
> the return value would then be 1. ?Therefore, the ldist pass
> would not work at all when configuring with --enable-build-with-cxx.
>
> Fixed with the attached patch.
Ugh. I wonder if we should use _Bool instead of int
if the host compiler supports it.
Richard.
> Committed as obvious.
>
>
> 2010-01-23 ?Joern Rennecke ?<amylaar@spamcop.net>
>
> ? ? ? ?* tree-loop-distribution.c (distribute_loop): Fix declaration and
> ? ? ? ?initialization of variable res to agree with return type.
>
> Index: tree-loop-distribution.c
> ===================================================================
> --- tree-loop-distribution.c ? ?(revision 156172)
> +++ tree-loop-distribution.c ? ?(working copy)
> @@ -1120,7 +1120,7 @@ ldist_gen (struct loop *loop, struct gra
> ?static int
> ?distribute_loop (struct loop *loop, VEC (gimple, heap) *stmts)
> ?{
> - ?bool res = false;
> + ?int res = 0;
> ? struct graph *rdg;
> ? gimple s;
> ? unsigned i;
>
>