This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/42651] New: Functions with result: Wrongly accepts attributes to function name
- From: "burnus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 7 Jan 2010 17:21:59 -0000
- Subject: [Bug fortran/42651] New: Functions with result: Wrongly accepts attributes to function name
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Using VOLATILE, TARGET etc. for function names is valid, but only if there is
no extra RESULT variable.
I thought the following would fix it, but it does not seem to work:
if (attr->function && !attr->result)
{
a1 = function;
conf2 (allocatable);
conf2 (asynchronous);
conf2 (dimension);
conf2 (pointer);
conf2 (target);
conf2 (volatile_);
}
Test case:
integer function func()
asynchronous :: func
integer, asynchronous:: b
allocatable :: c
volatile :: func
type t
sequence
integer :: i = 5
end type t
end function func
function func2() result(res)
volatile res
volatile func2 ! { dg-error "FUNCTION attribute conflicts with VOLATILE"
}
asynchronous res
asynchronous func2 ! { dg-error "FUNCTION attribute conflicts with
ASYNCHRONOUS" }
allocatable func2 ! { dg-error "FUNCTION attribute conflicts with
ALLOCATABLE" }
target func2 ! { dg-error "FUNCTION attribute conflicts with TARGET" }
dimension func2(2) ! { dg-error "FUNCTION attribute conflicts with DIMENSION"
}
end function func2
--
Summary: Functions with result: Wrongly accepts attributes to
function name
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Keywords: accepts-invalid
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: burnus at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42651