diff options
| author | Nicolai Stange <nicstange@gmail.com> | 2016-02-01 03:40:42 +0100 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2017-03-31 02:27:12 +0200 |
| commit | fa1c8068099cf4f7a555f2a4055adc4e4ceafccb (patch) | |
| tree | 27064a16d6cdd25eda7d070af2f545ca9e3ae974 /evaluate.c | |
| parent | 950dd57c4e43248c8a4dac6595991df42a36c0f1 (diff) | |
| download | sparse-dev-fa1c8068099cf4f7a555f2a4055adc4e4ceafccb.tar.gz | |
constexpr: recognize members of static compound objects as address constants
According to 6.6(9), the member access operators "." and "->" may be used
in the creation of address constants.
Uses of both operators amount to the creation of EXPR_DEREF expressions
which are eventually fed into evaluate_offset() at evaluation.
Make evaluate_offset() propagate any address constant flag of the object
containing the referenced member to the newly created pointer addition
expression.
Signed-off-by: Nicolai Stange <nicstange@gmail.com>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'evaluate.c')
| -rw-r--r-- | evaluate.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -1962,6 +1962,12 @@ static struct expression *evaluate_offset(struct expression *expr, unsigned long * we ever take the address of this member dereference.. */ add->ctype = &lazy_ptr_ctype; + /* + * The resulting address of a member access through an address + * constant is an address constant again [6.6(9)]. + */ + add->flags = expr->flags; + return add; } |
