diff options
Diffstat (limited to 'gcc/c-typeck.c')
| -rw-r--r-- | gcc/c-typeck.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index b06085d8c2c..85ba9ce58e2 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -2619,6 +2619,14 @@ build_unary_op (enum tree_code code, tree xarg, int flag) } 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); if (TREE_CODE (arg) == COMPOUND_LITERAL_EXPR) |

