This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/18241] [4.0 Regression] linux kernel loop gets miscompiled
- From: "law at redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Dec 2004 21:01:45 -0000
- Subject: [Bug tree-optimization/18241] [4.0 Regression] linux kernel loop gets miscompiled
- References: <20041031010322.18241.ak@muc.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From law at redhat dot com 2004-12-13 21:01 -------
(In reply to comment #15)
> Confirmed, this looks like a jump threading bug.
> Before we have:
> goto <bb 9> (<L10>);
>
> <L8>:;
> D.7815_42 = pathp_2->node;
> tag_43 = tag_27;
> idx_44 = idx_6;
> D.7819_45 = D.7815_42->tags[tag_43][idx_44];
> if (D.7819_45 != 0) goto out; else goto <L9>;
>
> <L9>:;
> idx_46 = idx_6 + 1;
>
> # idx_6 = PHI <idx_39(6), idx_46(8)>;
> <L10>:;
> if (idx_6 == 0) goto <L8>; else goto <L11>;
>
>
> But after:
> goto <bb 8> (<L10>);
>
> <L9>:;
> idx_46 = 1;
> goto <bb 10> (<L15>);
>
> # idx_57 = PHI <0(6)>;
> <L10>:;
> D.7815_42 = pathp_2->node;
> tag_43 = tag_27;
> idx_44 = 0; <---- this is just plainly wrong.
> D.7819_45 = D.7815_42->tags[tag_27][0];
> if (D.7819_45 != 0) goto out; else goto <L9>;
Huh? idx_44 must be zero, I don't see how any other value can be correct here.
THe only way to get to L8 (block #7) is when idx_6 == 0 and idx_44 is set
unconditionally from idx_6.
So what about that assignment do you think is wrong?
Note that we also know that idx_46 must have the value 1 because it's only
reachable from block #7 where we know that idx_6 == 0 and thus idx_46 must
have the value 1.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18241