]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/34848 (internal compiler error with optional argument of character...
authorTobias Burnus <burnus@net-b.de>
Tue, 22 Jan 2008 19:35:49 +0000 (20:35 +0100)
committerTobias Burnus <burnus@gcc.gnu.org>
Tue, 22 Jan 2008 19:35:49 +0000 (20:35 +0100)
2008-01-22  Tobias Burnus  <burnus@net-b.de>

       PR fortran/34848
       * interface.c (compare_actual_formal): Fix adding type
       to missing_arg_type for absent optional arguments.

2008-01-22  Tobias Burnus  <burnus@net-b.de>

       PR fortran/34848
       * gfortran.dg/missing_optional_dummy_4.f90

From-SVN: r131738

gcc/fortran/ChangeLog
gcc/fortran/interface.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/missing_optional_dummy_4.f90 [new file with mode: 0644]

index fd6efa3dbba9bf179338e8248834ae8cfffb22a3..134c0c4e6699b73b6be3f163ebf6664f1f665563 100644 (file)
@@ -1,3 +1,9 @@
+2008-01-22  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/34848
+       * interface.c (compare_actual_formal): Fix adding type
+       to missing_arg_type for absent optional arguments.
+
 2008-01-22  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/34907
index ef639845c7891670812b4d4ca8fd0de216a3d6fc..8b73adcf3c8a9d9e1a505ad5c5a1b40910cb136a 100644 (file)
@@ -2147,7 +2147,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
     *ap = new[0];
 
   /* Note the types of omitted optional arguments.  */
-  for (a = actual, f = formal; a; a = a->next, f = f->next)
+  for (a = *ap, f = formal; a; a = a->next, f = f->next)
     if (a->expr == NULL && a->label == NULL)
       a->missing_arg_type = f->sym->ts.type;
 
index 82f22c06faf893b889ecc58cfeb2d46ceda521fc..7dcbbcb768ac546a2a808c79b9f0106bb46a065f 100644 (file)
@@ -1,3 +1,8 @@
+2008-01-22  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/34848
+       * gfortran.dg/missing_optional_dummy_4.f90
+
 2008-01-22  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * gcc.dg/vect/vect-ifcvt-9.c: Use inline.
diff --git a/gcc/testsuite/gfortran.dg/missing_optional_dummy_4.f90 b/gcc/testsuite/gfortran.dg/missing_optional_dummy_4.f90
new file mode 100644 (file)
index 0000000..9b1a574
--- /dev/null
@@ -0,0 +1,28 @@
+! { dg-do compile }
+! { dg-options "-fdump-tree-original" }
+!
+! PR fortran/34848
+! 
+! The "0" for the string size of the absent optional
+! argument was missing.
+!
+module krmod
+contains
+ subroutine doit()
+   implicit none
+    real :: doit1
+    doit1 = tm_doit()
+   return
+ end subroutine doit
+ function tm_doit(genloc)
+   implicit none
+   character, optional  :: genloc
+   real :: tm_doit
+   tm_doit = 42.0 
+ end function tm_doit
+end module krmod
+
+! { dg-final { scan-tree-dump " tm_doit \\(0B, 0\\);" "original" } }
+! { dg-final { cleanup-tree-dump "original" } }
+! { dg-final { cleanup-modules "krmod" } }
+