For the testcase: /home/razya/mainline_new_3/gcc/gcc/testsuite/gcc.c-torture/execute/20021111-1.c, when using fipa-cp, a new vfersion is created for aim_callhandler(). the static variable is copied twice into the unexpanded_var_list of the versioned function. Looking at this test, even without enabling ipa-cp, the local variables multiplies after inlining.(as shown in the dump below) For example : in 20021111-1.c.t23.alias1: aim_callhandler (sess, conn, family, type) { int D.1449; int sess; int conn; short unsigned int family; short unsigned int type; static int i = 0; int D.1457; int D.1456; int i.0; int D.1458; int D.1449; int D.1435; int sess; int conn; short unsigned int family; short unsigned int type; static int i = 0; int D.1443; int D.1442; int i.0; int D.1444; int D.1435; int D.1421; int sess; int conn; short unsigned int family; short unsigned int type; static int i = 0; int D.1429; int D.1428; int i.0; int D.1430; int D.1421; int D.1407; int sess; int conn; short unsigned int family; short unsigned int type; static int i = 0; int D.1415; int D.1414; int i.0;
try dumping with -fdump-tree-*-uid, they are probably different copies. You can try http://gcc.gnu.org/ml/gcc-patches/2005-08/msg00314.html to avoid having unused versions dumped.
(In reply to comment #1) > try dumping with -fdump-tree-*-uid, they are probably different copies. You > can > try http://gcc.gnu.org/ml/gcc-patches/2005-08/msg00314.html to avoid having > unused versions dumped. It doesn't help. The decls are actually inserted to unexpanded_var_list more than once by the inliner. Thanks.
Testing patch
Subject: Bug number PR tree-optimization/24888 A patch for this bug has been added to the patch tracker. The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-07/msg00981.html
Subject: Bug 24888 Author: hubicka Date: Fri Aug 4 17:03:32 2006 New Revision: 115927 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=115927 Log: PR tree-optimization/24888 * tree-inline.c (expand_call_inline): Do not re-record variables. (declare_inline_vars): Add variable to unexpanded_var_list. Modified: trunk/gcc/ChangeLog trunk/gcc/tree-inline.c
patch applied, fixed?
fixed.
Subject: Bug number PR tree-optimization/24888 A patch for this bug has been added to the patch tracker. The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-08/msg00717.html