std::visit(
common::visitors{
[&](const parser::Name &name) {
- const Symbol &symbol{DEREF(name.symbol)};
- if (context_.HasError(&symbol)) {
+ const Symbol *symbol{name.symbol};
+ if (context_.HasError(symbol)) {
// already reported an error
- } else if (!IsVariableName(symbol) && !IsProcName(symbol)) {
+ } else if (!IsVariableName(*symbol) && !IsProcName(*symbol)) {
messages.Say(name.source,
"name in NULLIFY statement must be a variable or procedure pointer name"_err_en_US);
- } else if (!IsPointer(symbol)) { // C951
+ } else if (!IsPointer(*symbol)) { // C951
messages.Say(name.source,
"name in NULLIFY statement must have the POINTER attribute"_err_en_US);
} else if (pure) {
- CheckDefinabilityInPureScope(messages, symbol, scope, *pure);
+ CheckDefinabilityInPureScope(messages, *symbol, scope, *pure);
}
},
[&](const parser::StructureComponent &structureComponent) {
Nullify(maxvalue)
End Program
+
+! Make sure that the compiler doesn't crash when NULLIFY is used in a context
+! that has reported errors
+module badNullify
+ interface
+ module function ptrFun()
+ integer, pointer :: ptrFun
+ end function
+ end interface
+contains
+ !ERROR: 'ptrfun' was not declared a separate module procedure
+ module function ptrFun()
+ integer, pointer :: ptrFun
+ real :: realVar
+ nullify(ptrFun)
+ nullify(realVar)
+ end function
+end module