re PR fortran/53691 (ICE with -Wsurprising in LAPACK 3.4.1 cgbrfsx.f)

2012-06-17  Tobias Burnus  <burnus@net-b.de>

        PR fortran/53691
        PR fortran/53685
        * check.c (gfc_calculate_transfer_sizes): Return if
        SIZE= is not constant or source-size cannot be determined.

2012-06-17  Tobias Burnus  <burnus@net-b.de>

        PR fortran/53691
        PR fortran/53685
        * gfortran.dg/transfer_check_3.f90: New.

From-SVN: r188708
This commit is contained in:
Tobias Burnus 2012-06-17 21:30:29 +02:00 committed by Tobias Burnus
parent a20d08fd75
commit 9a575e0524
4 changed files with 52 additions and 2 deletions

View File

@ -1,3 +1,10 @@
2012-06-17 Tobias Burnus <burnus@net-b.de>
PR fortran/53691
PR fortran/53685
* check.c (gfc_calculate_transfer_sizes): Return if
SIZE= is not constant or source-size cannot be determined.
2012-06-16 Tobias Burnus <burnus@net-b.de>
PR fortran/53642

View File

@ -3986,7 +3986,6 @@ gfc_try
gfc_calculate_transfer_sizes (gfc_expr *source, gfc_expr *mold, gfc_expr *size,
size_t *source_size, size_t *result_size,
size_t *result_length_p)
{
size_t result_elt_size;
mpz_t tmp;
@ -3995,12 +3994,17 @@ gfc_calculate_transfer_sizes (gfc_expr *source, gfc_expr *mold, gfc_expr *size,
if (source->expr_type == EXPR_FUNCTION)
return FAILURE;
/* Calculate the size of the source. */
if (size && size->expr_type != EXPR_CONSTANT)
return FAILURE;
/* Calculate the size of the source. */
if (source->expr_type == EXPR_ARRAY
&& gfc_array_size (source, &tmp) == FAILURE)
return FAILURE;
*source_size = gfc_target_expr_size (source);
if (*source_size == 0)
return FAILURE;
mold_element = mold->expr_type == EXPR_ARRAY
? gfc_constructor_first (mold->value.constructor)->expr

View File

@ -1,3 +1,9 @@
2012-06-17 Tobias Burnus <burnus@net-b.de>
PR fortran/53691
PR fortran/53685
* gfortran.dg/transfer_check_3.f90: New.
2012-06-06 Uros Bizjak <ubizjak@gmail.com>
* gcc.dg/tree-ssa/vrp68.c: Fix scan-tree-dump-times argument order.

View File

@ -0,0 +1,33 @@
! { dg-do compile }
! { dg-options "-Wsurprising" }
!
! PR fortran/53691
! PR fortran/53685
!
! TRANSFER checks
! (a) PR 53691
! Failed for -Wsurprising with an ICE as SIZE was assumed to be constant
SUBROUTINE CGBRFSX(N, RWORK)
INTEGER N
REAL RWORK(*)
REAL ZERO
PARAMETER (ZERO = 0.0E+0)
call foo(TRANSFER (RWORK(1:2*N), (/ (ZERO, ZERO) /), N))
end
! (b) PR 53685
! Failed with a bogus size warning if the source's size is not known at compile
! time (for substrings, the length wasn't set)
subroutine test(j)
implicit none
character(len=4) :: record_type
integer :: i, j
i = transfer (record_type, i) ! no warning
i = transfer (record_type(1:4), i) ! gave a warning
i = transfer (record_type(1:j), i) ! gave a warning
end