This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/22000] [4.0/4.1 Regression] Read from volatile member of struct is optimized away
- From: "joseph at codesourcery dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 Jun 2005 16:59:33 -0000
- Subject: [Bug tree-optimization/22000] [4.0/4.1 Regression] Read from volatile member of struct is optimized away
- References: <20050610135925.22000.rpedersen@atmel.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From joseph at codesourcery dot com 2005-06-23 16:59 -------
Subject: Re: [4.0/4.1 Regression] Read from
volatile member of struct is optimized away
On Thu, 23 Jun 2005, mmitchel at gcc dot gnu dot org wrote:
> I somewhat suspect this hunk of code in c-typeck.c:build_component_ref:
>
> if (TREE_THIS_VOLATILE (datum) || TREE_THIS_VOLATILE (subdatum))
> TREE_THIS_VOLATILE (ref) = 1;
>
> I don't see anything that sets TREE_SIDE_EFFECTS.
In general TREE_SIDE_EFFECTS is set by the low-level tree-building code in
tree.c (if set for the operands of a tree) so front ends need only change
it if the defaults are wrong.
> If this bit is set in an expression, so is TREE_SIDE_EFFECTS. */
> #define TREE_THIS_VOLATILE(NODE) ((NODE)->common.volatile_flag)
This does seem like something tree checking could usefully be added for.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22000