Testcase: /* { dg-do compile } */ /* { dg-options "-O2 -fdump-tree-optimized" } */ static int conststaticvariable; int f(void) { return conststaticvariable; } /* There should be no reference to conststaticvariable as we should have inlined the 0 as IPA reference should have marked the variable as a const as it is not set in the IR. */ /* { dg-final { scan-tree-dump-times "conststaticvariable" 0 "optimized"} } */ /* { dg-final { cleanup-tree-dump "optimized" } } */ This depends on the fix for PR 35402 to be optimized fully.
Mine.
Actually this is already fixed with my patch for PR 35402, the code that sets module_statics_const is dead code which I will remove.
Fixed.
Subject: Bug 35403 Author: pinskia Date: Tue Mar 11 21:08:00 2008 New Revision: 133119 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=133119 Log: 2008-03-11 Andrew Pinski <andrew_pinski@playstation.sony.com> * ipa-reference.c (static_execute): Remove module_statics_const and associated setting code. 2008-03-11 Andrew Pinski <andrew_pinski@playstation.sony.com> PR tree-opt/35403 * gcc.dg/tree-ssa/ipa-reference-1.c: New testcase. Added: trunk/gcc/testsuite/gcc.dg/tree-ssa/ipa-reference-1.c Modified: trunk/gcc/ChangeLog trunk/gcc/ipa-reference.c trunk/gcc/testsuite/ChangeLog