public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] analyzer: add regression test [PR99269]
@ 2021-11-30 22:54 David Malcolm
  0 siblings, 0 replies; only message in thread
From: David Malcolm @ 2021-11-30 22:54 UTC (permalink / raw)
  To: gcc-patches

Successfully regrtested on x86_64-pc-linux-gnu.
Pushed to trunk as r12-5641-g9603bccba62e250d0ff64863a1730a167d571a25.

gcc/testsuite/ChangeLog:
	PR analyzer/99269
	* gcc.dg/analyzer/pr99269.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
---
 gcc/testsuite/gcc.dg/analyzer/pr99269.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 gcc/testsuite/gcc.dg/analyzer/pr99269.c

diff --git a/gcc/testsuite/gcc.dg/analyzer/pr99269.c b/gcc/testsuite/gcc.dg/analyzer/pr99269.c
new file mode 100644
index 00000000000..1cce3aef8dd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr99269.c
@@ -0,0 +1,16 @@
+#include <stdlib.h>
+
+void example(void) {
+	int len;
+	int **namelist = NULL;
+
+	len = 2;
+	namelist = malloc(len * sizeof *namelist);
+	if (!namelist) return;
+	namelist[0] = malloc(sizeof **namelist);
+	namelist[1] = malloc(sizeof **namelist);
+
+	while(len--) { free(namelist[len]); }
+	free(namelist);
+	return;
+}
-- 
2.26.3


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-11-30 22:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-30 22:54 [committed] analyzer: add regression test [PR99269] David Malcolm

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).