Commit 92ebaacd by Tobias Burnus

re PR fortran/33037 (TRANSFER should warn on mismatched sizes)

2007-09-21  Tobias Burnus  <burnus@net-b.de>

        PR fortran/33037
        * simplify.c (gfc_simplify_transfer): Warn if source size
        is smaller than result size.

2007-09-21  Tobias Burnus  <burnus@net-b.de>

        PR fortran/33037
        * gfortran.dg/transfer_check_1.f90: New.

From-SVN: r128646
parent 91fe0424
2007-09-21 Tobias Burnus <burnus@net-b.de>
PR fortran/33037
* simplify.c (gfc_simplify_transfer): Warn if source size
is smaller than result size.
2007-09-20 Asher Langton <langton2@llnl.gov>
PR fortran/20441
* gfortran.h : Add init_local_* enums and init_flag_* flags to
* gfortran.h : Add init_local_* enums and init_flag_* flags to
gfc_option_t.
* lang.opt: Add -finit-local-zero, -finit-real, -finit-integer,
-finit-character, and -finit-logical flags.
......
......@@ -4059,6 +4059,11 @@ gfc_simplify_transfer (gfc_expr *source, gfc_expr *mold, gfc_expr *size)
result_size = result_elt_size;
}
if (source_size < result_size)
gfc_warning("Intrinsic TRANSFER at %L has partly undefined result: "
"source size %ld < result size %ld", &source->where,
(long) source_size, (long) result_size);
/* Allocate the buffer to store the binary version of the source. */
buffer_size = MAX (source_size, result_size);
buffer = (unsigned char*)alloca (buffer_size);
......
2007-09-21 Tobias Burnus <burnus@net-b.de>
PR fortran/33037
* gfortran.dg/transfer_check_1.f90: New.
2007-09-20 Asher Langton <langton2@llnl.gov>
PR fortran/20441
! { dg-do compile }
! PR fortran/33037
!
print *, transfer('x', 0, 20) ! { dg-warning "has partly undefined result" }
print *, transfer(1_1, 0) ! { dg-warning "has partly undefined result" }
print *, transfer([1_2,2_2], 0)
print *, transfer([1_2,2_2], 0_8) ! { dg-warning "has partly undefined result" }
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment