[Bug fortran/36132] _gfortran_internal_pack on optional arguments
--- Comment #10 from burnus at gcc dot gnu dot org 2008-07-27 10:46 --- Subject: Bug 36132 Author: burnus Date: Sun Jul 27 10:45:44 2008 New Revision: 138186 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=138186 Log: 2008-07-27 Tobias Burnus [EMAIL PROTECTED] PR fortran/36132 PR fortran/29952 PR fortran/36909 * trans.c (gfc_trans_runtime_check): Allow run-time warning * besides run-time error. * trans.h (gfc_trans_runtime_check): Update declaration. * trans-array.c * (gfc_trans_array_ctor_element,gfc_trans_array_bound_check, gfc_conv_array_ref,gfc_conv_ss_startstride,gfc_trans_dummy_array_bias): Updated gfc_trans_runtime_check calls. (gfc_conv_array_parameter): Implement flag_check_array_temporaries, fix packing/unpacking for nonpresent optional actuals to optional formals. * trans-array.h (gfc_conv_array_parameter): Update declaration. * trans-expr.c (gfc_conv_substring,gfc_trans_arrayfunc_assign, gfc_conv_function_call): Updated gfc_trans_runtime_check calls. (gfc_conv_function_call): Update gfc_conv_array_parameter calls. * trans-expr.c (gfc_trans_goto): Updated gfc_trans_runtime_check calls. * trans-io.c (set_string,gfc_conv_intrinsic_repeat): Ditto. (gfc_conv_intrinsic_transfer,gfc_conv_intrinsic_loc): Same for gfc_conv_array_parameter. * trans-intrinsics.c (gfc_conv_intrinsic_bound): Ditto. * trans-decl.c (gfc_build_builtin_function_decls): Add gfor_fndecl_runtime_warning_at. * lang.opt: New option fcheck-array-temporaries. * gfortran.h (gfc_options): New flag_check_array_temporaries. * options.c (gfc_init_options, gfc_handle_option): Handle flag. * invoke.texi: New option fcheck-array-temporaries. 2008-07-27 Tobias Burnus [EMAIL PROTECTED] PR fortran/36132 PR fortran/29952 PR fortran/36909 * runtime/error.c: New function runtime_error_at. * gfortran.map: Ditto. * libgfortran.h: Ditto. 2008-07-27 Tobias Burnus [EMAIL PROTECTED] PR fortran/36132 PR fortran/29952 PR fortran/36909 gfortran.dg/internal_pack_4.f90: New. gfortran.dg/internal_pack_5.f90: New. gfortran.dg/array_temporaries_2.f90: New. Added: trunk/gcc/testsuite/gfortran.dg/array_temporaries_2.f90 trunk/gcc/testsuite/gfortran.dg/internal_pack_4.f90 trunk/gcc/testsuite/gfortran.dg/internal_pack_5.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/gfortran.h trunk/gcc/fortran/invoke.texi trunk/gcc/fortran/lang.opt trunk/gcc/fortran/options.c trunk/gcc/fortran/trans-array.c trunk/gcc/fortran/trans-array.h trunk/gcc/fortran/trans-decl.c trunk/gcc/fortran/trans-expr.c trunk/gcc/fortran/trans-intrinsic.c trunk/gcc/fortran/trans-io.c trunk/gcc/fortran/trans-stmt.c trunk/gcc/fortran/trans.c trunk/gcc/fortran/trans.h trunk/gcc/testsuite/ChangeLog trunk/libgfortran/ChangeLog trunk/libgfortran/gfortran.map trunk/libgfortran/libgfortran.h trunk/libgfortran/runtime/error.c -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36132
[Bug fortran/36132] _gfortran_internal_pack on optional arguments
--- Comment #11 from burnus at gcc dot gnu dot org 2008-07-27 11:42 --- Subject: Bug 36132 Author: burnus Date: Sun Jul 27 11:41:35 2008 New Revision: 138187 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=138187 Log: 2008-07-27 Tobias Burnus [EMAIL PROTECTED] PR fortran/36132 * trans-array.c (gfc_conv_array_parameter): Fix packing/unpacking for nonpresent optional actuals to optional formals. * trans-array.h (gfc_conv_array_parameter): Update declaration. * trans-expr.c (gfc_conv_function_call,gfc_trans_arrayfunc_assign): Update gfc_conv_array_parameter calls. * trans-intrinsics (gfc_conv_intrinsic_transfer, gfc_conv_intrinsic_loc): Ditto. 2008-07-27 Tobias Burnus [EMAIL PROTECTED] PR fortran/36132 * gfortran.dg/internal_pack_4.f90: New. Added: branches/gcc-4_3-branch/gcc/testsuite/gfortran.dg/internal_pack_4.f90 Modified: branches/gcc-4_3-branch/gcc/fortran/ChangeLog branches/gcc-4_3-branch/gcc/fortran/trans-array.c branches/gcc-4_3-branch/gcc/fortran/trans-array.h branches/gcc-4_3-branch/gcc/fortran/trans-expr.c branches/gcc-4_3-branch/gcc/fortran/trans-intrinsic.c branches/gcc-4_3-branch/gcc/testsuite/ChangeLog -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36132
[Bug fortran/36132] _gfortran_internal_pack on optional arguments
--- Comment #12 from burnus at gcc dot gnu dot org 2008-07-27 11:47 --- FIXED on the trunk and on the 4.3 branch. Thanks for the bug report. -- burnus at gcc dot gnu dot org changed: What|Removed |Added Status|NEW |RESOLVED Resolution||FIXED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36132
[Bug fortran/36132] _gfortran_internal_pack on optional arguments
--- Comment #9 from jv244 at cam dot ac dot uk 2008-07-25 10:20 --- Any plans to look into a fix for this for 4.3.X ? This is variant of the testcase that causes a runtime abort (trunk on x86_64-unknown-linux-gnu): gfortran -O2 test.f90 ; ./a.out Operating system error: Cannot allocate memory Memory allocation failed cat test.f90 MODULE M1 INTEGER, PARAMETER :: dp=KIND(0.0D0) CONTAINS SUBROUTINE S0() REAL(dp) :: a(5,9,3,5) CALL S1(a) END SUBROUTINE SUBROUTINE S1(a) REAL(dp), DIMENSION(45), INTENT(OUT), OPTIONAL :: a IF (PRESENT(a)) CALL RANDOM_NUMBER(a) END SUBROUTINE S1 SUBROUTINE S2(a) REAL(dp), DIMENSION(:, :), INTENT(OUT), OPTIONAL :: a CALL S1(a) END SUBROUTINE END MODULE M1 USE M1 CALL S0() CALL S2() END -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36132
[Bug fortran/36132] _gfortran_internal_pack on optional arguments
--- Comment #8 from burnus at gcc dot gnu dot org 2008-06-16 18:08 --- Pointer for myself (or someone else): Should be added in trans-array.c's gfc_conv_array_parameter and maybe also gfc_trans_dummy_array_bias. -- burnus at gcc dot gnu dot org changed: What|Removed |Added CC||burnus at gcc dot gnu dot ||org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36132
[Bug fortran/36132] _gfortran_internal_pack on optional arguments
--- Comment #7 from fxcoudert at gcc dot gnu dot org 2008-06-15 15:13 --- This is an important bug indeed, and I'm swamped with work, so I'd better leave it to someone else. -- fxcoudert at gcc dot gnu dot org changed: What|Removed |Added AssignedTo|fxcoudert at gcc dot gnu dot|unassigned at gcc dot gnu |org |dot org Status|ASSIGNED|NEW http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36132
[Bug fortran/36132] _gfortran_internal_pack on optional arguments
--- Comment #5 from jv244 at cam dot ac dot uk 2008-05-20 06:45 --- this seems one of the few wrong-code bugs that affects Fortran95 in a system independent way. Any chance to fix this, with a backport to 4.3(.2) ? I believe we could try to code around it for new versions of CP2K, but that would just be CP2K. I would guess that the fix is very localized and 'obvious'. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36132
[Bug fortran/36132] _gfortran_internal_pack on optional arguments
--- Comment #6 from fxcoudert at gcc dot gnu dot org 2008-05-20 15:18 --- (In reply to comment #5) this seems one of the few wrong-code bugs that affects Fortran95 in a system independent way. Any chance to fix this, with a backport to 4.3(.2) ? I believe we could try to code around it for new versions of CP2K, but that would just be CP2K. I would guess that the fix is very localized and 'obvious'. This is not a regression, but I guess as you that the fix should be simple, so why not? I'll look into it. -- fxcoudert at gcc dot gnu dot org changed: What|Removed |Added AssignedTo|unassigned at gcc dot gnu |fxcoudert at gcc dot gnu dot |dot org |org Status|NEW |ASSIGNED Last reconfirmed|2008-05-05 18:57:28 |2008-05-20 15:18:15 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36132
[Bug fortran/36132] _gfortran_internal_pack on optional arguments
--- Comment #4 from tkoenig at gcc dot gnu dot org 2008-05-05 18:57 --- The problem isn't specific to in_pack, it's the fact that we don't initialize the array descriptor correctly. s2 shows if (a != 0B) { { integer(kind=4) D.638; D.638 = a-dim[0].stride; stride.1 = D.638 != 0 ? D.638 : 1; ... } } so we set stride.1 only if a is present. So far, so good. Later, unconditionally, we have struct array2_real(kind=8) parm.6; ... D.633 = stride.1; parm.6.dim[0].lbound = 1; parm.6.dim[0].ubound = ubound.0; parm.6.dim[0].stride = NON_LVALUE_EXPR D.633; parm.6.data = (void *) (*a.0)[0]; parm.6.offset = NON_LVALUE_EXPR D.632; D.635 = _gfortran_internal_pack (parm.6); We need to call _gfortran_internal_pack on optional arguments only when the optional arguments are present. Setting subject. -- tkoenig at gcc dot gnu dot org changed: What|Removed |Added CC||tkoenig at gcc dot gnu dot ||org Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Keywords||wrong-code Last reconfirmed|-00-00 00:00:00 |2008-05-05 18:57:28 date|| Summary|issue with |_gfortran_internal_pack on |_gfortran_internal_pack |optional arguments http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36132