* [patch, fortran] PR32760 Error defining subroutine named PRINT
@ 2007-07-27 6:15 Jerry DeLisle
2007-07-27 8:03 ` FX Coudert
0 siblings, 1 reply; 2+ messages in thread
From: Jerry DeLisle @ 2007-07-27 6:15 UTC (permalink / raw)
To: Fortran List; +Cc: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 622 bytes --]
Hi all,
This simple patch fixes this problem by avoiding gfc_add_flavor when the symbol
has the ACCESS_PUBLIC or ACCESS_PRIVATE attributes.
I must give credit to Daniel for tracking down the approximate location of this
bug which allowed me to hunt around some and find it.
Regression tested on x86-64-Gnu/Linux. Test case provided.
OK for trunk?
Regards,
Jerry
2007-07-26 Jerry DeLisle <jvdelisle@gcc.gnu.org>
Daniel Franke <franke.daniel@gmail.com>
PR fortran/32760
* primary.c (match_variable): Do not call gfc_add_flavor if symbol has
attribute of ACCESS_PUBLIC or ACCESS_PRIVATE already marked.
[-- Attachment #2: pr32760.diff --]
[-- Type: text/x-patch, Size: 453 bytes --]
Index: primary.c
===================================================================
--- primary.c (revision 126968)
+++ primary.c (working copy)
@@ -2452,6 +2452,9 @@ match_variable (gfc_expr **result, int e
break;
case FL_UNKNOWN:
+ if (sym->attr.access == ACCESS_PUBLIC
+ || sym->attr.access == ACCESS_PRIVATE)
+ break;
if (gfc_add_flavor (&sym->attr, FL_VARIABLE,
sym->name, NULL) == FAILURE)
return MATCH_ERROR;
[-- Attachment #3: private_type_7.f90 --]
[-- Type: text/x-fortran, Size: 548 bytes --]
! { dg-do compile }
! PR32760 Error defining subroutine named PRINT
! Test case derived from original PR.
module gfcbug68
implicit none
private :: write
contains
function foo (i)
integer, intent(in) :: i
integer foo
write (*,*) i
call write(i)
foo = i
end function foo
subroutine write (m)
integer, intent(in) :: m
print *, m*m*m
end subroutine write
end module gfcbug68
program testit
use gfcbug68
integer :: i = 27
integer :: k
k = foo(i)
print *, "in the main:", k
end program testit
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [patch, fortran] PR32760 Error defining subroutine named PRINT
2007-07-27 6:15 [patch, fortran] PR32760 Error defining subroutine named PRINT Jerry DeLisle
@ 2007-07-27 8:03 ` FX Coudert
0 siblings, 0 replies; 2+ messages in thread
From: FX Coudert @ 2007-07-27 8:03 UTC (permalink / raw)
To: Jerry DeLisle; +Cc: Fortran List, gcc-patches
> 2007-07-26 Jerry DeLisle <jvdelisle@gcc.gnu.org>
> Daniel Franke <franke.daniel@gmail.com>
>
> PR fortran/32760
> * primary.c (match_variable): Do not call gfc_add_flavor if symbol
> has
> attribute of ACCESS_PUBLIC or ACCESS_PRIVATE already marked.
OK
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-07-27 7:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-27 6:15 [patch, fortran] PR32760 Error defining subroutine named PRINT Jerry DeLisle
2007-07-27 8:03 ` FX Coudert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).