After reading all other PRs about uninitialized variable warnings, I
believe this one is a different situtation.
PR 20968 -- is about inlining, which is not involved here
PR 21733 -- is about two concatenated blocks rather than nested ones
PR 31707 -- is about setjmp
PR 20644 -- is also about unreachable code
In this testcase, it is really obvious to the observer that the switch
statement explicitly handles all the cases where it could be reached
from the outer if statement, and thus always assigns a value to
variable areg. GCC 3.x did not warn about it.
I verified the warning is still generated with SVN revision 131533.
(The code is taken from a project called simulavr, and has been cut
down to the minimal test case reproducing the warning.)

This problem is introduced by the default case that gets added to the switch
stmt in the IL. Coming from this case, areg is uninitialized.
The fix for PR14495 will likely fix this (by removing the default case again).

(In reply to comment #2)
> The fix for PR14495 will likely fix this (by removing the default case again).
Alas, no, it doesn't. I applied that patch (and the one it depends one
mentioned in the article), rebuilt, but I'm still getting the warning for
this test case.
If you want me to append some trace data, just tell me how to do it.

Subject: Re: warning: 'areg' may be used uninitialized
in this function
On Tue, 15 Jan 2008, j at uriah dot heep dot sax dot de wrote:
> ------- Comment #3 from j at uriah dot heep dot sax dot de 2008-01-15 12:54 -------
> (In reply to comment #2)
>
> > The fix for PR14495 will likely fix this (by removing the default case again).
>
> Alas, no, it doesn't. I applied that patch (and the one it depends one
> mentioned in the article), rebuilt, but I'm still getting the warning for
> this test case.
>
> If you want me to append some trace data, just tell me how to do it.
Oh, indeed - it also needs PR30317 fixed. (the attached patches therein
probably no longer apply)
The problem is that for the range check we create a fancy unsigned
compare, which VRP does not handle yet.
Richard.

(In reply to comment #4)
> Oh, indeed - it also needs PR30317 fixed. (the attached patches therein
> probably no longer apply)
I applied the second of the attached patches there. It applies cleanly,
but still does not solve the issue. OK, I patched in somewhat the
"reverse order" (PR 14495 first, then noticed I needed your previous
patchset for the find_case_label_index() function, then finally applied
the patch for PR 30317), but as the patches could all be applied, I think
that doesn't matter much.
If you've got a patched tree around, could you give the testcase of this
PR here a try?

Subject: Re: warning: 'areg' may be used uninitialized
in this function
On Tue, 15 Jan 2008, j at uriah dot heep dot sax dot de wrote:
> ------- Comment #5 from j at uriah dot heep dot sax dot de 2008-01-15 14:38 -------
> (In reply to comment #4)
>
> > Oh, indeed - it also needs PR30317 fixed. (the attached patches therein
> > probably no longer apply)
>
> I applied the second of the attached patches there. It applies cleanly,
> but still does not solve the issue. OK, I patched in somewhat the
> "reverse order" (PR 14495 first, then noticed I needed your previous
> patchset for the find_case_label_index() function, then finally applied
> the patch for PR 30317), but as the patches could all be applied, I think
> that doesn't matter much.
>
> If you've got a patched tree around, could you give the testcase of this
> PR here a try?
Sorry, I don't have any of those trees left. But if I ever come to
revisit those two bugs I'll make sure it fixes this bogus warning.
Richard.

(In reply to comment #6)
> Sorry, I don't have any of those trees left. But if I ever come to
> revisit those two bugs I'll make sure it fixes this bogus warning.
If you can give me some hints about where to start, I do have the
patched tree around on one of my machines, so I might make a stab at
fixing this. I'm not a seasoned GCC hacker but willing to learn. ;-)