2007-04-25 Tobias Burnus <burnus@net-b.de>
PR fortran/31668
* error.c (error_print): Fix %% support.
* intrinsic.c (sort_actual): Improve error message.
* resolve.c (resolve_actual_arglist): Allow %VAL for
interfaces defined in the module declaration part.
testsuite/
2007-04-25 Tobias Burnus <burnus@net-b.de>
PR fortran/31668
* gfortran.dg/c_by_val_2.f90: Add rejection test of %VAL with
statement functions.
* gfortran.dg/c_by_val_5.f90: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@124147
138bc75d-0d04-0410-961f-
82ee72b054a4
+2007-04-25 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/31668
+ * error.c (error_print): Fix %% support.
+ * intrinsic.c (sort_actual): Improve error message.
+ * resolve.c (resolve_actual_arglist): Allow %VAL for
+ interfaces defined in the module declaration part.
+
2007-04-25 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR libfortran/31299
continue;
if (*format == '%')
- continue;
+ {
+ format++;
+ continue;
+ }
if (ISDIGIT (*format))
{
if (f == NULL)
{
if (a->name[0] == '%')
- gfc_error ("Argument list function at %L is not allowed in this "
- "context", where);
+ gfc_error ("The argument list functions %%VAL, %%LOC or %%REF "
+ "are not allowed in this context at %L", where);
else
gfc_error ("Can't find keyword named '%s' in call to '%s' at %L",
a->name, name, where);
intrinsic.c. */
if (ptype != PROC_UNKNOWN
&& ptype != PROC_DUMMY
- && ptype != PROC_EXTERNAL)
+ && ptype != PROC_EXTERNAL
+ && ptype != PROC_MODULE)
{
gfc_error ("By-value argument at %L is not allowed "
"in this context", &e->where);
+2007-04-25 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/31668
+ * gfortran.dg/c_by_val_2.f90: Add rejection test of %VAL with
+ statement functions.
+ * gfortran.dg/c_by_val_5.f90: New test.
+
2007-04-25 Wolfgang Gellerich <gellerich@de.ibm.com>
* gfortran.dg/equiv_6.f90 (set_arrays): Replaced subroutine
2007-04-24 Douglas Gregor <doug.gregor@gmail.com>
- * g++.old-deja/g++.pt/defarg6.C: Only run with
- -std=gnu++98.
- * g++.old-deja/g++.pt/ucnid-1.C: Ditto.
- * g++.dg/cpp0x/variadic61.C: Ditto.
- * g++.dg/cpp0x/warn_cxx0x.C: Ditto.
- * g++.dg/cpp0x/variadic62.C: Ditto.
- * g++.dg/template/meminit1.C: Ditto.
- * g++.dg/template/operator7.C: Ditto.
- * g++.dg/template/static15.C: Ditto.
- * g++.dg/template/invalid1.C: Ditto.
- * g++.dg/template/shift1.C: Ditto.
- * g++.dg/template/error10.C: Ditto.
-
+ * g++.old-deja/g++.pt/defarg6.C: Only run with
+ -std=gnu++98.
+ * g++.old-deja/g++.pt/ucnid-1.C: Ditto.
+ * g++.dg/cpp0x/variadic61.C: Ditto.
+ * g++.dg/cpp0x/warn_cxx0x.C: Ditto.
+ * g++.dg/cpp0x/variadic62.C: Ditto.
+ * g++.dg/template/meminit1.C: Ditto.
+ * g++.dg/template/operator7.C: Ditto.
+ * g++.dg/template/static15.C: Ditto.
+ * g++.dg/template/invalid1.C: Ditto.
+ * g++.dg/template/shift1.C: Ditto.
+ * g++.dg/template/error10.C: Ditto.
+
2007-04-24 Simon Martin <simartin@users.sourceforge.net>
PR diagnostic/25923
2007-04-22 Revital Eres <eres@il.ibm.com>
- * gcc.dg/var-expand2.c: New test.
+ * gcc.dg/var-expand2.c: New test.
2007-04-22 Revital Eres <eres@il.ibm.com>
end type mytype
type(mytype) :: z
character(8) :: c = "blooey"
+ real :: stmfun, x
+ stmfun(x)=x**2
+
+ x = 5
+ print *, stmfun(%VAL(x)) ! { dg-error "not allowed in this context" }
print *, sin (%VAL(2.0)) ! { dg-error "not allowed in this context" }
print *, foo (%VAL(1.0)) ! { dg-error "not allowed in this context" }
call foobar (%VAL(0.5)) ! { dg-error "not allowed in this context" }
--- /dev/null
+! { dg-do run }
+! Overwrite -pedantic setting:
+! { dg-options "-Wall" }
+!
+! Tests the fix for PR31668, in which %VAL was rejected for
+! module and internal procedures.
+!
+
+subroutine bmp_write(nx)
+ implicit none
+ integer, value :: nx
+ if(nx /= 10) call abort()
+ nx = 11
+ if(nx /= 11) call abort()
+end subroutine bmp_write
+
+module x
+ implicit none
+ ! The following interface does in principle
+ ! not match the procedure (missing VALUE attribute)
+ ! However, this occures in real-world code calling
+ ! C routines where an interface is better than
+ ! "external" only.
+ interface
+ subroutine bmp_write(nx)
+ integer :: nx
+ end subroutine bmp_write
+ end interface
+contains
+ SUBROUTINE Grid2BMP(NX)
+ INTEGER, INTENT(IN) :: NX
+ if(nx /= 10) call abort()
+ call bmp_write(%val(nx))
+ if(nx /= 10) call abort()
+ END SUBROUTINE Grid2BMP
+END module x
+
+! The following test is possible and
+! accepted by other compilers, but
+! does not make much sense.
+! Either one uses VALUE then %VAL is
+! not needed or the function will give
+! wrong results.
+!
+!subroutine test()
+! implicit none
+! integer :: n
+! n = 5
+! if(n /= 5) call abort()
+! call test2(%VAL(n))
+! if(n /= 5) call abort()
+! contains
+! subroutine test2(a)
+! integer, value :: a
+! if(a /= 5) call abort()
+! a = 2
+! if(a /= 2) call abort()
+! end subroutine test2
+!end subroutine test
+
+program main
+ use x
+ implicit none
+! external test
+ call Grid2BMP(10)
+! call test()
+end program main
+
+! { dg-final { cleanup-modules "x" } }