summaryrefslogtreecommitdiff
path: root/gcc/varasm.c
diff options
context:
space:
mode:
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>1994-03-01 23:33:22 +0000
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>1994-03-01 23:33:22 +0000
commit81d7051e96f93dd60d6018ec2891c077d09e57d3 (patch)
tree3cebe1786de1fa19fdfc1350f89f369cb020005c /gcc/varasm.c
parent3a5390f6ebf2549d9ff5325b06a16b3a2a7807da (diff)
downloadgcc-81d7051e96f93dd60d6018ec2891c077d09e57d3.tar.gz
(output_constant): Strip off some NOP_EXPRs before further processing.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@6683 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r--gcc/varasm.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c
index d4576f817fc..89c1bbadc9c 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -3323,6 +3323,17 @@ output_constant (exp, size)
if (size == 0)
return;
+ /* Eliminate the NON_LVALUE_EXPR_EXPR that makes a cast not be an lvalue.
+ That way we get the constant (we hope) inside it. Also, strip
+ off any NOP_EXPR that converts between two record or union types. */
+ while ((TREE_CODE (exp) == NOP_EXPR
+ && (TREE_TYPE (exp) == TREE_TYPE (TREE_OPERAND (exp, 0))
+ || TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE
+ || TREE_CODE (TREE_TYPE (exp)) == UNION_TYPE
+ || TREE_CODE (TREE_TYPE (exp)) == QUAL_UNION_TYPE))
+ || TREE_CODE (exp) == NON_LVALUE_EXPR)
+ exp = TREE_OPERAND (exp, 0);
+
/* Allow a constructor with no elements for any data type.
This means to fill the space with zeros. */
if (TREE_CODE (exp) == CONSTRUCTOR && CONSTRUCTOR_ELTS (exp) == 0)
@@ -3334,12 +3345,6 @@ output_constant (exp, size)
return;
}
- /* Eliminate the NOP_EXPR that makes a cast not be an lvalue.
- That way we get the constant (we hope) inside it. */
- if (TREE_CODE (exp) == NOP_EXPR
- && TREE_TYPE (exp) == TREE_TYPE (TREE_OPERAND (exp, 0)))
- exp = TREE_OPERAND (exp, 0);
-
switch (code)
{
case CHAR_TYPE: