]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
analyzer: add test_passthrough for getenv
authorRidham Khurana <khurana.ridham222@gmail.com>
Sat, 21 Mar 2026 19:37:40 +0000 (01:07 +0530)
committerDavid Malcolm <dmalcolm@redhat.com>
Tue, 28 Apr 2026 23:11:26 +0000 (19:11 -0400)
Add a test_passthrough case for getenv to ensure the known_function
correctly handles purely symbolic arguments.

gcc/testsuite/ChangeLog:
* gcc.dg/analyzer/getenv-1.c (test_passthrough): New test.

Signed-off-by: Ridham Khurana <khurana.ridham222@gmail.com>
gcc/testsuite/gcc.dg/analyzer/getenv-1.c

index 43afdf1f115cf8b82f931a18f904854e7f34f65a..61e87e8db3dfd12313a9345753501a600a1c41cb 100644 (file)
@@ -41,6 +41,11 @@ void test_getenv_returns_nonnull (void)
   __analyzer_eval (p != NULL); /* { dg-warning "TRUE" } */
 }
 
+char *test_passthrough (const char *name)
+{
+  return getenv (name);
+}
+
 void test_unterminated (void)
 {
   char buf[3] = "abc";