summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorpault <pault@138bc75d-0d04-0410-961f-82ee72b054a4>2007-04-07 20:18:17 +0000
committerpault <pault@138bc75d-0d04-0410-961f-82ee72b054a4>2007-04-07 20:18:17 +0000
commitd0f6ad221bbc8263318fe77adbbb253924f4831a (patch)
treeb6ec665721fde1724f006a43410149ae5b59facf /gcc
parent2eda6de3a07eb8f1ba6d3f8c72faf0dfe36cabfd (diff)
downloadgcc-d0f6ad221bbc8263318fe77adbbb253924f4831a.tar.gz
2007-04-07 Paul Thomas <pault@gcc.gnu.org>
PR fortran/31214 * trans-decl.c (gfc_get_symbol_decl): Allow unreferenced use associated symbols. 2007-04-07 Paul Thomas <pault@gcc.gnu.org> PR fortran/31424 * gfortran.dg/unreferenced_use_assoc_1.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@123642 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/trans-decl.c3
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/unreferenced_use_assoc_1.f9040
4 files changed, 53 insertions, 1 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index e72aa0d7021..2079580daa7 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,5 +1,11 @@
2007-04-07 Paul Thomas <pault@gcc.gnu.org>
+ PR fortran/31214
+ * trans-decl.c (gfc_get_symbol_decl): Allow unreferenced use
+ associated symbols.
+
+2007-04-07 Paul Thomas <pault@gcc.gnu.org>
+
PR fortran/31293
* symbol.c (gfc_check_function_type): New function.
* gfortran.h : Add prototype for previous.
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 6cd13048512..fa75260d00b 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -873,7 +873,8 @@ gfc_get_symbol_decl (gfc_symbol * sym)
int byref;
gcc_assert (sym->attr.referenced
- || sym->ns->proc_name->attr.if_source == IFSRC_IFBODY);
+ || sym->attr.use_assoc
+ || sym->ns->proc_name->attr.if_source == IFSRC_IFBODY);
if (sym->ns && sym->ns->proc_name->attr.function)
byref = gfc_return_by_reference (sym->ns->proc_name);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 2f7fe10d94b..8bb09344004 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2007-04-07 Paul Thomas <pault@gcc.gnu.org>
+ PR fortran/31424
+ * gfortran.dg/unreferenced_use_assoc_1.f90: New test.
+
+2007-04-07 Paul Thomas <pault@gcc.gnu.org>
+
PR fortran/31293
* gfortran.dg/interface_12.f90: New test.
diff --git a/gcc/testsuite/gfortran.dg/unreferenced_use_assoc_1.f90 b/gcc/testsuite/gfortran.dg/unreferenced_use_assoc_1.f90
new file mode 100644
index 00000000000..57892d5328f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/unreferenced_use_assoc_1.f90
@@ -0,0 +1,40 @@
+! { dg-do compile }
+! Tests the fix for PR31424.
+!
+module InternalCompilerError
+
+ type Byte
+ private
+ character(len=1) :: singleByte
+ end type
+
+ type (Byte) :: BytesPrototype(1)
+
+ type UserType
+ real :: r
+ end type
+
+contains
+
+ function UserTypeToBytes(user) result (bytes)
+ type(UserType) :: user
+ type(Byte) :: bytes(size(transfer(user, BytesPrototype)))
+ bytes = transfer(user, BytesPrototype)
+ end function
+
+ subroutine DoSomethingWithBytes(bytes)
+ type(Byte), intent(in) :: bytes(:)
+ end subroutine
+
+end module
+
+
+program main
+ use InternalCompilerError
+ type (UserType) :: user
+
+ ! The following line caused the ICE
+ call DoSomethingWithBytes( UserTypeToBytes(user) )
+
+end program
+! { dg-final { cleanup-modules "InternalCompilerError" } }