diff options
author | Andrew Macleod <amacleod@redhat.com> | 2016-05-10 03:30:56 +0000 |
---|---|---|
committer | Andrew Macleod <amacleod@redhat.com> | 2016-05-10 03:30:56 +0000 |
commit | 357ceb7fe26970b6c6e12f0bb2ceecab6c6a2454 (patch) | |
tree | 48eb1f57289f4e995f069f38213ad5c8a16f0347 /gcc/testsuite/gfortran.dg/dec_union_6.f90 | |
parent | 5ed230ef2005822d6402118e58a311db2a9cb0c7 (diff) | |
parent | 8a50780e586342528692744150d08651fb07fb43 (diff) |
update to 2016-05-09ttype-2016-05-03
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/ttype-2016-05-03@236057 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gfortran.dg/dec_union_6.f90')
-rw-r--r-- | gcc/testsuite/gfortran.dg/dec_union_6.f90 | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/dec_union_6.f90 b/gcc/testsuite/gfortran.dg/dec_union_6.f90 new file mode 100644 index 00000000000..31059c46880 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/dec_union_6.f90 @@ -0,0 +1,59 @@ +! { dg-do run } +! { dg-options "-fdec-structure" } +! +! sub0 and sub1 test a regression where calling gfc_use_derived from +! gfc_find_component on the structure type symbol being parsed caused the +! symbol to be freed and swapped for the previously seen type symbol, leaving +! dangling pointers and causing all sorts of mayhem. +! + +subroutine sub0 (u) + structure /s/ + union ! U0 + map ! M0 + integer i + end map + end union + end structure + record /s/ u + u.i = 0 +end subroutine sub0 + +subroutine sub1 () + structure /s/ + union ! U1 + map ! M1 + integer i + end map + end union + end structure + record /s/ u + interface ! matches the declaration of sub0 above + subroutine sub0 (u) + structure /s/ + union ! U2 + map ! M2 + integer i ! gfc_find_component should not call gfc_use_derived + end map ! here, otherwise this structure's type symbol is freed + end union ! out from under it + end structure + record /s/ u + end subroutine sub0 + end interface + call sub0(u) +end subroutine + +! If sub0 and sub1 aren't used they may be omitted +structure /s/ + union ! U1 + map ! M3 + integer i + end map + end union +end structure +record /s/ u + +call sub0(u) +call sub1() + +end |