[Bug fortran/89344] uncaught programmer error: polymorphic variable is INTENT(IN) but assigned to without error

2019-06-20 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89344

kargl at gcc dot gnu.org changed:

   What|Removed |Added

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

--- Comment #9 from kargl at gcc dot gnu.org ---
Fixed on trunk and 9-branch.

[Bug fortran/89344] uncaught programmer error: polymorphic variable is INTENT(IN) but assigned to without error

2019-06-20 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89344

--- Comment #8 from kargl at gcc dot gnu.org ---
Author: kargl
Date: Fri Jun 21 00:24:53 2019
New Revision: 272539

URL: https://gcc.gnu.org/viewcvs?rev=272539=gcc=rev
Log:
2019-06-20  Steven G. Kargl  

Backport from mainline
PR fortran/89344
* expr.c (gfc_check_vardef_context): Check for INTENT(IN) variable
in SELECT TYPE construct.

2019-06-20  Steven G. Kargl  

Backport from mainline
PR fortran/89344
* gfortran.dg/pr89344.f90: New test.


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

[Bug fortran/89344] uncaught programmer error: polymorphic variable is INTENT(IN) but assigned to without error

2019-06-13 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89344

--- Comment #7 from kargl at gcc dot gnu.org ---
Fixed on trunk.  Thanks for the bug report.
Leavin PR open as I haven't decided if I will
back port the patch to other branches.

[Bug fortran/89344] uncaught programmer error: polymorphic variable is INTENT(IN) but assigned to without error

2019-06-13 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89344

--- Comment #6 from kargl at gcc dot gnu.org ---
Author: kargl
Date: Thu Jun 13 18:07:53 2019
New Revision: 272255

URL: https://gcc.gnu.org/viewcvs?rev=272255=gcc=rev
Log:
2019-06-13  Steven G. Kargl  

PR fortran/89344
* expr.c (gfc_check_vardef_context): Check for INTENT(IN) variable
in SELECT TYPE construct.

2019-06-13  Steven G. Kargl  

PR fortran/89344
 * gfortran.dg/pr89344.f90: New test.

Added:
trunk/gcc/testsuite/gfortran.dg/pr89344.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/expr.c
trunk/gcc/testsuite/ChangeLog

[Bug fortran/89344] uncaught programmer error: polymorphic variable is INTENT(IN) but assigned to without error

2019-02-18 Thread urbanjost at comcast dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89344

--- Comment #5 from urbanjost at comcast dot net ---
That was fast. Thanks!

[Bug fortran/89344] uncaught programmer error: polymorphic variable is INTENT(IN) but assigned to without error

2019-02-13 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89344

Dominique d'Humieres  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-02-13
 Ever confirmed|0   |1

--- Comment #4 from Dominique d'Humieres  ---
Confirmed from at least 4.8 up to trunk (9.0).

[Bug fortran/89344] uncaught programmer error: polymorphic variable is INTENT(IN) but assigned to without error

2019-02-13 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89344

--- Comment #3 from kargl at gcc dot gnu.org ---
Created attachment 45708
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45708=edit
Patch that detects and issues an error.

Patch that detects and issues an error.  Trunk is in stage 4, so the patch will
likely get committed after 9.1 is released.

[Bug fortran/89344] uncaught programmer error: polymorphic variable is INTENT(IN) but assigned to without error

2019-02-13 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89344

kargl at gcc dot gnu.org changed:

   What|Removed |Added

   Priority|P3  |P4
 CC||kargl at gcc dot gnu.org

--- Comment #2 from kargl at gcc dot gnu.org ---
My version of gfortran gives

% gfcx -c a.f90
a.f90:8:35:

8 |type is (integer);  value=10
  |   1
Error: Dummy argument 'value' with INTENT(IN) in variable definition context
(assignment) at (1)
a.f90:9:35:

9 |type is (real); value=10.20
  |   1
Error: Dummy argument 'value' with INTENT(IN) in variable definition context
(assignment) at (1)

[Bug fortran/89344] uncaught programmer error: polymorphic variable is INTENT(IN) but assigned to without error

2019-02-13 Thread urbanjost at comcast dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89344

urbanjost at comcast dot net changed:

   What|Removed |Added

   Keywords||diagnostic
Summary|intent  |uncaught programmer error:
   ||polymorphic variable is
   ||INTENT(IN) but assigned to
   ||without error

--- Comment #1 from urbanjost at comcast dot net ---
program demo_setval
   call setval(value)
   write(*,*)'VALUE=',value
CONTAINS
   subroutine setval(value)
  class(*),intent(in)  :: value
  select type(value)
   type is (integer);  value=10
   type is (real); value=10.20
  end select
   end subroutine setval
end program demo_setval
! expect to get something like
!Error: Dummy argument 'value' with INTENT(IN) in variable definition
context (assignment) at (1)
! but do not even though VALUE is INTENT(IN) and changed the value


There is a programmer error in the example program. The variable VALUE has been
declared to be INTENT(IN) but the routine assigns a value to the variable. This
should be caught at compile time.