Tejas Belagod wrote:
I observed that this patch causes an ICE with one of the fortran
tests. I've filed a bug report here:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57912.
Thanks for the report! For some reason, the following bit from my local
tree didn't end up in the patch. Committed as Rev. 200987.
Tobias
PS: Your backtrace in the PR looks odd; I get the following (also on
x86-64-gnu-linux), which is much more reasonable. I wonder why yours is off.
0x5fb0ee gfc_trans_scalar_assign(gfc_se*, gfc_se*, gfc_typespec, bool,
bool, bool)
../../gcc/fortran/trans-expr.c:6862
0x606e62 gfc_trans_assignment_1
../../gcc/fortran/trans-expr.c:7792
0x5cb565 trans_code
../../gcc/fortran/trans.c:1646
0x5f434e gfc_generate_function_code(gfc_namespace*)
../../gcc/fortran/trans-decl.c:5524
0x5ccef1 gfc_generate_module_code(gfc_namespace*)
../../gcc/fortran/trans.c:1955
0x58b147 translate_all_program_units
../../gcc/fortran/parse.c:4496
0x58b147 gfc_parse_file()
../../gcc/fortran/parse.c:4706
0x5c7205 gfc_be_parse_file
../../gcc/fortran/f95-lang.c:189
Index: gcc/fortran/ChangeLog
===================================================================
--- gcc/fortran/ChangeLog (Revision 200986)
+++ gcc/fortran/ChangeLog (Arbeitskopie)
@@ -1,3 +1,9 @@
+2013-07-16 Tobias Burnus <bur...@net-b.de>
+
+ PR fortran/57912
+ * trans-expr.c (gfc_trans_scalar_assign): Correct if
+ condition for caf realloc.
+
2013-07-15 Tobias Burnus <bur...@net-b.de>
* trans-array.h (gfc_deallocate_alloc_comp_no_caf,
Index: gcc/fortran/trans-expr.c
===================================================================
--- gcc/fortran/trans-expr.c (Revision 200986)
+++ gcc/fortran/trans-expr.c (Arbeitskopie)
@@ -6857,9 +6857,8 @@ gfc_trans_scalar_assign (gfc_se * lse, gfc_se * rs
fold_convert (TREE_TYPE (lse->expr), rse->expr));
/* Restore pointer address of coarray components. */
- if (ts.u.derived->attr.coarray_comp && deep_copy)
+ if (ts.u.derived->attr.coarray_comp && deep_copy && tmp_var != NULL_TREE)
{
- gcc_assert (tmp_var != NULL_TREE);
tmp = gfc_reassign_alloc_comp_caf (ts.u.derived, tmp_var, lse->expr);
tmp = build3_v (COND_EXPR, cond, build_empty_stmt (input_location),
tmp);