diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2019-12-08 17:09:54 +0100 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2019-12-10 23:26:23 +0100 |
| commit | 41ba12bf8e76ee2c69222c1c3dfb1a3d420a73d9 (patch) | |
| tree | 3443c2ddb58f39f20efea47d65931ed4925bf39c /validation/eval/addressable-degen.c | |
| parent | f9b443940a8515132035435d3b4fec232a26c582 (diff) | |
| download | sparse-dev-41ba12bf8e76ee2c69222c1c3dfb1a3d420a73d9.tar.gz | |
degenerated arrays & functions are addressable too
Symbols which have their address taken (with the 'addressof'
operator: &) are marked as such (with the modifier MOD_ADDRESSABLE).
But degenerated arrays and functions have their address implicitly
taken.
MOD_ADDRESSABLE is used to prevent to replace a symbol dereference
nto the value used to initialize to it. For example, in code like:
static int foo(void)
{
int x[2] = { 1, 2 };
return x[1];
}
the return expression can be replaced by 2. This is not the case
case if the array is first passed in a function call, like here:
extern void def(void *, unsigned int);
static int bar(void)
{
int x[2] = { 1, 2 };
def(x, sizeof(x));
return x[1];
}
Fix this by marking degenerated arrays (and functions) as also
being addressable.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation/eval/addressable-degen.c')
| -rw-r--r-- | validation/eval/addressable-degen.c | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/validation/eval/addressable-degen.c b/validation/eval/addressable-degen.c index e1dc5107..d420927e 100644 --- a/validation/eval/addressable-degen.c +++ b/validation/eval/addressable-degen.c @@ -11,7 +11,6 @@ static int bar(void) /* * check-name: eval/addressable-degen * check-command: test-linearize -fdump-ir $file - * check-known-to-fail * * check-output-ignore * check-output-contains: load\\. |
