Commit b0d75c1e by Brendan Kehoe Committed by Brendan Kehoe

typeck.c (build_indirect_ref): Heed FLAG_VOLATILE similar to c-typeck.c.

        * typeck.c (build_indirect_ref): Heed FLAG_VOLATILE similar to
        c-typeck.c.

From-SVN: r15197
parent ee89446f
1997-09-09 Brendan Kehoe <brendan@lisa.cygnus.com>
* typeck.c (build_indirect_ref): Heed FLAG_VOLATILE similar to
c-typeck.c.
Mon Sep 8 02:33:20 1997 Jody Goldberg <jodyg@idt.net> Mon Sep 8 02:33:20 1997 Jody Goldberg <jodyg@idt.net>
* decl.c (current_local_enum): Remove static. * decl.c (current_local_enum): Remove static.
......
...@@ -2048,6 +2048,7 @@ build_indirect_ref (ptr, errorstring) ...@@ -2048,6 +2048,7 @@ build_indirect_ref (ptr, errorstring)
if (TREE_CODE (type) == POINTER_TYPE || TREE_CODE (type) == REFERENCE_TYPE) if (TREE_CODE (type) == POINTER_TYPE || TREE_CODE (type) == REFERENCE_TYPE)
{ {
if (TREE_CODE (pointer) == ADDR_EXPR if (TREE_CODE (pointer) == ADDR_EXPR
&& !flag_volatile
&& (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (pointer, 0))) && (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (pointer, 0)))
== TYPE_MAIN_VARIANT (TREE_TYPE (type))) == TYPE_MAIN_VARIANT (TREE_TYPE (type)))
&& (TREE_READONLY (TREE_OPERAND (pointer, 0)) && (TREE_READONLY (TREE_OPERAND (pointer, 0))
...@@ -2061,10 +2062,13 @@ build_indirect_ref (ptr, errorstring) ...@@ -2061,10 +2062,13 @@ build_indirect_ref (ptr, errorstring)
register tree ref = build1 (INDIRECT_REF, register tree ref = build1 (INDIRECT_REF,
TYPE_MAIN_VARIANT (t), pointer); TYPE_MAIN_VARIANT (t), pointer);
/* We *must* set TREE_READONLY when dereferencing a pointer to const,
so that we get the proper error message if the result is used
to assign to. Also, &* is supposed to be a no-op. */
TREE_READONLY (ref) = TYPE_READONLY (t); TREE_READONLY (ref) = TYPE_READONLY (t);
TREE_THIS_VOLATILE (ref) = TYPE_VOLATILE (t);
TREE_SIDE_EFFECTS (ref) TREE_SIDE_EFFECTS (ref)
= TYPE_VOLATILE (t) || TREE_SIDE_EFFECTS (pointer); = TYPE_VOLATILE (t) || TREE_SIDE_EFFECTS (pointer) || flag_volatile;
TREE_THIS_VOLATILE (ref) = TYPE_VOLATILE (t);
return ref; return ref;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment