aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr96598.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr96598.c b/gcc/testsuite/gcc.dg/analyzer/pr96598.c
new file mode 100644
index 0000000..b4354cd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr96598.c
@@ -0,0 +1,26 @@
+/* { dg-additional-options "-O0 -fsanitize=undefined" } */
+
+extern char *foo (char *dest, const char *src)
+ __attribute__ ((__nonnull__ (1, 2)));
+
+unsigned bar(const char *str)
+ __attribute__ ((__nonnull__ ()));
+
+unsigned test(const char *str, unsigned **pv)
+ __attribute__ ((__nonnull__ ()));
+
+unsigned test(const char* str, unsigned **pv)
+{
+ char buffer[130];
+
+ *pv = 0;
+
+ foo(buffer, str);
+ if (bar(buffer))
+ {
+ const char *ptr = 0;
+ foo(buffer, str);
+ return bar(buffer);
+ }
+ return 0;
+}