diff mbox

[fortran] PR80164 ICE in gfc_format_decoder at gcc/fortran/error.c:933

Message ID ba78109f-35ca-fb3b-d9af-bb917c91e752@charter.net
State New
Headers show

Commit Message

Jerry DeLisle June 28, 2017, 1:54 a.m. UTC
I plan to commit the following patch that was provided by Steve in PR on 
Bugzilla.  Simple. I will also backport to 7. Without patch we get a segfault 
when -Warray-temporaries is used on several existing test cases.  I will prepare 
a test case based on one of those.

Regards,

Jerry

2017-06-27  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/80164
	* trans-stmt.c (gfc_trans_call): If no code expr, use code->loc
	as warning/error locus.
diff mbox

Patch

diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c
index e4f1da54..a1e1dff7 100644
--- a/gcc/fortran/trans-stmt.c
+++ b/gcc/fortran/trans-stmt.c
@@ -452,7 +452,11 @@  gfc_trans_call (gfc_code * code, bool dependency_check,
          subscripts.  This could be prevented in the elemental case
          as temporaries are handled separatedly
          (below in gfc_conv_elemental_dependencies).  */
-      gfc_conv_loop_setup (&loop, &code->expr1->where);
+      if (code->expr1)
+       gfc_conv_loop_setup (&loop, &code->expr1->where);
+      else
+       gfc_conv_loop_setup (&loop, &code->loc);
+
        gfc_mark_ss_chain_used (ss, 1);

        /* Convert the arguments, checking for dependencies.  */