aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/gfortran.h
diff options
context:
space:
mode:
authormikael <mikael@138bc75d-0d04-0410-961f-82ee72b054a4>2015-10-18 17:17:21 +0000
committermikael <mikael@138bc75d-0d04-0410-961f-82ee72b054a4>2015-10-18 17:17:21 +0000
commite8c36e7ea7b89f501a3b7e1875db10a1aeb6d1f3 (patch)
tree825f09b858c7489a7824b502280e56fef764f000 /gcc/fortran/gfortran.h
parentfb296c25e58fd612765c934545ecaf880eb94117 (diff)
Fix common-related error recovery ICE.
Fix an inconsistent state, between the in_common attribute and the common_block pointer. - adding a symbol to a common block list in gfc_match_common is delayed after the call to gfc_add_in_common. - gfc_restore_latest_undo_checkpoint is changed to check the common_block pointer directly instead of the in_common attribute. - gfc_restore_old_symbol is changed to also restore the common-related pointers. This is done using a new function created to factor the related memory management. - In gfc_restore_last_undo_checkpoint, when a symbol has been removed from the common block linked list, its common_next pointer is cleared. PR fortran/67758 gcc/fortran/ * gfortran.h (gfc_symbol): Expand comment. * match.c (gfc_match_common): Delay adding the symbol to the common_block after the gfc_add_in_common call. * symbol.c (gfc_free_symbol): Move common block memory handling... (gfc_set_symbol_common_block): ... here as a new function. (restore_old_symbol): Restore common block fields. (gfc_restore_last_undo_checkpoint): Check the common_block pointer instead of the in_common attribute. When a symbol has been removed from the common block linked list, clear its common_next pointer. gcc/testsuite/ * gfortran.dg/common_25.f90: New file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@228947 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/gfortran.h')
-rw-r--r--gcc/fortran/gfortran.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index 9c0084be77c..b2894cc22c4 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -1411,8 +1411,12 @@ typedef struct gfc_symbol
struct gfc_symbol *common_next; /* Links for COMMON syms */
- /* This is in fact a gfc_common_head but it is only used for pointer
- comparisons to check if symbols are in the same common block. */
+ /* This is only used for pointer comparisons to check if symbols
+ are in the same common block.
+ In opposition to common_block, the common_head pointer takes into account
+ equivalences: if A is in a common block C and A and B are in equivalence,
+ then both A and B have common_head pointing to C, while A's common_block
+ points to C and B's is NULL. */
struct gfc_common_head* common_head;
/* Make sure setup code for dummy arguments is generated in the correct