diff options
author | David Malcolm <dmalcolm@redhat.com> | 2020-08-19 05:00:52 -0400 |
---|---|---|
committer | David Malcolm <dmalcolm@redhat.com> | 2020-08-19 15:24:42 -0400 |
commit | 366bd1ac01a5249a463e64234674ad2d174faa9a (patch) | |
tree | 8ff83e0de43597cebad2bcda620a4c28a3fb91fd /gcc/analyzer | |
parent | 07d456bb80a16405723c98c2ab74ccc2a5a23898 (diff) | |
download | gcc-366bd1ac01a5249a463e64234674ad2d174faa9a.zip gcc-366bd1ac01a5249a463e64234674ad2d174faa9a.tar.gz gcc-366bd1ac01a5249a463e64234674ad2d174faa9a.tar.bz2 |
analyzer: fix ICE converting float to int [PR96699]
gcc/analyzer/ChangeLog:
PR analyzer/96699
* region-model-manager.cc
(region_model_manager::get_or_create_cast): Use FIX_TRUNC_EXPR for
casting from REAL_TYPE to INTEGER_TYPE.
gcc/testsuite/ChangeLog:
PR analyzer/96699
* gcc.dg/analyzer/pr96699.c: New test.
Diffstat (limited to 'gcc/analyzer')
-rw-r--r-- | gcc/analyzer/region-model-manager.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/analyzer/region-model-manager.cc b/gcc/analyzer/region-model-manager.cc index 4faeaa5..0792574 100644 --- a/gcc/analyzer/region-model-manager.cc +++ b/gcc/analyzer/region-model-manager.cc @@ -396,6 +396,11 @@ region_model_manager::get_or_create_unaryop (tree type, enum tree_code op, const svalue * region_model_manager::get_or_create_cast (tree type, const svalue *arg) { + gcc_assert (type); + if (arg->get_type ()) + if (TREE_CODE (type) == INTEGER_TYPE + && TREE_CODE (arg->get_type ()) == REAL_TYPE) + return get_or_create_unaryop (type, FIX_TRUNC_EXPR, arg); return get_or_create_unaryop (type, NOP_EXPR, arg); } |