analyzer: fix ICE on casting float to pointer [PR96764]
authorDavid Malcolm <dmalcolm@redhat.com>
Thu, 27 Aug 2020 22:20:24 +0000 (18:20 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Mon, 31 Aug 2020 20:06:50 +0000 (16:06 -0400)
commitecdb93224c56189a129e97c556fe6b78e1b15a63
tree6a4585b076cd707a9f943b7487fa129abe089cb2
parentd503cd98713a41aad34ade2b9b0d9973efb21e11
analyzer: fix ICE on casting float to pointer [PR96764]

gcc/analyzer/ChangeLog:
PR analyzer/96764
* region-model-manager.cc
(region_model_manager::maybe_fold_unaryop): Handle VIEW_CONVERT_EXPR.
(region_model_manager::get_or_create_cast): Move logic for
real->integer casting to...
(get_code_for_cast): ...this new function, and add logic for
real->non-integer casts.
(region_model_manager::maybe_fold_sub_svalue): Handle
VIEW_CONVERT_EXPR.
* region-model.cc
(region_model::add_any_constraints_from_gassign): Likewise.
* svalue.cc (svalue::maybe_undo_cast): Likewise.
(unaryop_svalue::dump_to_pp): Likewise.

gcc/testsuite/ChangeLog:
PR analyzer/96764
* gcc.dg/analyzer/pr96764.c: New test.
gcc/analyzer/region-model-manager.cc
gcc/analyzer/region-model.cc
gcc/analyzer/svalue.cc
gcc/testsuite/gcc.dg/analyzer/pr96764.c [new file with mode: 0644]