mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-01-27 03:13:58 +08:00
re PR libfortran/33055 (Runtime error in INQUIRE unit existance with -fdefault-integer-8)
2007-08-28 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/33055 Revert previous patch. From-SVN: r127877
This commit is contained in:
parent
d05fd13654
commit
5d75fb81c7
@ -1094,30 +1094,6 @@ gfc_trans_flush (gfc_code * code)
|
||||
}
|
||||
|
||||
|
||||
/* Create a dummy iostat variable to catch any error due to bad unit. */
|
||||
|
||||
static gfc_expr *
|
||||
create_dummy_iostat (void)
|
||||
{
|
||||
gfc_symtree *st;
|
||||
gfc_expr *e;
|
||||
|
||||
st = gfc_get_unique_symtree (gfc_current_ns);
|
||||
st->n.sym = gfc_new_symbol (st->name, gfc_current_ns);
|
||||
st->n.sym->ts.type = BT_INTEGER;
|
||||
st->n.sym->ts.kind = 4;
|
||||
st->n.sym->attr.referenced = 1;
|
||||
st->n.sym->refs = 1;
|
||||
e = gfc_get_expr ();
|
||||
e->expr_type = EXPR_VARIABLE;
|
||||
e->symtree = st;
|
||||
e->ts.type = BT_INTEGER;
|
||||
e->ts.kind = 4;
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
|
||||
/* Translate the non-IOLENGTH form of an INQUIRE statement. */
|
||||
|
||||
tree
|
||||
@ -1157,17 +1133,8 @@ gfc_trans_inquire (gfc_code * code)
|
||||
p->file);
|
||||
|
||||
if (p->exist)
|
||||
{
|
||||
mask |= set_parameter_ref (&block, &post_block, var, IOPARM_inquire_exist,
|
||||
p->exist);
|
||||
|
||||
if (p->unit && !p->iostat)
|
||||
{
|
||||
p->iostat = create_dummy_iostat ();
|
||||
mask |= set_parameter_ref (&block, &post_block, var,
|
||||
IOPARM_common_iostat, p->iostat);
|
||||
}
|
||||
}
|
||||
mask |= set_parameter_ref (&block, &post_block, var, IOPARM_inquire_exist,
|
||||
p->exist);
|
||||
|
||||
if (p->opened)
|
||||
mask |= set_parameter_ref (&block, &post_block, var, IOPARM_inquire_opened,
|
||||
|
@ -7,7 +7,6 @@
|
||||
!
|
||||
! Bugs submitted by Walt Brainerd
|
||||
integer i
|
||||
integer, parameter ::ERROR_BAD_UNIT = 5005
|
||||
logical l
|
||||
|
||||
i = 0
|
||||
@ -23,10 +22,4 @@
|
||||
inquire (unit=-42, exist=l)
|
||||
if (l) call abort
|
||||
|
||||
i = 0
|
||||
! This one is nasty
|
||||
inquire (unit=2_8*huge(0_4)+20_8, exist=l, iostat=i)
|
||||
if (l) call abort
|
||||
if (i.ne.ERROR_BAD_UNIT) call abort
|
||||
|
||||
end
|
||||
|
@ -1,35 +0,0 @@
|
||||
! { dg-do run }
|
||||
! { dg-options "-fdefault-integer-8" }
|
||||
!
|
||||
! NOTE: This test is identical to negative_unit.f except -fdefault-integer-8
|
||||
!
|
||||
! PR libfortran/20660 and other bugs (not filed in bugzilla) relating
|
||||
! to negative units
|
||||
! PR 33055 Runtime error in INQUIRE unit existance with -fdefault-integer-8
|
||||
! Test case update by Jerry DeLisle <jvdelisle@gcc.gnu.org>
|
||||
!
|
||||
! Bugs submitted by Walt Brainerd
|
||||
integer i
|
||||
integer, parameter ::ERROR_BAD_UNIT = 5005
|
||||
logical l
|
||||
|
||||
i = 0
|
||||
! gfortran created a 'fort.-1' file and wrote "Hello" in it
|
||||
write (unit=-1, fmt=*, iostat=i) "Hello"
|
||||
if (i <= 0) call abort
|
||||
|
||||
i = 0
|
||||
open (unit=-11, file="xxx", iostat=i)
|
||||
if (i <= 0) call abort
|
||||
|
||||
i = 0
|
||||
inquire (unit=-42, exist=l)
|
||||
if (l) call abort
|
||||
|
||||
i = 0
|
||||
! This one is nasty
|
||||
inquire (unit=2_8*huge(0_4)+20_8, exist=l, iostat=i)
|
||||
if (l) call abort
|
||||
if (i.ne.ERROR_BAD_UNIT) call abort
|
||||
|
||||
end
|
@ -47,17 +47,7 @@ inquire_via_unit (st_parameter_inquire *iqp, gfc_unit * u)
|
||||
GFC_INTEGER_4 cf = iqp->common.flags;
|
||||
|
||||
if ((cf & IOPARM_INQUIRE_HAS_EXIST) != 0)
|
||||
{
|
||||
*iqp->exist = (iqp->common.unit >= 0
|
||||
&& iqp->common.unit <= GFC_INTEGER_4_HUGE);
|
||||
|
||||
if ((cf & IOPARM_INQUIRE_HAS_FILE) == 0)
|
||||
{
|
||||
if (!(*iqp->exist))
|
||||
*iqp->common.iostat = ERROR_BAD_UNIT;
|
||||
*iqp->exist = *iqp->exist && (*iqp->common.iostat != ERROR_BAD_UNIT);
|
||||
}
|
||||
}
|
||||
*iqp->exist = iqp->common.unit >= 0;
|
||||
|
||||
if ((cf & IOPARM_INQUIRE_HAS_OPENED) != 0)
|
||||
*iqp->opened = (u != NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user