Commit 5e55f99d by Richard Henderson Committed by Richard Henderson

re PR c/17396 (ICE in tree-int-cst at -O0)

        PR c/17396
        * c-typeck.c (build_unary_op): Add legacy offsetof hack.

From-SVN: r87351
parent c535fc9f
2004-09-11 Richard Henderson <rth@redhat.com>
PR c/17396
* c-typeck.c (build_unary_op): Add legacy offsetof hack.
2004-09-11 Kazu Hirata <kazu@cs.umass.edu> 2004-09-11 Kazu Hirata <kazu@cs.umass.edu>
* doc/cfg.texi, doc/hostconfig.texi, doc/install.texi, * doc/cfg.texi, doc/hostconfig.texi, doc/install.texi,
......
...@@ -2619,6 +2619,14 @@ build_unary_op (enum tree_code code, tree xarg, int flag) ...@@ -2619,6 +2619,14 @@ build_unary_op (enum tree_code code, tree xarg, int flag)
} }
argtype = build_pointer_type (argtype); argtype = build_pointer_type (argtype);
/* ??? Cope with user tricks that amount to offsetof. Delete this
when we have proper support for integer constant expressions. */
val = get_base_address (arg);
if (val && TREE_CODE (val) == INDIRECT_REF
&& integer_zerop (TREE_OPERAND (val, 0)))
return fold_convert (argtype, fold_offsetof (arg));
val = build1 (ADDR_EXPR, argtype, arg); val = build1 (ADDR_EXPR, argtype, arg);
if (TREE_CODE (arg) == COMPOUND_LITERAL_EXPR) if (TREE_CODE (arg) == COMPOUND_LITERAL_EXPR)
......
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