aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2006-12-03 18:24:42 -0800
committerAndrew Pinski <pinskia@gcc.gnu.org>2006-12-03 18:24:42 -0800
commitdd90d2b2108acd851e82b45f8510b23b4b3a90b2 (patch)
tree2e4aa196c51f94d752ebcab9cde74543444bda3a
parentbd6a088940b915e561699648901bf1e6c5effddd (diff)
downloadgcc-dd90d2b2108acd851e82b45f8510b23b4b3a90b2.zip
gcc-dd90d2b2108acd851e82b45f8510b23b4b3a90b2.tar.gz
gcc-dd90d2b2108acd851e82b45f8510b23b4b3a90b2.tar.bz2
re PR c++/14329 ([4.1 only] badly formatted warnings for SRA replacements used uninitialized)
2006-12-03 Richard Henderson <rth@redhat.com> Andrew Pinski <pinskia@gmail.com> PR C++/14329 * error.c (cp_printer) <'D'>: Handle DECL_DEBUG_EXPR. 2006-12-03 Richard Henderson <rth@redhat.com> Andrew Pinski <pinskia@gmail.com> PR C++/14329 * g++.dg/warn/unit-1.C: New test. Co-Authored-By: Andrew Pinski <pinskia@gmail.com> From-SVN: r119478
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/error.c17
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/g++.dg/warn/unit-1.C10
4 files changed, 38 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index cfd933c..7e482c0 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2006-12-03 Richard Henderson <rth@redhat.com>
+ Andrew Pinski <pinskia@gmail.com>
+
+ PR C++/14329
+ * error.c (cp_printer) <'D'>: Handle DECL_DEBUG_EXPR.
+
2006-12-02 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR C++/30033
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index c4f4d46..49f3367 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -2337,7 +2337,22 @@ cp_printer (pretty_printer *pp, text_info *text, const char *spec,
{
case 'A': result = args_to_string (next_tree, verbose); break;
case 'C': result = code_to_string (next_tcode); break;
- case 'D': result = decl_to_string (next_tree, verbose); break;
+ case 'D':
+ {
+ tree temp = next_tree;
+ if (DECL_P (temp)
+ && DECL_DEBUG_EXPR_IS_FROM (temp) && DECL_DEBUG_EXPR (temp))
+ {
+ temp = DECL_DEBUG_EXPR (temp);
+ if (!DECL_P (temp))
+ {
+ result = expr_to_string (temp);
+ break;
+ }
+ }
+ result = decl_to_string (temp, verbose);
+ }
+ break;
case 'E': result = expr_to_string (next_tree); break;
case 'F': result = fndecl_to_string (next_tree, verbose); break;
case 'L': result = language_to_string (next_lang); break;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 2eefcc0..37cc2e2 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2006-12-03 Richard Henderson <rth@redhat.com>
+ Andrew Pinski <pinskia@gmail.com>
+
+ PR C++/14329
+ * g++.dg/warn/unit-1.C: New test.
+
2006-12-03 Uros Bizjak <ubizjak@gmail.com>
* gcc.dg/visibility-11.c: Compile with -mstringop-strategy=libcall.
diff --git a/gcc/testsuite/g++.dg/warn/unit-1.C b/gcc/testsuite/g++.dg/warn/unit-1.C
new file mode 100644
index 0000000..1bfe75b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/unit-1.C
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wuninitialized" } */
+
+struct a { int mode; };
+int sys_msgctl (void)
+{
+ struct a setbuf; /* { dg-warning "'setbuf\.a::mode' is used" } */
+ return setbuf.mode;
+}
+