diff --git a/src/snc/gen_ss_code.c b/src/snc/gen_ss_code.c index eaba2db38126c17d665a777f12a0f39285e46bf9..243d50ca40460d45660a64bed24617b05bb450f2 100644 --- a/src/snc/gen_ss_code.c +++ b/src/snc/gen_ss_code.c @@ -670,15 +670,31 @@ static void gen_pv_func( if (ap->type == E_VAR) { vp = ap->extra.e_var; - if (vp->assign == M_MULTI && !global_options.newpv) + assert(vp); + if (vp->assign == M_MULTI) { - error_at_expr(ap, - "1st argument '%s' to function '%s' must not be a multi-PV array\n", - vp->name, func_name); - report_at_expr(ap, "Perhaps you meant %s[0]?\n", vp->name); - report_at_expr(ap, "Use option +p to allow this but then " - "pv functions operate on all contained PVs\n"); - return; + if (!add_length) + { + error_at_expr(ap, + "passing multi-PV array '%s' to function '%s' is not " + "(yet?) allowed\n", + vp->name, func_name); + return; + } + if (!global_options.newpv) + { + error_at_expr(ap, + "passing multi-PV array '%s' to function '%s' is not " + "allowed in compatibility mode (option -p)\n", + vp->name, func_name); + report_at_expr(ap, "Perhaps you meant to pass '%s[0]'?\n", vp->name); + if (add_length) + { + report_at_expr(ap, "Use option +p to allow this but then " + "pv functions operate on all contained PVs\n"); + } + return; + } } } else if (ap->type == E_SUBSCR)