diff options
author | Martin Liska <mliska@suse.cz> | 2020-10-15 14:57:31 +0200 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2020-10-16 09:42:40 +0200 |
commit | a86623902767122c71c7229150a8b8a79cbb3673 (patch) | |
tree | 3bb430a6592c2b7ba9d37912eb38eb6b486d35b6 /gcc | |
parent | 23a9215f3e68ad91b81e951f09b564c4bc89033c (diff) | |
download | gcc-a86623902767122c71c7229150a8b8a79cbb3673.zip gcc-a86623902767122c71c7229150a8b8a79cbb3673.tar.gz gcc-a86623902767122c71c7229150a8b8a79cbb3673.tar.bz2 |
IPA: compare VRP types.
gcc/ChangeLog:
PR ipa/97404
* ipa-prop.c (struct ipa_vr_ggc_hash_traits):
Compare types of VRP as we can merge ranges of different types.
gcc/testsuite/ChangeLog:
PR ipa/97404
* gcc.c-torture/execute/pr97404.c: New test.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ipa-prop.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/pr97404.c | 28 |
2 files changed, 30 insertions, 1 deletions
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index 63c652f..a848f1d 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -123,7 +123,8 @@ struct ipa_vr_ggc_hash_traits : public ggc_cache_remove <value_range *> static bool equal (const value_range *a, const value_range *b) { - return a->equal_p (*b); + return (a->equal_p (*b) + && types_compatible_p (a->type (), b->type ())); } static const bool empty_zero_p = true; static void diff --git a/gcc/testsuite/gcc.c-torture/execute/pr97404.c b/gcc/testsuite/gcc.c-torture/execute/pr97404.c new file mode 100644 index 0000000..7e5ce23 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr97404.c @@ -0,0 +1,28 @@ +/* PR ipa/97404 */ +/* { dg-additional-options "-fno-inline" } */ + +char a, b; +long c; +short d, e; +long *f = &c; +int g; +char h(signed char i) { return 0; } +static short j(short i, int k) { return i < 0 ? 0 : i >> k; } +void l(void); +void m(void) +{ + e = j(d | 9766, 11); + *f = e; +} +void l(void) +{ + a = 5 | g; + b = h(a); +} +int main() +{ + m(); + if (c != 4) + __builtin_abort(); + return 0; +} |