https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84506

Jerry DeLisle <jvdelisle at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |jvdelisle at gcc dot 
gnu.org

--- Comment #8 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
With iUnit as kind=4, the dump ford not have the check.

  {
    struct __st_parameter_inquire inquire_parm.2;

    inquire_parm.2.common.filename = &"pr84506.f90"[1]{lb: 1 sz: 1};
    inquire_parm.2.common.line = 7;
    inquire_parm.2.strm_pos_out = &ipos;
    inquire_parm.2.common.flags = 8192;
    inquire_parm.2.common.unit = iunit;
    _gfortran_st_inquire (&inquire_parm.2);
  }

So we need to adjust the range check to include possible negative unit numbers.
In other words, change the test to:

if (D.3772 < -some-reasonable-value || D.3772 > 2147483647)
      {
        inquire_parm.3.common.unit = -3;
      }
    _gfortran_st_inquire (&inquire_parm.3);

It could be something like -32768 simply because the check is to make sure the
value used fits within kind=4 common.unit number.

Reply via email to