diff options
| author | Thomas Preud'homme <robotux@celest.fr> | 2013-12-31 23:40:21 +0800 |
|---|---|---|
| committer | Thomas Preud'homme <robotux@celest.fr> | 2014-01-03 10:19:38 +0800 |
| commit | e0e9a2a29562ac0f07c5d29070e1797fa48b144f (patch) | |
| tree | f0ef686163ef61eb5a0df8c7aa4ed119f193d5f5 /i386-gen.c | |
| parent | 59b8007f98eb814f6fd19455ab868ecaa07dfc0d (diff) | |
| download | tinycc-e0e9a2a29562ac0f07c5d29070e1797fa48b144f.tar.gz tinycc-e0e9a2a29562ac0f07c5d29070e1797fa48b144f.tar.bz2 | |
Report error on NaN comparison
Use comisd / fcompp for float comparison (except TOK_EQ and TOK_NE)
instead of ucomisd / fucompp to detect NaN comparison.
Thanks Vincent Lefèvre for the bug report and for also giving the
solution.
Diffstat (limited to 'i386-gen.c')
| -rw-r--r-- | i386-gen.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -895,7 +895,10 @@ ST_FUNC void gen_opf(int op) swapped = 0; if (swapped) o(0xc9d9); /* fxch %st(1) */ - o(0xe9da); /* fucompp */ + if (op == TOK_EQ || op == TOK_NE) + o(0xe9da); /* fucompp */ + else + o(0xd9de); /* fcompp */ o(0xe0df); /* fnstsw %ax */ if (op == TOK_EQ) { o(0x45e480); /* and $0x45, %ah */ |
