[Bug tree-optimization/21173] [4.0/4.1 regression] miscompiled pointer subtraction broke Linux kernel
--- Additional Comments From belyshev at depni dot sinp dot msu dot ru 2005-04-23 12:51 --- -O1 -ftree-pre causing this. -- What|Removed |Added CC||dberlin at gcc dot gnu dot ||org Known to fail|4.0.0 |4.0.0 4.1.0 Summary|[4.0 regression] miscompiled|[4.0/4.1 regression] |pointer subtraction broke |miscompiled pointer |Linux kernel|subtraction broke Linux ||kernel http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21173
[Bug tree-optimization/21173] [4.0/4.1 regression] miscompiled pointer subtraction broke Linux kernel
--- Additional Comments From pinskia at gcc dot gnu dot org 2005-04-23 13:18 --- Hmm, is -&a legal gimple, if it is then it is a PRE bug, otherwise it is a bug in the gimplifier. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21173
[Bug tree-optimization/21173] [4.0/4.1 regression] miscompiled pointer subtraction broke Linux kernel
--- Additional Comments From steven at gcc dot gnu dot org 2005-04-23 13:24 --- .crited dump: foo (p) { int i; void * D.1576; char * D.1575; void * D.1574; void * D.1573; int i.0; : # i_16 = PHI ; :; D.1573_7 = a[i_16]; D.1574_9 = D.1573_7 + p_8; D.1575_10 = -&q; D.1576_11 = D.1574_9 + D.1575_10; a[i_16] = D.1576_11; i_13 = i_16 + 1; if (i_13 <= 1) goto ; else goto ; :; goto (); :; return; } .pre dump: foo (p) { int pretmp.3; char * pretmp.2; int i; void * D.1576; char * D.1575; void * D.1574; void * D.1573; int i.0; : pretmp.2_6 = &q; # i_16 = PHI ; :; D.1573_7 = a[i_16]; D.1574_9 = D.1573_7 + p_8; D.1575_10 = pretmp.2_6; D.1576_11 = D.1574_9 + D.1575_10; a[i_16] = D.1576_11; i_13 = i_16 + 1; if (i_13 <= 1) goto ; else goto ; :; goto (); :; return; } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21173
[Bug tree-optimization/21173] [4.0/4.1 regression] miscompiled pointer subtraction broke Linux kernel
--- Additional Comments From steven at gcc dot gnu dot org 2005-04-23 13:36 --- This could be the same bug as the one reported on the mailing list here: http://gcc.gnu.org/ml/gcc/2005-04/msg01260.html -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21173
[Bug tree-optimization/21173] [4.0/4.1 regression] miscompiled pointer subtraction broke Linux kernel
--- Additional Comments From steven at gcc dot gnu dot org 2005-04-23 13:39 --- ob-vi-ous... Index: tree-ssa-pre.c === RCS file: /cvs/gcc/gcc/gcc/tree-ssa-pre.c,v retrieving revision 2.80 diff -u -3 -p -r2.80 tree-ssa-pre.c --- tree-ssa-pre.c 21 Apr 2005 18:05:27 - 2.80 +++ tree-ssa-pre.c 23 Apr 2005 13:38:52 - @@ -1391,7 +1391,7 @@ create_expression_by_pieces (basic_block if (!is_gimple_min_invariant (genop1)) newexpr = force_gimple_operand (folded, &forced_stmts, false, NULL); else - newexpr = genop1; + newexpr = folded; if (forced_stmts) { tsi = tsi_start (forced_stmts); -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21173
[Bug tree-optimization/21173] [4.0/4.1 regression] miscompiled pointer subtraction broke Linux kernel
--- Additional Comments From jakub at gcc dot gnu dot org 2005-04-23 14:59 --- Shouldn't that be then also: - if (!is_gimple_min_invariant (genop1)) + if (!is_gimple_min_invariant (folded)) ? -- What|Removed |Added CC||jakub at redhat dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21173
[Bug tree-optimization/21173] [4.0/4.1 regression] miscompiled pointer subtraction broke Linux kernel
--- Additional Comments From dberlin at gcc dot gnu dot org 2005-04-23 15:09 --- Subject: Re: [4.0/4.1 regression] miscompiled pointer subtraction broke Linux kernel On Sat, 2005-04-23 at 14:59 +, jakub at gcc dot gnu dot org wrote: > --- Additional Comments From jakub at gcc dot gnu dot org 2005-04-23 > 14:59 --- > Shouldn't that be then also: > - if (!is_gimple_min_invariant (genop1)) > + if (!is_gimple_min_invariant (folded)) > ? > > yes In fact, the error actually makes no sense (IE you guys are overlooking an important fact). is_gimple_min_invariants are legal operands to unary expressions, regardless of whether they are "complex" or not, or so i was told. So if genop1 is is_gimple_min_invariant, it should be fine there, and you shouldn't need to use folded. If it wasn't, we'd force_gimple_operand it. I'm pretty sure you are just covering up a disconnect in what we allow as gimple and what we handle. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21173
[Bug tree-optimization/21173] [4.0/4.1 regression] miscompiled pointer subtraction broke Linux kernel
--- Additional Comments From dberlin at gcc dot gnu dot org 2005-04-23 15:13 --- Subject: Re: [4.0/4.1 regression] miscompiled pointer subtraction broke Linux kernel > yes > > In fact, the error actually makes no sense (IE you guys are overlooking > an important fact). > > is_gimple_min_invariants are legal operands to unary expressions, > regardless of whether they are "complex" or not, or so i was told. > > So if genop1 is is_gimple_min_invariant, it should be fine there, and > you shouldn't need to use folded. > Forget it, genop1 doens't include the operation, and folded does. I forgot about that -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21173
[Bug tree-optimization/21173] [4.0/4.1 regression] miscompiled pointer subtraction broke Linux kernel
--- Additional Comments From azarah at gentoo dot org 2005-04-23 17:19 --- Patch from comment #7 seems to work here (doing make check now to verify). I assume the change Jakub asked about is not needed? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21173
[Bug tree-optimization/21173] [4.0/4.1 regression] miscompiled pointer subtraction broke Linux kernel
--- Additional Comments From steven at gcc dot gnu dot org 2005-04-23 19:37 --- Created an attachment (id=8718) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=8718&action=view) patch Jakub, your patch is wrong. Try this one. -- What|Removed |Added AssignedTo|unassigned at gcc dot gnu |steven at gcc dot gnu dot |dot org |org Status|NEW |ASSIGNED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21173
[Bug tree-optimization/21173] [4.0/4.1 regression] miscompiled pointer subtraction broke Linux kernel
--- Additional Comments From stevenb at suse dot de 2005-04-23 23:01 --- Subject: Re: [4.0/4.1 regression] miscompiled pointer subtraction broke Linux kernel Yeah, well, ehm... The original bug resurfaces with my patch. This happens because is_gimple_reg_rhs only looks at the outermost level of the expression, e.g. it happily accepts "(intD.0) -xD.1566_4" as a valid GIMPLE rhs. Obviously this is wrong. I'm testing a new patch that simply always runs force_gimple_operand on folded, it's not clear to me why we don't do that anyway (it is cheap and safer). -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21173
[Bug tree-optimization/21173] [4.0/4.1 regression] miscompiled pointer subtraction broke Linux kernel
--- Additional Comments From stevenb at suse dot de 2005-04-24 09:23 --- Subject: Re: [4.0/4.1 regression] miscompiled pointer subtraction broke Linux kernel On Sunday 24 April 2005 05:36, dberlin at dberlin dot org wrote: > Uh, because it causes things to become non-invariant when they were > originally invariant (because it will *always* create a new name for > them). Well, the comment before force_gimple_operand says it should not: /* Expands EXPR to list of gimple statements STMTS. If SIMPLE is true, force the result to be either ssa_name or an invariant, otherwise just force it to be a rhs expression. If VAR is not NULL, make the base variable of the final destination be VAR if suitable. */ tree force_gimple_operand (tree expr, tree *stmts, bool simple, tree var) { tree-ssa-pre uses force_gimple_operand with SIMPLE==false, so if expr is already a valid rhs, force_gimple_operand should do nothing. If it does, I consider that to be a bug. Your patch to use unshare_expr is IMHO unnecessarily expensive. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21173
[Bug tree-optimization/21173] [4.0/4.1 regression] miscompiled pointer subtraction broke Linux kernel
--- Additional Comments From dberlin at gcc dot gnu dot org 2005-04-24 15:19 --- Please compile the testcase from 20963, with and without the unshare_expr in the patch i posted, and you'll see the bug. force_gimple_operand replaces TREE_OPERAND (folded, 0) with something else. folded came directly from the ANTIC set, so we can't touch it like that (we'd have to make it copy first). force_gimple_operand is replacing operands in what we pass it, which causes errors for us. You *need* to either fix it, or pass it a copy of the expression. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21173
[Bug tree-optimization/21173] [4.0/4.1 regression] miscompiled pointer subtraction broke Linux kernel
--- Additional Comments From dberlin at gcc dot gnu dot org 2005-04-24 15:27 --- Subject: Re: [4.0/4.1 regression] miscompiled pointer subtraction broke Linux kernel > tree-ssa-pre uses force_gimple_operand with SIMPLE==false, so if > expr is already a valid rhs, force_gimple_operand should do nothing. > If it does, I consider that to be a bug. > > Your patch to use unshare_expr is IMHO unnecessarily expensive. > > > Here's the gdb trace, btw: Breakpoint 3, create_expression_by_pieces (block=0x400c4870, expr=0x88403f0, stmts=0x400c6510) at tree-ssa-pre.c:1322 expr came from a node in ANTIC_IN, we *can't* modify it, because it's not a copy. (gdb) p debug_generic_stmt (expr) (charD.3 *) &0B->typeD.1681; ... 1388newexpr = force_gimple_operand (folded, (gdb) n 1390if (forced_stmts) (gdb) p debug_generic_stmt (expr) (charD.3 *) &D.1708_3->typeD.1681; tada! This is the reason we have to unshare it before passing it in. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21173
[Bug tree-optimization/21173] [4.0/4.1 regression] miscompiled pointer subtraction broke Linux kernel
--- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-04-25 13:59 --- Subject: Bug 21173 CVSROOT:/cvs/gcc Module name:gcc Changes by: [EMAIL PROTECTED] 2005-04-25 13:59:39 Modified files: gcc: ChangeLog tree-ssa-pre.c Log message: 2005-04-25 Steven Bosscher <[EMAIL PROTECTED]> Fix PR tree-optimization/21173 * tree-ssa-pre.c (create_expression_by_pieces): Simplify code. Unshare expression we pass to force_gimple_operand. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.8450&r2=2.8451 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-ssa-pre.c.diff?cvsroot=gcc&r1=2.81&r2=2.82 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21173
[Bug tree-optimization/21173] [4.0/4.1 regression] miscompiled pointer subtraction broke Linux kernel
--- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-04-25 14:03 --- Subject: Bug 21173 CVSROOT:/cvs/gcc Module name:gcc Branch: gcc-4_0-branch Changes by: [EMAIL PROTECTED] 2005-04-25 14:02:38 Modified files: gcc: ChangeLog tree-ssa-pre.c Log message: 2005-04-25 Daniel Berlin <[EMAIL PROTECTED]> Fix PR tree-optimization/21173 * tree-ssa-pre.c (create_expression_by_pieces): Call unshare_expr on things we pass to force_gimple_operand. Don't try to special case min_invariants. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.7592.2.192&r2=2.7592.2.193 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-ssa-pre.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.65.4.2&r2=2.65.4.3 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21173
[Bug tree-optimization/21173] [4.0/4.1 regression] miscompiled pointer subtraction broke Linux kernel
--- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-04-25 14:18 --- Subject: Bug 21173 CVSROOT:/cvs/gcc Module name:gcc Changes by: [EMAIL PROTECTED] 2005-04-25 14:18:31 Added files: gcc/testsuite/gcc.c-torture/execute: pr21173.c Log message: Testcase for pr 21173 Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/execute/pr21173.c.diff?cvsroot=gcc&r1=NONE&r2=1.1 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21173
[Bug tree-optimization/21173] [4.0/4.1 regression] miscompiled pointer subtraction broke Linux kernel
--- Additional Comments From pinskia at gcc dot gnu dot org 2005-04-25 14:47 --- *** Bug 21167 has been marked as a duplicate of this bug. *** -- What|Removed |Added CC||joc at presence-pc dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21173
[Bug tree-optimization/21173] [4.0/4.1 regression] miscompiled pointer subtraction broke Linux kernel
--- Additional Comments From jakub at gcc dot gnu dot org 2005-04-25 14:49 --- Are you going to commit the testcase to the branch as well? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21173
[Bug tree-optimization/21173] [4.0/4.1 regression] miscompiled pointer subtraction broke Linux kernel
--- Additional Comments From dberlin at gcc dot gnu dot org 2005-04-25 15:18 --- Subject: Re: [4.0/4.1 regression] miscompiled pointer subtraction broke Linux kernel On Mon, 2005-04-25 at 14:49 +, jakub at gcc dot gnu dot org wrote: > --- Additional Comments From jakub at gcc dot gnu dot org 2005-04-25 > 14:49 --- > Are you going to commit the testcase to the branch as well? > > Yes i'm waiting for a lock -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21173
[Bug tree-optimization/21173] [4.0/4.1 regression] miscompiled pointer subtraction broke Linux kernel
--- Additional Comments From dberlin at gcc dot gnu dot org 2005-04-26 12:35 --- Fixed -- What|Removed |Added Status|ASSIGNED|RESOLVED Resolution||FIXED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21173
[Bug tree-optimization/21173] [4.0/4.1 regression] miscompiled pointer subtraction broke Linux kernel
--- Additional Comments From belyshev at depni dot sinp dot msu dot ru 2005-04-28 02:34 --- *** Bug 21248 has been marked as a duplicate of this bug. *** -- What|Removed |Added CC||pete at flooble dot net http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21173
[Bug tree-optimization/21173] [4.0/4.1 regression] miscompiled pointer subtraction broke Linux kernel
--- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-04-28 23:38 --- Subject: Bug 21173 CVSROOT:/cvs/gcc Module name:gcc Branch: apple-local-200502-branch Changes by: [EMAIL PROTECTED] 2005-04-28 23:38:11 Modified files: gcc: ChangeLog.apple-ppc tree-ssa-pre.c Log message: 2005-04-28 Dale Johannesen <[EMAIL PROTECTED]> Radar 4100712 (PR 21173, Dan Berlin's patch) * tree-ssa-pre.c (create_expression_by_pieces): Call unshare_expr on things we pass to force_gimple_operand. Don't try to special case min_invariants. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.apple-ppc.diff?cvsroot=gcc&only_with_tag=apple-local-200502-branch&r1=1.1.4.53&r2=1.1.4.54 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-ssa-pre.c.diff?cvsroot=gcc&only_with_tag=apple-local-200502-branch&r1=2.64.2.2&r2=2.64.2.3 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21173
[Bug tree-optimization/21173] [4.0/4.1 regression] miscompiled pointer subtraction broke Linux kernel
--- Additional Comments From pinskia at gcc dot gnu dot org 2005-05-10 17:32 --- *** Bug 21482 has been marked as a duplicate of this bug. *** -- What|Removed |Added CC||Tobias dot Kranz at bka dot ||bund dot de http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21173
[Bug tree-optimization/21173] [4.0/4.1 regression] miscompiled pointer subtraction broke Linux kernel
--- Additional Comments From pinskia at gcc dot gnu dot org 2005-05-10 22:31 --- *** Bug 21505 has been marked as a duplicate of this bug. *** -- What|Removed |Added CC||pbriggs at clinitech dot net http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21173
[Bug tree-optimization/21173] [4.0/4.1 regression] miscompiled pointer subtraction broke Linux kernel
--- Additional Comments From pinskia at gcc dot gnu dot org 2005-05-11 10:51 --- *** Bug 21511 has been marked as a duplicate of this bug. *** -- What|Removed |Added CC||nkukard at lbsd dot net http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21173
[Bug tree-optimization/21173] [4.0/4.1 regression] miscompiled pointer subtraction broke Linux kernel
--- Additional Comments From pinskia at gcc dot gnu dot org 2005-05-17 11:34 --- *** Bug 21618 has been marked as a duplicate of this bug. *** -- What|Removed |Added CC||andreas at florath dot net http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21173
[Bug tree-optimization/21173] [4.0/4.1 regression] miscompiled pointer subtraction broke Linux kernel
--- Additional Comments From pinskia at gcc dot gnu dot org 2005-05-18 06:04 --- *** Bug 21640 has been marked as a duplicate of this bug. *** -- What|Removed |Added CC||arjones at simultan dot ||dyndns dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21173
[Bug tree-optimization/21173] [4.0/4.1 regression] miscompiled pointer subtraction broke Linux kernel
--- Additional Comments From pinskia at gcc dot gnu dot org 2005-05-22 18:47 --- *** Bug 21711 has been marked as a duplicate of this bug. *** -- What|Removed |Added CC||terry-palmer at btconnect ||dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21173
[Bug tree-optimization/21173] [4.0/4.1 regression] miscompiled pointer subtraction broke Linux kernel
--- Additional Comments From pinskia at gcc dot gnu dot org 2005-06-12 13:24 --- *** Bug 22032 has been marked as a duplicate of this bug. *** -- What|Removed |Added CC||pb at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21173
[Bug tree-optimization/21173] [4.0/4.1 regression] miscompiled pointer subtraction broke Linux kernel
--- Comment #39 from pinskia at gcc dot gnu dot org 2006-03-22 20:54 --- *** Bug 26811 has been marked as a duplicate of this bug. *** -- pinskia at gcc dot gnu dot org changed: What|Removed |Added CC||cprincipato at dialamerica ||dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21173
[Bug tree-optimization/21173] [4.0/4.1 regression] miscompiled pointer subtraction broke Linux kernel
--- Comment #40 from pinskia at gcc dot gnu dot org 2006-03-28 17:40 --- *** Bug 26903 has been marked as a duplicate of this bug. *** -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21173