diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2017-03-05 12:20:37 +0100 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2017-11-17 10:04:36 +0100 |
| commit | e39241c956b801728e9c4b60a8b2da6a0116c634 (patch) | |
| tree | 953aa69db32a819f0ac5b41f067b6ce3b89802c0 /validation/backend | |
| parent | 36fdd6e4ee4a3181ce47d885f818a3d15ad3f905 (diff) | |
| download | sparse-dev-e39241c956b801728e9c4b60a8b2da6a0116c634.tar.gz | |
llvm: fix output_op_store() which modify its operand
In sparse-llvm the field 'priv' of a pseudo is used to store
the corresponding LLVMValueRef. This field is normaly assigned
when processing the instruction that produces the speudo.
In output_op_store(), the field insn->target->priv is overwritten
by the LLVMValueRef returned by LLVMBuildStore().
It's unclear what this return value is:
- this corrupts the pseudo, making it unusable in subsequent
instructions.
- there is no reason to change this field anyway.
Fix this by removing the assignment to insn->target->priv
in output_op_store().
Reported-by: Dibyendu Majumdar <mobile@majumdar.org.uk>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation/backend')
| -rw-r--r-- | validation/backend/store-x2.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/validation/backend/store-x2.c b/validation/backend/store-x2.c new file mode 100644 index 00000000..5ccc9b43 --- /dev/null +++ b/validation/backend/store-x2.c @@ -0,0 +1,16 @@ +void foo(int *p, int a, int b); +void foo(int *p, int a, int b) +{ + int c = a + b; + + p[0] = c; + p[1] = c; +} + +/* + * check-name: store-x2 + * check-command: sparsec -c $file -o tmp.o + * check-description: Verify in output_op_store() that + * the first store doesn't mess anymore with the + * 'target' and thus making the second store unusable. + */ |
