From 7d54cccad332074d5fb81123796239f0f61b11a7 Mon Sep 17 00:00:00 2001 From: Thomas Koenig Date: Mon, 25 Jan 2021 20:27:15 +0100 Subject: [PATCH] Commit test case for PR 96386. gcc/testsuite/ChangeLog: * gfortran.dg/associate_57.f90: New test. --- gcc/testsuite/gfortran.dg/associate_57.f90 | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/associate_57.f90 diff --git a/gcc/testsuite/gfortran.dg/associate_57.f90 b/gcc/testsuite/gfortran.dg/associate_57.f90 new file mode 100644 index 00000000000..80c76684174 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/associate_57.f90 @@ -0,0 +1,47 @@ +! { dg-do compile } +! PR 96386 - this used to cause an ICE. +! Test case by Menno Deij - van Rijswijk. + +MODULE assoc + +TYPE Level3 + INTEGER :: someNumber +END TYPE Level3 + +TYPE Level2 + INTEGER :: nLevel3 + TYPE (Level3), ALLOCATABLE :: levels3(:) + +END TYPE Level2 + +TYPE Level1 + INTEGER :: nLevel2 + TYPE (Level2), ALLOCATABLE :: levels2(:) +END TYPE Level1 + +TYPE outer_type + INTEGER :: nLevel1 + TYPE (Level1), ALLOCATABLE :: levels1(:) +END TYPE outer_type + +TYPE(outer_type), TARGET :: outer + +CONTAINS + +SUBROUTINE internal_compiler_error_repro() + +INTEGER F,B,Z + +ASSOCIATE(l1 => outer%levels1 ) ! <-- this gives an ICE +!ASSOCIATE(l1 => outer%levels1(:) ) ! <-- No ICE if array spec is added + DO F=1,outer%nLevel1 + ASSOCIATE(l2 => l1(F)%levels2 ) + DO B=1,l2(F)%nLevel3 ! <-- condition for ICE to be triggered + + END DO + END ASSOCIATE + END DO +END ASSOCIATE + +END SUBROUTINE internal_compiler_error_repro +end module -- 2.30.2