This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch, Fortran] PR 55978: [4.8 Regression] class_optional_2.f90 -Os fails


Hi all,

here is a close-to-obvious patch which should fix the occasional
failures of class_optional_2.f90 in the testsuite.

The problem was that we call _gfortran_internal_pack on an array
descriptor for a non-existent array. This can happen, for example,
when passing a NULL array pointer to an optional array dummy (see
attached test case).

The first approach was to add code at translation stage, which only
calls internal_pack if the pointer is non-NULL.

On second thought, I decided to move this check inside of
internal_pack. While this can potentially decrease performance (due to
the additional function call, which I hope is negligible), it ensures
that this check is really done in all possible situations, which makes
internal_pack somewhat safer.

The patch was regtested on x86_64-unknown-linux-gnu. Ok for trunk?

Btw, should I include the additional test case when committing, or is
it sufficient to have class_optional_2.f90?

Cheers,
Janus


2013-02-06  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/55978
    * runtime/in_pack_generic.c (internal_pack): Return if base_addr is
    NULL.

2013-02-06  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/55978
    * gfortran.dg/optional_absent_3.f90: New.

Attachment: pr55978_v3.diff
Description: Binary data

Attachment: optional_absent_3.f90
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]