From 01d0a156a87faf436d7498ca73b67cc946c0a665 Mon Sep 17 00:00:00 2001
From: Andrew Pinski <pinskia@physics.uc.edu>
Date: Thu, 18 Dec 2003 22:19:11 +0000
Subject: [PATCH] re PR debug/12923 (ICE in gen_subprogram_die, at
 dwarf2out.c:10607 with -O1 -g)

	PR debug/12923
	* gcc.dg/20031218-1.c: New test.

	PR debug/12389
	* gcc.dg/20031218-2.c: New test.
	* gcc.dg/20031218-3.c: New test.

From-SVN: r74807
---
 gcc/testsuite/ChangeLog           |  7 +++++++
 gcc/testsuite/gcc.dg/20031218-1.c | 19 +++++++++++++++++++
 gcc/testsuite/gcc.dg/20031218-2.c | 12 ++++++++++++
 gcc/testsuite/gcc.dg/20031218-3.c | 12 ++++++++++++
 4 files changed, 50 insertions(+)
 create mode 100644 gcc/testsuite/gcc.dg/20031218-1.c
 create mode 100644 gcc/testsuite/gcc.dg/20031218-2.c
 create mode 100644 gcc/testsuite/gcc.dg/20031218-3.c

diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index db37a9915cc8..980e4492de94 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,12 @@
 2003-12-18  Andrew Pinski  <pinskia@physics.uc.edu>
 
+	PR debug/12923
+	* gcc.dg/20031218-1.c: New test.
+
+	PR debug/12389
+	* gcc.dg/20031218-2.c: New test.
+	* gcc.dg/20031218-3.c: New test.
+
 	* g++.dg/abi/mangle18-1.C: Modify regexp to test for `[: \t\n]' at end
 	of label name and allow for USER_LABEL_PREFIX == "_" names.
 	* g++.dg/abi/mangle18-2.C: Likewise.
diff --git a/gcc/testsuite/gcc.dg/20031218-1.c b/gcc/testsuite/gcc.dg/20031218-1.c
new file mode 100644
index 000000000000..87cc1059fa8f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/20031218-1.c
@@ -0,0 +1,19 @@
+/* Orgin: v.haisman@sh.cvut.cz
+   Reduced by: Wolfgang Bangerth <bangerth@dealii.org>
+   PR debug/12923  ICE in gen_subprogram_die with -O1 -g
+   The problem was that this just to ICE with -O1  -g.  */
+
+/* { dg-do compile } */
+/* { dg-options "-O -g" } */
+
+struct S {
+  unsigned n;
+};
+
+inline void foo (struct S * mx) {
+  mx->n = 1;
+}
+
+void bar () {
+  foo (0);
+}
diff --git a/gcc/testsuite/gcc.dg/20031218-2.c b/gcc/testsuite/gcc.dg/20031218-2.c
new file mode 100644
index 000000000000..497c963d27b3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/20031218-2.c
@@ -0,0 +1,12 @@
+/* Orgin: Richard Sandiford <rsandifo@gcc.gnu.org> 
+   PR debug/12923  ICE in gen_subprogram_die with -O2 -g
+   The problem was that this just to ICE with -O2 -g.  */
+
+/* { dg-do compile } */
+/* { dg-options "-O2 -g" } */
+
+int f1 (int y)
+{
+  int f2() { return y; }
+  return f2();
+}
diff --git a/gcc/testsuite/gcc.dg/20031218-3.c b/gcc/testsuite/gcc.dg/20031218-3.c
new file mode 100644
index 000000000000..58878b61f066
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/20031218-3.c
@@ -0,0 +1,12 @@
+/* Orgin: Chris Demetriou <cgd@broadcom.com>
+   PR debug/12923  ICE in gen_subprogram_die with -O2 -g
+   The problem was that this just to ICE with -O2 -g.  */
+
+/* { dg-do compile } */
+/* { dg-options "-O2 -g" } */
+
+int x (char *s)
+{
+  int y () { return (strlen (s)); }
+  return y (s);
+}
-- 
GitLab