diff options
| -rw-r--r-- | linearize.c | 3 | ||||
| -rw-r--r-- | validation/fp-vs-ptrcast.c | 13 |
2 files changed, 14 insertions, 2 deletions
diff --git a/linearize.c b/linearize.c index 5199b6b0..ae8640a9 100644 --- a/linearize.c +++ b/linearize.c @@ -1118,8 +1118,7 @@ static struct instruction *alloc_cast_instruction(struct symbol *src, struct sym base = base->ctype.base_type; if (base != &void_ctype) opcode = OP_PTRCAST; - } - if (base->ctype.base_type == &fp_type) + } else if (base->ctype.base_type == &fp_type) opcode = OP_FPCAST; return alloc_typed_instruction(opcode, ctype); } diff --git a/validation/fp-vs-ptrcast.c b/validation/fp-vs-ptrcast.c new file mode 100644 index 00000000..817aee5c --- /dev/null +++ b/validation/fp-vs-ptrcast.c @@ -0,0 +1,13 @@ +float *f01(void* p) +{ + return p; +} + +/* + * check-name: fp-vs-ptrcast + * check-command: test-linearize -Wno-decl $file + * check-output-ignore + * + * check-output-excludes: fpcast + * check-output-contains: ptrcast + */ |
