]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/31214 (User-defined operator using entry leads to ICE)
authorPaul Thomas <pault@gcc.gnu.org>
Sat, 7 Apr 2007 20:18:17 +0000 (20:18 +0000)
committerPaul Thomas <pault@gcc.gnu.org>
Sat, 7 Apr 2007 20:18:17 +0000 (20:18 +0000)
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.

From-SVN: r123642

gcc/fortran/ChangeLog
gcc/fortran/trans-decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/unreferenced_use_assoc_1.f90 [new file with mode: 0644]

index e72aa0d7021112ed8eec8a8b2f13d1bdf3796323..2079580daa7d2877c1a1167ac900f22dfcb6115b 100644 (file)
@@ -1,3 +1,9 @@
+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
index 6cd13048512208e468bb9a5c22a06b5b7ab4497e..fa75260d00b8e867d00a3e8921c0f39d68b65581 100644 (file)
@@ -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);
index 2f7fe10d94bbbff23cef96fc7a212b59c3eb5795..8bb09344004e1e6bc80c2d3344ab84aa399681c7 100644 (file)
@@ -1,3 +1,8 @@
+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
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 (file)
index 0000000..57892d5
--- /dev/null
@@ -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" } }