This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Infinite number of iterations in loop [v850, mep]
- From: Andrew Haley <aph at redhat dot com>
- To: Paulo Matos <pmatos at broadcom dot com>
- Cc: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Wed, 13 Nov 2013 15:55:52 +0000
- Subject: Re: Infinite number of iterations in loop [v850, mep]
- Authentication-results: sourceware.org; auth=none
- References: <19EB96622A777C4AB91610E763265F463A757B at SJEXCHMB14 dot corp dot ad dot broadcom dot com>
On 11/13/2013 03:48 PM, Paulo Matos wrote:
> I cannot understand GCC's reasoning that the second loop is not
> simple. The only source code difference is that unsigned int b is
> extern. However, it will always be higher than 'a' (unsigned int)
> and the loop can't possibly be infinite.
>
> Does anybody know why GCC is behaving this way?
Because GCC does not know that *c++ = 0; will not overwrite b . I
suppose you could argue that it's not really infinite, because a will
eventually equal 0xffffffff, but I think that's what is going on.
Andrew.