Commit 29ea08da by Tobias Burnus

re PR fortran/31668 (%VAL rejected for PROC_MODULE and PROC_INTERNAL procedures)

fortran/
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.

From-SVN: r124147
parent bef4d184
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
......
......@@ -414,7 +414,10 @@ error_print (const char *type, const char *format0, va_list argp)
continue;
if (*format == '%')
continue;
{
format++;
continue;
}
if (ISDIGIT (*format))
{
......
......@@ -2861,8 +2861,8 @@ keywords:
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);
......
......@@ -1040,7 +1040,8 @@ resolve_actual_arglist (gfc_actual_arglist *arg, procedure_type ptype)
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
......@@ -23,19 +30,19 @@
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
......@@ -134,7 +141,7 @@
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>
......@@ -9,6 +9,11 @@ program c_by_val_2
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" }
......
! { 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" } }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment