diff options
| author | David Malcolm <dmalcolm@redhat.com> | 2026-02-09 23:14:22 -0500 |
|---|---|---|
| committer | David Malcolm <dmalcolm@redhat.com> | 2026-02-09 23:14:22 -0500 |
| commit | c4c747adc8959d8cfea538789a9134fc143cc05f (patch) | |
| tree | dbde96ee93413f61342f04a20caf5f0590afd52f | |
| parent | bf2657d9d45e50c4eb82da3f6f8d9d26e288890f (diff) | |
| download | gcc-trunk.zip gcc-trunk.tar.gz gcc-trunk.tar.bz2 | |
gcc/analyzer/ChangeLog:
PR analyzer/113496
* constraint-manager.cc (cmp_types): New.
(bounded_range::cmp): Compare the types of the constants, as well
as their values.
gcc/testsuite/ChangeLog:
PR analyzer/113496
* gcc.dg/analyzer/ice-pr113496.c: New test.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
| -rw-r--r-- | gcc/analyzer/constraint-manager.cc | 21 | ||||
| -rw-r--r-- | gcc/testsuite/gcc.dg/analyzer/ice-pr113496.c | 21 |
2 files changed, 39 insertions, 3 deletions
diff --git a/gcc/analyzer/constraint-manager.cc b/gcc/analyzer/constraint-manager.cc index 738ac28..22b8d40 100644 --- a/gcc/analyzer/constraint-manager.cc +++ b/gcc/analyzer/constraint-manager.cc @@ -512,13 +512,28 @@ bounded_range::operator== (const bounded_range &other) const && tree_int_cst_equal (m_upper, other.m_upper)); } +static int +cmp_types (const_tree type1, const_tree type2) +{ + int t1 = TYPE_UID (type1); + int t2 = TYPE_UID (type2); + return t1 - t2; +} + int bounded_range::cmp (const bounded_range &br1, const bounded_range &br2) { - if (int cmp_lower = tree_int_cst_compare (br1.m_lower, - br2.m_lower)) + if (int cmp_lower = tree_int_cst_compare (br1.m_lower, br2.m_lower)) return cmp_lower; - return tree_int_cst_compare (br1.m_upper, br2.m_upper); + if (int cmp_upper = tree_int_cst_compare (br1.m_upper, br2.m_upper)) + return cmp_upper; + if (int cmp_lower_type = cmp_types (TREE_TYPE (br1.m_lower), + TREE_TYPE (br2.m_lower))) + return cmp_lower_type; + if (int cmp_upper_type = cmp_types (TREE_TYPE (br1.m_upper), + TREE_TYPE (br2.m_upper))) + return cmp_upper_type; + return 0; } /* struct bounded_ranges. */ diff --git a/gcc/testsuite/gcc.dg/analyzer/ice-pr113496.c b/gcc/testsuite/gcc.dg/analyzer/ice-pr113496.c new file mode 100644 index 0000000..147228b --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/ice-pr113496.c @@ -0,0 +1,21 @@ +/* { dg-additional-options "-fdump-analyzer" } */ + +enum { PIPE_SWIZZLE_X, PIPE_SWIZZLE_Z, PIPE_SWIZZLE_W }; +enum { UTIL_FORMAT_COLORSPACE_YUV, UTIL_FORMAT_COLORSPACE_ZS } colorspace; +int util_format_colormask_descutil_format_colormask_colormask, + util_format_get_component_bits_component, + util_format_get_component_bits_desc_0_3_0; +void util_format_colormask_descutil_format_colormask() { + switch (colorspace) { + case UTIL_FORMAT_COLORSPACE_YUV: + util_format_colormask_descutil_format_colormask_colormask = 0; + for (;;) + case UTIL_FORMAT_COLORSPACE_ZS:; /* { dg-warning "infinite loop" } */ + } +} +unsigned util_format_get_component_bits() { + switch (util_format_get_component_bits_component) + case PIPE_SWIZZLE_X: + case PIPE_SWIZZLE_W: + return util_format_get_component_bits_desc_0_3_0; +} |
