http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56519

             Bug #: 56519
           Summary: DO CONCURRENT: wrongly accepts calls to impure
                    intrinsics
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: bur...@gcc.gnu.org


Based on
https://groups.google.com/d/topic/comp.lang.fortran/cZ1KQ_2Zt_c/discussion

The following program is accepted, but the intrinsic procedure is IMPURE.
(F2008:)

C825   A reference to a nonpure procedure shall not appear within a
       DO CONCURRENT construct.

Note: "All standard intrinsic functions are pure." (cf. F2008, 13.1). But only
some subroutines are pure. However, in intrinsics.c, the used intrinsic
subroutine is marked as CLASS_IMPURE! And in principle,
gfc_intrinsic_sub_interface checks for this – but it does not seem to work,
here. While it triggers in a URE subroutine.


implicit none
integer :: i
real :: array(123), val

do concurrent (i = 1:123)
  call random_number (val) ! INVALID: Impure but accepted
  array(i) = val

  !call foo(array) ! OK; rejected with:
  !       Subroutine call to 'foo' in DO CONCURRENT block at (1) is not PURE
end do
end

Reply via email to