From: tkoenig Date: Sun, 29 Apr 2012 07:12:03 +0000 (+0000) Subject: 2012-04-29 Thomas Koenig X-Git-Tag: upstream/4.9.2~12994 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b2fa4782e2fdf6151f5d5283a34e9f120c4cfa3c;p=platform%2Fupstream%2Flinaro-gcc.git 2012-04-29 Thomas Koenig PR fortran/53148 * frontend-passes.c (create_var): If the statement has a label, put the label around the block. 2012-04-29 Thomas Koenig PR fortran/53148 * gfortran.dg/function_optimize_12.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@186942 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index f5ce12c..8d04904 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2012-04-29 Thomas Koenig + + PR fortran/53148 + * frontend-passes.c (create_var): If the statement has a label, + put the label around the block. + 2012-04-25 Tobias Burnus PR fortran/52196 diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c index b20dabb..92a3f8f 100644 --- a/gcc/fortran/frontend-passes.c +++ b/gcc/fortran/frontend-passes.c @@ -271,6 +271,16 @@ create_var (gfc_expr * e) inserted_block->ext.block.assoc = NULL; ns->code = *current_code; + + /* If the statement has a label, make sure it is transferred to + the newly created block. */ + + if ((*current_code)->here) + { + inserted_block->here = (*current_code)->here; + (*current_code)->here = NULL; + } + inserted_block->next = (*current_code)->next; changed_statement = &(inserted_block->ext.block.ns->code); (*current_code)->next = NULL; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3b3a1f6..a5e7cf2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-04-29 Thomas Koenig + + PR fortran/53148 + * gfortran.dg/function_optimize_12.f90: New test. + 2012-04-29 Hans-Peter Nilsson PR target/53156 diff --git a/gcc/testsuite/gfortran.dg/function_optimize_12.f90 b/gcc/testsuite/gfortran.dg/function_optimize_12.f90 new file mode 100644 index 0000000..3c49add --- /dev/null +++ b/gcc/testsuite/gfortran.dg/function_optimize_12.f90 @@ -0,0 +1,12 @@ +! { dg-do run } +! { dg-options "-ffrontend-optimize" } +! PR 53148 - this used to cause wrong code because the label was +! placed after the statement assigning the new variables. +program main + integer :: n + double precision x + n = 3 + goto 100 +100 x = dble(n) + dble(n) + if (x /= 6.d0) call abort +end program main