public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Andrew Macleod <amacleod@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-3640] Add testcases resolved with ranger as VRP1. Date: Thu, 3 Nov 2022 19:27:20 +0000 (GMT) [thread overview] Message-ID: <20221103192720.EF4803858423@sourceware.org> (raw) https://gcc.gnu.org/g:095de980339f2fe0ff2add112c4d5ab9175b8f58 commit r13-3640-g095de980339f2fe0ff2add112c4d5ab9175b8f58 Author: Andrew MacLeod <amacleod@redhat.com> Date: Thu Nov 3 13:07:33 2022 -0400 Add testcases resolved with ranger as VRP1. gcc/testsuite/ * g++.dg/pr99966.C: New. * gcc.dg/pr93917.c: New. * gcc.dg/pr102650.c: New. Diff: --- gcc/testsuite/g++.dg/pr99966.C | 23 +++++++++++++++++++++++ gcc/testsuite/gcc.dg/pr102650.c | 20 ++++++++++++++++++++ gcc/testsuite/gcc.dg/pr93917.c | 20 ++++++++++++++++++++ 3 files changed, 63 insertions(+) diff --git a/gcc/testsuite/g++.dg/pr99966.C b/gcc/testsuite/g++.dg/pr99966.C new file mode 100644 index 00000000000..4d689822b87 --- /dev/null +++ b/gcc/testsuite/g++.dg/pr99966.C @@ -0,0 +1,23 @@ +// { dg-do compile } +// { dg-require-effective-target c++17 } +// { dg-options "-O2 -fdump-tree-vrp1" } + +// Test we can remove a range bound after the assert. + +#include <cassert> +#include <cstdint> +#include <cstddef> +#include <vector> + +uint64_t f(std::vector<uint64_t>& data, size_t start, size_t end){ + assert(start < end && start < data.size() && end <= data.size()); + + + uint64_t total = 0; + for (size_t i = start; i < end; i++) { + total += data.at(i); + } + return total; +} + +/* { dg-final { scan-tree-dump-not "throw" "vrp1"} } */ diff --git a/gcc/testsuite/gcc.dg/pr102650.c b/gcc/testsuite/gcc.dg/pr102650.c new file mode 100644 index 00000000000..16ae840260f --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr102650.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -fdump-tree-vrp1" } */ + +static int a = 2, b, c, d; +void foo(void); +int main() { + short e; + int f = -1; + if (b) + c = 0; + c || (f = 2); + for (; d < 1; d++) + e = f + a; + if (!e) + foo(); + return 0; +} + +/* { dg-final { scan-tree-dump-not "foo" "vrp1" } } */ + diff --git a/gcc/testsuite/gcc.dg/pr93917.c b/gcc/testsuite/gcc.dg/pr93917.c new file mode 100644 index 00000000000..41d27fb9a8f --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr93917.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-vrp1" } */ + +void f3(int n); + +void f1(int n) +{ + if(n<0) + __builtin_unreachable(); + f3(n); +} + +void f2(int*n) +{ + if(*n<0) + __builtin_unreachable(); + f3 (*n); +} + +/* { dg-final { scan-tree-dump-times "Global Exported" 2 "vrp1" } } */
reply other threads:[~2022-11-03 19:27 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20221103192720.EF4803858423@sourceware.org \ --to=amacleod@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).