The attached source code file demonstrates two compiler errors that appear to be incorrect. When compiled as is (with sub1 commented out), the compiler states that "grad" has "already been used as an external function name", which it has not -- here the code should compile.
A second error can be produced if sub1 is uncommented and sub2 and sub3 are commented out. Here the code should not compile, but the compiler error is misleading: it says that "grad" has "already been used as a dummy function name". A different compiler gives me a more correct error for this case: "'pointer' argument of 'associated' interinsic must be a POINTER".