extern int var; static int var; /* Undefined behaviour */
C11, §6.2.2, 7 says:
If, within a translation unit, the same identiﬁer appears with both internal and external linkage, the behavior is undeﬁned.
Note that if an prior declaration of an identifier is visible then it'll have the prior declaration's linkage. C11, §6.2.2, 4 allows it:
For an identiﬁer declared with the storage-class speciﬁer extern in a scope in which a prior declaration of that identiﬁer is visible,31) if the prior declaration speciﬁes internal or external linkage, the linkage of the identiﬁer at the later declaration is the same as the linkage speciﬁed at the prior declaration. If no prior declaration is visible, or if the prior declaration speciﬁes no linkage, then the identiﬁer has external linkage.
/* 1. This is NOT undefined */ static int var; extern int var; /* 2. This is NOT undefined */ static int var; static int var; /* 3. This is NOT undefined */ extern int var; extern int var;