This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Committed: Fix distribute_loop


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;
>
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]