re PR fortran/53148 (Incorrect intrinsic function parsing on labeled statements when compiled w/ -ffrontend-optimize)

2012-04-29  Thomas Koenig  <tkoenig@gcc.gnu.org>

	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  <tkoenig@gcc.gnu.org>

	PR fortran/53148
	* gfortran.dg/function_optimize_12.f90:  New test.

From-SVN: r186942
This commit is contained in:
Thomas Koenig 2012-04-29 07:12:03 +00:00
parent 78900a5421
commit 3d3b81932d
4 changed files with 33 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2012-04-29 Thomas Koenig <tkoenig@gcc.gnu.org>
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 <burnus@net-b.de>
PR fortran/52196

View File

@ -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;

View File

@ -1,3 +1,8 @@
2012-04-29 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/53148
* gfortran.dg/function_optimize_12.f90: New test.
2012-04-29 Hans-Peter Nilsson <hp@axis.com>
PR target/53156

View File

@ -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