This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] PR fortran/66942 -- avoid referencing a NULL C++ thing
- From: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- To: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Tue, 21 Jul 2015 12:08:14 -0700
- Subject: [PATCH] PR fortran/66942 -- avoid referencing a NULL C++ thing
- Authentication-results: sourceware.org; auth=none
When C++ was injected into trans-expr.c in the form of vec,
it seems whomever did the conversion to vec forgot to check
for a NULL C++ thing. This patch seems to avoid the problem,
but having zero knowledge of C++ I could be wrong.
OK for trunk?
2015-07-21 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/66942
* trans-expr.c (gfc_conv_procedure_call): Avoid dereferencing NULL
C++ thing.
--
Steve
Index: trans-expr.c
===================================================================
--- trans-expr.c (revision 226006)
+++ trans-expr.c (working copy)
@@ -5921,13 +5921,16 @@ gfc_conv_procedure_call (gfc_se * se, gf
vec_safe_reserve (retargs, arglen);
/* Add the return arguments. */
- retargs->splice (arglist);
+ if (!vec_safe_is_empty (arglist))
+ retargs->splice (arglist);
/* Add the hidden present status for optional+value to the arguments. */
- retargs->splice (optionalargs);
+ if (!vec_safe_is_empty (optionalargs))
+ retargs->splice (optionalargs);
/* Add the hidden string length parameters to the arguments. */
- retargs->splice (stringargs);
+ if (!vec_safe_is_empty (stringargs))
+ retargs->splice (stringargs);
/* We may want to append extra arguments here. This is used e.g. for
calls to libgfortran_matmul_??, which need extra information. */