Bug 35403 - ipa-reference.c does not change a default initialized static variable to be readonly
Summary: ipa-reference.c does not change a default initialized static variable to be r...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.3.0
: P3 enhancement
Target Milestone: 4.4.0
Assignee: Andrew Pinski
URL:
Keywords: missed-optimization
Depends on: 35402
Blocks:
  Show dependency treegraph
 
Reported: 2008-02-28 22:26 UTC by Andrew Pinski
Modified: 2008-03-11 21:08 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2008-02-28 22:26:51


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Pinski 2008-02-28 22:26:35 UTC
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.
Comment 1 Andrew Pinski 2008-02-28 22:26:51 UTC
Mine.
Comment 2 Andrew Pinski 2008-03-06 22:22:44 UTC
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.
Comment 3 Andrew Pinski 2008-03-11 21:08:21 UTC
Fixed.
Comment 4 Andrew Pinski 2008-03-11 21:08:52 UTC
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