]> gcc.gnu.org Git - gcc.git/commitdiff
re PR fortran/18578 (intent(inout) violation is not detected)
authorPaul Thomas <pault@gcc.gnu.org>
Sun, 29 Jan 2006 16:31:24 +0000 (16:31 +0000)
committerPaul Thomas <pault@gcc.gnu.org>
Sun, 29 Jan 2006 16:31:24 +0000 (16:31 +0000)
2006-01-29  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/18578
PR fortran/18579
PR fortran/20857
PR fortran/20885
* interface.c (compare_actual_formal): Error for INTENT(OUT or INOUT)
if actual argument is not a variable.

2006-01-29  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/18578
PR fortran/18579
PR fortran/20857
PR fortran/20885
* gfortran.dg/intent_out_1.f90: New test.

From-SVN: r110376

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

index b5220e1f927a4d28010349af5ce6784c25f2d7fc..4eb14b89d161d4c3f9eaf451b966fab695c9c7da 100644 (file)
@@ -1,3 +1,12 @@
+2006-01-29  Paul Thomas  <pault@gcc.gnu.org>
+
+       PR fortran/18578
+       PR fortran/18579
+       PR fortran/20857
+       PR fortran/20885
+       * interface.c (compare_actual_formal): Error for INTENT(OUT or INOUT)
+       if actual argument is not a variable.
+
 2006-01-28  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/17911
index e3a13f5d9e47883e39a50113fd954b7615d8fc37..93e3657af71a94859f1dc34513f622a92b648dcc 100644 (file)
@@ -1273,6 +1273,16 @@ compare_actual_formal (gfc_actual_arglist ** ap,
          return 0;
        }
 
+      /* Check intent = OUT/INOUT for definable actual argument.  */
+      if (a->expr->expr_type != EXPR_VARIABLE
+            && (f->sym->attr.intent == INTENT_OUT
+                  || f->sym->attr.intent == INTENT_INOUT))
+       {
+         gfc_error ("Actual argument at %L must be definable to "
+                    "match dummy INTENT = OUT/INOUT", &a->expr->where);
+          return 0;
+        }
+
     match:
       if (a == actual)
        na = i;
index 3c19025366961af9d3d1bfd1114d9f5407edc31c..bd6eade6dba13fe78f057e71fde9370d474456e9 100644 (file)
@@ -1,5 +1,13 @@
 2006-01-29  Paul Thomas  <pault@gcc.gnu.org>
 
+       PR fortran/18578
+       PR fortran/18579
+       PR fortran/20857
+       PR fortran/20885
+       * gfortran.dg/intent_out_1.f90: New test.
+
+2006-01-28  Paul Thomas  <pault@gcc.gnu.org>
+
        PR fortran/17911
        * gfortran.dg/procedure_lvalue.f90: New test.
 
diff --git a/gcc/testsuite/gfortran.dg/intent_out_1.f90 b/gcc/testsuite/gfortran.dg/intent_out_1.f90
new file mode 100644 (file)
index 0000000..62d7415
--- /dev/null
@@ -0,0 +1,19 @@
+! { dg-do compile }
+! Tests the fix for PRs 18578, 18579 and their repeats 20857 and 20885.
+! Contributed by Paul Thomas  <pault@gcc@gnu.org>
+  real, parameter :: a =42.0
+  real :: b
+  call foo(b + 2.0)    ! { dg-error "must be definable" }
+  call foo(a)          ! { dg-error "must be definable" }
+  call bar(b + 2.0)    ! { dg-error "must be definable" }
+  call bar(a)          ! { dg-error "must be definable" }
+contains
+  subroutine foo(a)
+    real, intent(out) :: a
+    a = 0.0
+  end subroutine foo
+  subroutine bar(a)
+    real, intent(INout) :: a
+    a = 0.0
+  end subroutine bar
+end
This page took 0.116429 seconds and 5 git commands to generate.