From 1b0d2d1789a669d5dfcb5fa7760ff9fb70dc72c2 Mon Sep 17 00:00:00 2001 From: Josh Conner Date: Fri, 26 Aug 2005 22:42:44 +0000 Subject: [PATCH] re PR tree-optimization/23584 (ipa-pure-const pass ignores dereferencing a volatile pointer type) PR middle-end/23584 * ipa-pure-const.c (check_tree): Check for volatile-ness when considering a dereference. From-SVN: r103546 --- gcc/ChangeLog | 6 ++++++ gcc/ipa-pure-const.c | 13 +++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b2643c29516..cc3117c92da 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2005-08-26 Josh Conner + + PR middle-end/23584 + * ipa-pure-const.c (check_tree): Check for volatile-ness + when considering a dereference. + 2005-08-27 Jakub Jelinek * rtl.h (MEM_IN_STRUCT_P): Fix comment typo. diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c index 0b659a0aee6..c60383118f2 100644 --- a/gcc/ipa-pure-const.c +++ b/gcc/ipa-pure-const.c @@ -182,13 +182,14 @@ check_tree (funct_state local, tree t, bool checking_write) /* Any indirect reference that occurs on the lhs disqualifies the function from being pure or const. Any - indirect reference that occurs on the rhs disqualifies - the function from being const. */ - if (checking_write) + indirect reference to a volatile disqualifies the + function from being pure or const. Any indirect + reference that occurs on the rhs disqualifies the + function from being const. */ + if (checking_write || TREE_THIS_VOLATILE (t)) local->pure_const_state = IPA_NEITHER; - else - if (local->pure_const_state == IPA_CONST) - local->pure_const_state = IPA_PURE; + else if (local->pure_const_state == IPA_CONST) + local->pure_const_state = IPA_PURE; } if (SSA_VAR_P (t)) -- 2.30.2