re PR fortran/60341 (ICE compiling Nonmem 6.2.0)

fortran/
        PR fortran/60341
        * frontend-passes.c (optimize_comparison): Guard two union
        accesses with the corresponding tag checks.

testsuite/
        PR fortran/60341
        * gfortran.dg/str_comp_optimize_1.f90: New test.

From-SVN: r208259
This commit is contained in:
Mikael Morin 2014-03-02 18:49:18 +00:00
parent ae4a62bb2e
commit 0cb04abc40
4 changed files with 39 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2014-03-02 Mikael Morin <mikael@gcc.gnu.org>
PR fortran/60341
* frontend-passes.c (optimize_comparison): Guard two union accesses
with the corresponding tag checks.
2014-02-22 Mikael Morin <mikael@gcc.gnu.org>
PR fortran/59599

View File

@ -883,7 +883,9 @@ optimize_comparison (gfc_expr *e, gfc_intrinsic_op op)
/* Replace A // B < A // C with B < C, and A // B < C // B
with A < C. */
if (op1->ts.type == BT_CHARACTER && op2->ts.type == BT_CHARACTER
&& op1->expr_type == EXPR_OP
&& op1->value.op.op == INTRINSIC_CONCAT
&& op2->expr_type == EXPR_OP
&& op2->value.op.op == INTRINSIC_CONCAT)
{
gfc_expr *op1_left = op1->value.op.op1;

View File

@ -1,9 +1,14 @@
2014-03-02 Mikael Morin <mikael@gcc.gnu.org>
PR fortran/60341
* gfortran.dg/str_comp_optimize_1.f90: New test.
2014-02-26 Fabien Chêne <fabien@gcc.gnu.org>
PR c++/37140
* g++.dg/template/using27.C: New.
* g++.dg/template/using28.C: New.
* g++.dg/template/using29.C: New.
PR c++/37140
* g++.dg/template/using27.C: New.
* g++.dg/template/using28.C: New.
* g++.dg/template/using29.C: New.
2014-02-22 Mikael Morin <mikael@gcc.gnu.org>

View File

@ -0,0 +1,22 @@
! { dg-do compile }
! { dg-options "-ffrontend-optimize" }
!
! PR fortran/60341
! An unguarded union access was wrongly enabling a frontend optimization on a
! string comparison, leading to an ICE.
!
! Original testcase from Steve Chapel <steve.chapel@a2pg.com>.
! Reduced by Steven G. Kargl <kargl@gcc.gnu.org>.
!
subroutine modelg(ncm)
implicit none
integer, parameter :: pc = 30, pm = pc - 1
integer i
character*4 catt(pm,2)
integer ncm,iatt(pm,pc)
do i=1,ncm
if (catt(i,1)//catt(i,2).eq.'central') exit
end do
iatt(i,4)=1
end