This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/82511] [7/8 Regression] ICE Bad IO basetype (12) on attempted read or write of entire DEC structure
- From: "fritzoreese at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 14 Oct 2017 19:33:28 +0000
- Subject: [Bug fortran/82511] [7/8 Regression] ICE Bad IO basetype (12) on attempted read or write of entire DEC structure
- Auto-submitted: auto-generated
- References: <bug-82511-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82511
--- Comment #5 from Fritz Reese <fritzoreese at gmail dot com> ---
Nice! That should probably not compile. There is some trickiness because it
is valid to create a RECORD variable with the same name as a STRUCTURE.
I’ll get on that as well.
On Fri, Oct 13, 2017, 13:49 sgk at troutmask dot apl.washington.edu <
gcc-bugzilla@gcc.gnu.org> wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82511
>
> --- Comment #4 from Steve Kargl <sgk at troutmask dot apl.washington.edu>
> ---
> On Fri, Oct 13, 2017 at 01:39:26AM +0000, foreese at gcc dot gnu.org
> wrote:
> >
> > Fritz Reese <foreese at gcc dot gnu.org> changed:
> >
> > Under other DEC compilers, it seems STRUCTUREs are to be treated
> consistently
> > with derived types in regards to I/O lists. That is to say, a structure
> > variable is treated as if each of its named components was listed on the
> I/O
> > list. (Even with UNIONs/MAPs, each named component is to be treated as
> having
> > been listed in place of the DEC RECORD containing it, so that the last
> > component written to within overlapping MAPs takes effect. Yikes.)
> >
> > I believe both the code in the attachment and the "intended code"
> (writing to
> > bucket.c16 instead of bucket) should be accepted, whereas they both ICE
> > currently.
> >
> > I will look into it.
>
> I actually misread the code. I thought it was
>
> program bug
> structure /bckt/
> union
> map
> character*16 c16
> end map
> end union
> end structure
> record /bckt/ bucket
> character(len=16) :: rec1 = 'ABCDEFGHIJKLMNOP'
> 100 format(A16)
> read(rec1, 100) bckt
> end program bug
>
> where one is trying read into the definition of the structure.
> Is the above suppose to compile? Because it does. A simple
> program with a Fortran derived type fails.
>
> type bar
> integer i
> end type bar
> character(len=10) :: str ='123'
> read(str,*) bar
> end
>
> # gfcx -c b.f
> b.f:5:21:
>
> read(str,*) bar
> 1
> Error: Derived type 'bar' cannot be used as a variable at (1)
>
> I was thinking the bckt should be handled in the same manner
> as bar.
>
> --
> You are receiving this mail because:
> You are on the CC list for the bug.
> You are the assignee for the bug.