From: Jakub Jelinek Date: Tue, 8 Jan 2008 16:08:24 +0000 (+0100) Subject: re PR middle-end/34694 (Wrong line number for uninitialized variable) X-Git-Tag: releases/gcc-4.3.0~695 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c90eee444ccd2d39ac22b55e0b6516d842590bfb;p=thirdparty%2Fgcc.git re PR middle-end/34694 (Wrong line number for uninitialized variable) 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 42648c889045..26d909342409 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2008-01-08 Jakub Jelinek + + PR middle-end/34694 + * omp-low.c (copy_var_decl): Copy also DECL_SOURCE_LOCATION. + 2008-01-08 Uros Bizjak PR target/34702 diff --git a/gcc/omp-low.c b/gcc/omp-low.c index cf4ae12e291e..94d63b6a56a6 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d32be30a0b03..b049c87313ef 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2008-01-08 Jakub Jelinek + 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 index 000000000000..5b98bd2a9a70 --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/pr34694.C @@ -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 index 000000000000..35cbf3340646 --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/pr34694.c @@ -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" } */ + } +}