[Bug fortran/91471] f951: internal compiler error: gfc_variable_attr(): Bad array reference

2019-08-17 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91471

kargl at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED
   Target Milestone|--- |9.3

--- Comment #6 from kargl at gcc dot gnu.org ---
Fixed on trunk and 9-branch.  Thanks for bug report.

[Bug fortran/91471] f951: internal compiler error: gfc_variable_attr(): Bad array reference

2019-08-17 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91471

--- Comment #5 from kargl at gcc dot gnu.org ---
Author: kargl
Date: Sat Aug 17 18:16:51 2019
New Revision: 274612

URL: https://gcc.gnu.org/viewcvs?rev=274612=gcc=rev
Log:
2019-08-17  Steven G. Kargl  

PR fortran/91471
* primary.c (gfc_variable_attr): Remove a gfc_internal_error(),
which cannot be reached by conforming Fortran code, but seems to
be reachable from nonconforming Fortran code.  Treat the AR_UNKNOWN
case as a no-op.

2019-08-17  Steven G. Kargl  

PR fortran/91471
* gfortran.dg/pr91471.f90: New test.

Added:
branches/gcc-9-branch/gcc/testsuite/gfortran.dg/pr91471.f90
Modified:
branches/gcc-9-branch/gcc/fortran/ChangeLog
branches/gcc-9-branch/gcc/fortran/primary.c
branches/gcc-9-branch/gcc/testsuite/ChangeLog

[Bug fortran/91471] f951: internal compiler error: gfc_variable_attr(): Bad array reference

2019-08-17 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91471

--- Comment #4 from kargl at gcc dot gnu.org ---
Author: kargl
Date: Sat Aug 17 14:23:10 2019
New Revision: 274603

URL: https://gcc.gnu.org/viewcvs?rev=274603=gcc=rev
Log:
2019-08-17  Steven G. Kargl  

PR fortran/91471
* primary.c (gfc_variable_attr): Remove a gfc_internal_error(),
which cannot be reached by conforming Fortran code, but seems to
be reachable from nonconforming Fortran code.  Treat the AR_UNKNOWN
case as a no-op.

2019-08-17  Steven G. Kargl  

PR fortran/91471
* gfortran.dg/pr91471.f90: New test.

Added:
trunk/gcc/testsuite/gfortran.dg/pr91471.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/primary.c
trunk/gcc/testsuite/ChangeLog

[Bug fortran/91471] f951: internal compiler error: gfc_variable_attr(): Bad array reference

2019-08-17 Thread sgk at troutmask dot apl.washington.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91471

--- Comment #3 from Steve Kargl  ---
On Sat, Aug 17, 2019 at 08:04:23AM +, SameeranJayant.Joshi at amd dot com
wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91471
> 
> --- Comment #2 from Sameeran Joshi  ---
> (In reply to kargl from comment #1)
> > I have a patch that prevents the ICE.  Remove ICE-on-valid-code
> > tag as the code is invalid.
> 
> It fails when a value is assigned to the allocated space:
> 
> program dynamic
> implicit none
> integer,dimension(:), allocatable :: x
> allocate(x(1))
> x(1) = 10
> stop x(1)
> end program dynamic
> 
> Is above ICE-ON-INVALID code ? 
> Can you please specify the reason?
> Thanks
> 

The original code was invalid as you referenced x(1) 
without assigning it a value, i.e., you referenced
an undefined variable. With the patch I will commit
later today, the above code gives

% gfcx -o z a.f90
troutmask:sgk[207] ./z
STOP 10

[Bug fortran/91471] f951: internal compiler error: gfc_variable_attr(): Bad array reference

2019-08-17 Thread SameeranJayant.Joshi at amd dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91471

--- Comment #2 from Sameeran Joshi  ---
(In reply to kargl from comment #1)
> I have a patch that prevents the ICE.  Remove ICE-on-valid-code
> tag as the code is invalid.

It fails when a value is assigned to the allocated space:

program dynamic
implicit none
integer,dimension(:), allocatable :: x
allocate(x(1))
x(1) = 10
stop x(1)
end program dynamic

Is above ICE-ON-INVALID code ? 
Can you please specify the reason?
Thanks

[Bug fortran/91471] f951: internal compiler error: gfc_variable_attr(): Bad array reference

2019-08-16 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91471

kargl at gcc dot gnu.org changed:

   What|Removed |Added

   Keywords|ice-on-valid-code   |
   Priority|P3  |P4
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-08-16
 CC||kargl at gcc dot gnu.org
   Assignee|unassigned at gcc dot gnu.org  |kargl at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from kargl at gcc dot gnu.org ---
I have a patch that prevents the ICE.  Remove ICE-on-valid-code
tag as the code is invalid.