Summary: | [4.3 Regression] gcc.c-torture/execute/20010422-1.c is miscompiled | ||
---|---|---|---|
Product: | gcc | Reporter: | Kazumoto Kojima <kkojima> |
Component: | tree-optimization | Assignee: | Andrew Macleod <amacleod> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | amacleod, danglin, gcc-bugs, rsandifo |
Priority: | P3 | Keywords: | wrong-code |
Version: | 4.3.0 | ||
Target Milestone: | 4.3.0 | ||
Host: | i686-pc-linux-gnu | Target: | sh-elf, mips-elf, i686-pc-linux-gnu |
Build: | i686-pc-linux-gnu | Known to work: | |
Known to fail: | Last reconfirmed: | 2006-12-12 14:11:13 |
Description
Kazumoto Kojima
2006-12-12 00:15:39 UTC
A slightly different test case unsigned int foo(unsigned int x) { if (x < 5) x = 4; else x = 8; return x; } int main(void) { if (foo (4) != 4) abort (); if (foo (8) != 8) abort (); exit (0); } aborts on i686-pc-linux-gnu with -O1 and -O2. Adding Andrew to CC list. Seems related to out-of-ssa changes. Analyzing Edge Insertions. foo (x) { unsigned int x.24; <bb 2>: if (x.24 <= 4) goto <L5>; else goto <L4>; Yeah, this is clearly wrong. It looks like the coalescer somehow neglected to coalesce the parameter to the first use in bb2, so it ended up getting the wrong 'x' in the comparison. The x and x.24's should all be reversed. Subject: Bug 30159 Author: amacleod Date: Tue Dec 12 15:50:06 2006 New Revision: 119792 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=119792 Log: 2006-12-12 Andrew Macleod <amacleod@redhat.com> PR tree-optimization/30159 * tree-ssa-coalesce.c (coalesce_ssa_name): Process single ssa_name functions in case a default_def coalesce is required. Modified: trunk/gcc/ChangeLog trunk/gcc/tree-ssa-coalesce.c *** Bug 30178 has been marked as a duplicate of this bug. *** The patch fixes the problem also on sh-elf and mips-elf. Thanks! BTW, I'm a bit surprised that current testcases didn't catch it on x86. How about to add a new testcase? Fixed. |