diff options
| author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-09-11 17:02:58 +0000 |
|---|---|---|
| committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-09-11 17:02:58 +0000 |
| commit | 3ce29533a61b3fbcdb26feb817e8a3eeeb9ba837 (patch) | |
| tree | f24eb1496a9bacda9a64bbf7f5889f72d538631f /gcc | |
| parent | e5f091e32ebd1542e3711b99b82129fbf0b4638c (diff) | |
| download | ppe42-gcc-3ce29533a61b3fbcdb26feb817e8a3eeeb9ba837.tar.gz ppe42-gcc-3ce29533a61b3fbcdb26feb817e8a3eeeb9ba837.zip | |
PR c/17396
* c-typeck.c (build_unary_op): Add legacy offsetof hack.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@87351 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
| -rw-r--r-- | gcc/ChangeLog | 5 | ||||
| -rw-r--r-- | gcc/c-typeck.c | 8 |
2 files changed, 13 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 48e06ce9e60..2e4b04a750e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +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> * doc/cfg.texi, doc/hostconfig.texi, doc/install.texi, 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) |

