This patch does two things: a) It finally implements locking/unlocking with -fcoarray=lib. Before it was effectively a no op operation always succeeding. - The implementation only works for "normal" locking variables - and neither for CLASS, type extension or lock components of derived types. b) It adds a compile-time error for the cases not supported, avoiding race conditions due to an only apparently working locking (as it would be the case with the implementation before the patch). Build and regtested on x86-64-gnu-linux. OK for the GCC 5 trunk? Tobias