]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR middle-end/34694 (Wrong line number for uninitialized variable)
authorJakub Jelinek <jakub@redhat.com>
Tue, 8 Jan 2008 16:08:24 +0000 (17:08 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 8 Jan 2008 16:08:24 +0000 (17:08 +0100)
PR middle-end/34694
* omp-low.c (copy_var_decl): Copy also DECL_SOURCE_LOCATION.

* gcc.dg/gomp/pr34694.c: New test.
* g++.dg/gomp/pr34694.C: New test.

From-SVN: r131398

gcc/ChangeLog
gcc/omp-low.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/gomp/pr34694.C [new file with mode: 0644]
gcc/testsuite/gcc.dg/gomp/pr34694.c [new file with mode: 0644]

index 42648c889045982799e7a6a4cc5f67195f7baf48..26d9093424098ff91a9323a682757b7aba2825d8 100644 (file)
@@ -1,3 +1,8 @@
+2008-01-08  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/34694
+       * omp-low.c (copy_var_decl): Copy also DECL_SOURCE_LOCATION.
+
 2008-01-08  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/34702
index cf4ae12e291e62cff150f8d301fdc29eaa515ff3..94d63b6a56a60e0477c44db70ff830511b3a9c3b 100644 (file)
@@ -529,6 +529,7 @@ copy_var_decl (tree var, tree name, tree type)
   DECL_ARTIFICIAL (copy) = DECL_ARTIFICIAL (var);
   DECL_IGNORED_P (copy) = DECL_IGNORED_P (var);
   DECL_CONTEXT (copy) = DECL_CONTEXT (var);
+  DECL_SOURCE_LOCATION (copy) = DECL_SOURCE_LOCATION (var);
   TREE_USED (copy) = 1;
   DECL_SEEN_IN_BIND_EXPR_P (copy) = 1;
 
index d32be30a0b03086471baf5cc9929e0e3b8eb95c9..b049c87313ef95268a31577218c65c1b34748c08 100644 (file)
@@ -1,5 +1,9 @@
 2008-01-08  Jakub Jelinek  <jakub@redhat.com>
 
+       PR middle-end/34694
+       * gcc.dg/gomp/pr34694.c: New test.
+       * g++.dg/gomp/pr34694.C: New test.
+
        PR c++/33890
        * g++.dg/gomp/pr33890.C: New test.
 
diff --git a/gcc/testsuite/g++.dg/gomp/pr34694.C b/gcc/testsuite/g++.dg/gomp/pr34694.C
new file mode 100644 (file)
index 0000000..5b98bd2
--- /dev/null
@@ -0,0 +1,15 @@
+// PR middle-end/34694
+// { dg-do compile }
+// { dg-options "-O -fopenmp -Wall" }
+
+int i;
+
+void
+foo ()
+{
+#pragma omp parallel
+  {
+    int j;     // { dg-warning "note: 'j' was declared here" }
+    i = j;     // { dg-warning "is used uninitialized" }
+  }
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/pr34694.c b/gcc/testsuite/gcc.dg/gomp/pr34694.c
new file mode 100644 (file)
index 0000000..35cbf33
--- /dev/null
@@ -0,0 +1,15 @@
+/* PR middle-end/34694 */
+/* { dg-do compile } */
+/* { dg-options "-O -fopenmp -Wall" } */
+
+int i;
+
+void
+foo ()
+{
+#pragma omp parallel
+  {
+    int j;     /* { dg-message "note: 'j' was declared here" } */
+    i = j;     /* { dg-warning "is used uninitialized" } */
+  }
+}