6 Sep 23:11
Odd behaviour with OP_SCAST
From: David Given <dg <at> cowlark.com>
Subject: Odd behaviour with OP_SCAST
Newsgroups: gmane.comp.parsers.sparse
Date: 2008-09-06 21:14:36 GMT
Subject: Odd behaviour with OP_SCAST
Newsgroups: gmane.comp.parsers.sparse
Date: 2008-09-06 21:14:36 GMT
test-unssa.c compiles this:
extern void func(int i, ...);
void foo(int i) { func(0, (float) i, (double) i, i); }
...into this:
fpcast.64 %r3 <- (32) %arg1
scast.64 %r5 <- (32) %arg1
call func, $0, %r3, %r5, %arg1
ret
That's with the default settings. Unfortunately, with Clue,
sizeof(double) == sizeof(int), so that second instruction comes out as:
scast.32 %r5 <- (32) %arg1
This then causes the simplification code in simplify_cast() to discard it:
if (size == orig_size) {
int op = (orig_type->ctype.modifiers & MOD_SIGNED) ? OP_SCAST : OP_CAST;
if (insn->opcode == op)
goto simplify;
}
The end result is that my call statement turns into:
call func, $0, %r3, %arg1, %arg1
...which is wrong.
(Continue reading)
RSS Feed