public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/pheeck/heads/sccp)] analyzer: fix ICE on 'bind' that returns a struct [PR107788]
@ 2023-02-15 10:18 Filip Kastl
0 siblings, 0 replies; only message in thread
From: Filip Kastl @ 2023-02-15 10:18 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:0306d532ad2f572ed6c4533a286afa67b51a89e9
commit 0306d532ad2f572ed6c4533a286afa67b51a89e9
Author: David Malcolm <dmalcolm@redhat.com>
Date: Mon Nov 21 19:08:18 2022 -0500
analyzer: fix ICE on 'bind' that returns a struct [PR107788]
gcc/analyzer/ChangeLog:
PR analyzer/107788
* region-model.cc (region_model::update_for_int_cst_return):
Require that the return type be an integer type.
(region_model::update_for_nonzero_return): Likewise.
gcc/testsuite/ChangeLog:
PR analyzer/107788
* g++.dg/analyzer/fd-bind-pr107783.C: New test.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Diff:
---
gcc/analyzer/region-model.cc | 4 ++++
gcc/testsuite/g++.dg/analyzer/fd-bind-pr107783.C | 11 +++++++++++
2 files changed, 15 insertions(+)
diff --git a/gcc/analyzer/region-model.cc b/gcc/analyzer/region-model.cc
index 1d5b09a6805..e71fd41f62d 100644
--- a/gcc/analyzer/region-model.cc
+++ b/gcc/analyzer/region-model.cc
@@ -1930,6 +1930,8 @@ region_model::update_for_int_cst_return (const call_details &cd,
{
if (!cd.get_lhs_type ())
return;
+ if (TREE_CODE (cd.get_lhs_type ()) != INTEGER_TYPE)
+ return;
const svalue *result
= m_mgr->get_or_create_int_cst (cd.get_lhs_type (), retval);
if (unmergeable)
@@ -1955,6 +1957,8 @@ region_model::update_for_nonzero_return (const call_details &cd)
{
if (!cd.get_lhs_type ())
return;
+ if (TREE_CODE (cd.get_lhs_type ()) != INTEGER_TYPE)
+ return;
const svalue *zero
= m_mgr->get_or_create_int_cst (cd.get_lhs_type (), 0);
const svalue *result
diff --git a/gcc/testsuite/g++.dg/analyzer/fd-bind-pr107783.C b/gcc/testsuite/g++.dg/analyzer/fd-bind-pr107783.C
new file mode 100644
index 00000000000..eb5e23c82cf
--- /dev/null
+++ b/gcc/testsuite/g++.dg/analyzer/fd-bind-pr107783.C
@@ -0,0 +1,11 @@
+// { dg-do compile { target c++11 } }
+
+struct minus {
+} _1;
+int _2;
+struct _Bind {
+ _Bind(_Bind &);
+};
+template <typename _Func, typename _BoundArgs>
+_Bind bind(_Func, _BoundArgs &&...);
+void test01() { bind(minus(), _2, _1); }
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-02-15 10:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-15 10:18 [gcc(refs/users/pheeck/heads/sccp)] analyzer: fix ICE on 'bind' that returns a struct [PR107788] Filip Kastl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).