From 5f8cd14f8966f11e8ed10a4c7e35dc01fffe54d8 Mon Sep 17 00:00:00 2001
From: segher <segher@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Fri, 30 Aug 2019 14:17:20 +0000
Subject: [PATCH 3/3] 	Backport from trunk 	2019-08-23  Segher Boessenkool
  <segher@kernel.crashing.org>

gcc/testsuite/
	PR target/91481
	* gcc.target/powerpc/darn-3.c: New testcase.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@275182 138bc75d-0d04-0410-961f-82ee72b054a4

Upstream-Status: Backport
CVE: CVE-2019-14847 p3
Affects <= 9.2.0
Dropped Change log changes
Signed-off-by: Armin Kuster <akuster@mvista.com>

---
 gcc/testsuite/gcc.target/powerpc/darn-3.c | 16 ++++++++++++++++
 2 files changed, 25 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/powerpc/darn-3.c

Index: gcc-8.3.0/gcc/testsuite/gcc.target/powerpc/darn-3.c
===================================================================
--- /dev/null
+++ gcc-8.3.0/gcc/testsuite/gcc.target/powerpc/darn-3.c
@@ -0,0 +1,16 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-skip-if "" { powerpc*-*-aix* } } */
+/* { dg-options "-O2 -mdejagnu-cpu=power9" } */
+
+static int darn32(void) { return __builtin_darn_32(); }
+
+int four(void)
+{
+	int sum = 0;
+	int i;
+	for (i = 0; i < 4; i++)
+		sum += darn32();
+	return sum;
+}
+
+/* { dg-final { scan-assembler-times {(?n)\mdarn .*,0\M} 4 } } */
