Silverfrost Forums

Welcome to our forums

Procedure arguments with /CHECK

3 Mar 2013 12:21 #11648

The following code gives an incorrect error message when compiled and run with /CHECK

MODULE m1
CONTAINS
 FUNCTION f()
  INTEGER :: f
  f=0
 END FUNCTION f
END MODULE m1

MODULE m2
CONTAINS
 SUBROUTINE s (g)
  INTEGER, EXTERNAL :: g
  PRINT *, g()
 END SUBROUTINE s
END MODULE m2

WINAPP
PROGRAM p
 USE m1
 CALL s (f)
END PROGRAM p
9 Apr 2013 2:54 #12004

I have logged this for investigation.

9 Apr 2013 4:27 #12008

But s is in m2 and isn't in m1.

Therefore s is being treated as an EXTERNAL subroutine and you should get a run time errror _s not found with that code.

I think the code simon should have posted is this (I have added a missing USE statement). This generates the run-time error with /CHECK 😉 .

MODULE m1
CONTAINS
 FUNCTION f()
  INTEGER :: f
  f=0
 END FUNCTION f
END MODULE m1

MODULE m2
CONTAINS
 SUBROUTINE s (g)
  INTEGER, EXTERNAL :: g
  PRINT *, g()
 END SUBROUTINE s
END MODULE m2

WINAPP
PROGRAM p
 USE m1
 USE m2
 CALL s (f)
END PROGRAM p
12 Mar 2014 7:26 #13832

This bug has now been fixed for the next release.

Please login to reply.