[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.