diff options
author | Richard Biener <rguenther@suse.de> | 2021-11-16 11:47:26 +0100 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2021-11-19 09:35:57 +0100 |
commit | fb15abdc9b61a0b7fa24a37f85d19dc449cfd5bf (patch) | |
tree | 627582ad67e37ad59b162f1af7ab6c808a9de018 /gcc/tree-eh.c | |
parent | 0fc859f5efcb4624a8b4ffdbf34d63972af179a8 (diff) | |
download | gcc-fb15abdc9b61a0b7fa24a37f85d19dc449cfd5bf.zip gcc-fb15abdc9b61a0b7fa24a37f85d19dc449cfd5bf.tar.gz gcc-fb15abdc9b61a0b7fa24a37f85d19dc449cfd5bf.tar.bz2 |
middle-end/103248 - fix RDIV_EXPR handling with fixed point
This fixes the previous adjustment to operation_could_trap_helper_p
where I failed to realize that RDIV_EXPR is also used for
fixed-point types. It also fixes that handling by properly
checking for a fixed_zerop divisor.
2021-11-16 Richard Biener <rguenther@suse.de>
PR middle-end/103248
* tree-eh.c (operation_could_trap_helper_p): Properly handle
fixed-point RDIV_EXPR.
* gcc.dg/pr103248.c: New testcase.
Diffstat (limited to 'gcc/tree-eh.c')
-rw-r--r-- | gcc/tree-eh.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c index 3eff07f..916da85 100644 --- a/gcc/tree-eh.c +++ b/gcc/tree-eh.c @@ -2474,10 +2474,16 @@ operation_could_trap_helper_p (enum tree_code op, return false; case RDIV_EXPR: - if (honor_snans) + if (fp_operation) + { + if (honor_snans) + return true; + return flag_trapping_math; + } + /* Fixed point operations also use RDIV_EXPR. */ + if (!TREE_CONSTANT (divisor) || fixed_zerop (divisor)) return true; - gcc_assert (fp_operation); - return flag_trapping_math; + return false; case LT_EXPR: case LE_EXPR: |