public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/46271] New: OpenMP default(none) and procedure pointers
@ 2010-11-02 16:56 mrestelli at gmail dot com
2013-06-23 14:08 ` [Bug fortran/46271] " dominiq at lps dot ens.fr
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: mrestelli at gmail dot com @ 2010-11-02 16:56 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46271
Summary: OpenMP default(none) and procedure pointers
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: mrestelli@gmail.com
gfortran rejects the attached code both in version A and B. A similar
problem is discussed in
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44036
but, to my understanding, this only covers the case of a procedure
pointer associated with a function, not the subroutine case.
gfortran --version
GNU Fortran (GCC) 4.6.0 20101019 (experimental)
With version A:
gfortran -fopenmp omp_test.f90 -o omp_test
omp_test.f90:22.59:
!$omp private(i) shared(s,pf) default(none) ! version A
1
Error: Object 'pf' is not a variable at (1)
With version B:
gfortran -fopenmp omp_test.f90 -o omp_test
omp_test.f90: In function ‘test’:
omp_test.f90:25:0: error: ‘pf’ not specified in enclosing parallel
omp_test.f90:23:0: error: enclosing parallel
module ma
implicit none
contains
pure subroutine f(x,y)
real, intent(in) :: x
real, intent(out) :: y
y = sin(x)*cos(x)
end subroutine f
end module ma
program test
use ma, only: f
implicit none
integer :: i
real :: s(1000)
procedure(f), pointer :: pf
pf => f
!$omp parallel do schedule(static) &
! !$omp private(i) shared(s,pf) default(none) ! version A
!$omp private(i) shared(s) default(none) ! version B
do i=1,1000
call pf(real(i),s(i))
enddo
!$omp end parallel do
write(*,*) 'Sum ',sum(s)
end program test
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/46271] OpenMP default(none) and procedure pointers
2010-11-02 16:56 [Bug fortran/46271] New: OpenMP default(none) and procedure pointers mrestelli at gmail dot com
@ 2013-06-23 14:08 ` dominiq at lps dot ens.fr
2013-08-12 13:55 ` [Bug fortran/46271] [F03] " janus at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: dominiq at lps dot ens.fr @ 2013-06-23 14:08 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46271
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2013-06-23
Ever confirmed|0 |1
--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Still present at revision 200321.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/46271] [F03] OpenMP default(none) and procedure pointers
2010-11-02 16:56 [Bug fortran/46271] New: OpenMP default(none) and procedure pointers mrestelli at gmail dot com
2013-06-23 14:08 ` [Bug fortran/46271] " dominiq at lps dot ens.fr
@ 2013-08-12 13:55 ` janus at gcc dot gnu.org
2013-08-12 13:59 ` janus at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: janus at gcc dot gnu.org @ 2013-08-12 13:55 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46271
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
CC| |janus at gcc dot gnu.org
Assignee|unassigned at gcc dot gnu.org |janus at gcc dot gnu.org
Summary|OpenMP default(none) and |[F03] OpenMP default(none)
|procedure pointers |and procedure pointers
--- Comment #2 from janus at gcc dot gnu.org ---
Here is a simple patch to accept version A:
Index: gcc/fortran/openmp.c
===================================================================
--- gcc/fortran/openmp.c (revision 201653)
+++ gcc/fortran/openmp.c (working copy)
@@ -847,7 +847,7 @@ resolve_omp_clauses (gfc_code *code)
for (n = omp_clauses->lists[list]; n; n = n->next)
{
n->sym->mark = 0;
- if (n->sym->attr.flavor == FL_VARIABLE)
+ if (n->sym->attr.flavor == FL_VARIABLE || n->sym->attr.proc_pointer)
continue;
if (n->sym->attr.flavor == FL_PROCEDURE
&& n->sym->result == n->sym
@@ -876,8 +876,6 @@ resolve_omp_clauses (gfc_code *code)
if (el)
continue;
}
- if (n->sym->attr.proc_pointer)
- continue;
}
gfc_error ("Object '%s' is not a variable at %L", n->sym->name,
&code->loc);
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/46271] [F03] OpenMP default(none) and procedure pointers
2010-11-02 16:56 [Bug fortran/46271] New: OpenMP default(none) and procedure pointers mrestelli at gmail dot com
2013-06-23 14:08 ` [Bug fortran/46271] " dominiq at lps dot ens.fr
2013-08-12 13:55 ` [Bug fortran/46271] [F03] " janus at gcc dot gnu.org
@ 2013-08-12 13:59 ` janus at gcc dot gnu.org
2013-08-12 15:45 ` janus at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: janus at gcc dot gnu.org @ 2013-08-12 13:59 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46271
--- Comment #3 from janus at gcc dot gnu.org ---
(In reply to mrestelli from comment #0)
> With version B:
> gfortran -fopenmp omp_test.f90 -o omp_test
> omp_test.f90: In function ‘test’:
> omp_test.f90:25:0: error: ‘pf’ not specified in enclosing parallel
> omp_test.f90:23:0: error: enclosing parallel
What is actually the problem here? That error message looks correct to me,
doesn't it?
>From gcc-bugs-return-427724-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Aug 12 14:06:08 2013
Return-Path: <gcc-bugs-return-427724-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 30043 invoked by alias); 12 Aug 2013 14:06:07 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 29996 invoked by uid 48); 12 Aug 2013 14:06:07 -0000
From: "jules at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/57717] error: unrecognizable insn compiling ./strtod_l.c from glibc on powerpc-gnuspe
Date: Mon, 12 Aug 2013 14:06:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: target
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords: ice-on-valid-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: jules at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: cc
Message-ID: <bug-57717-4-0E0Gwbo0gv@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-57717-4@http.gcc.gnu.org/bugzilla/>
References: <bug-57717-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-08/txt/msg00648.txt.bz2
Content-length: 432
http://gcc.gnu.org/bugzilla/show_bug.cgi?idW717
jules at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jules at gcc dot gnu.org
--- Comment #7 from jules at gcc dot gnu.org ---
Here's another candidate patch:
http://gcc.gnu.org/ml/gcc-patches/2013-08/msg00668.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/46271] [F03] OpenMP default(none) and procedure pointers
2010-11-02 16:56 [Bug fortran/46271] New: OpenMP default(none) and procedure pointers mrestelli at gmail dot com
` (2 preceding siblings ...)
2013-08-12 13:59 ` janus at gcc dot gnu.org
@ 2013-08-12 15:45 ` janus at gcc dot gnu.org
2013-08-12 16:29 ` mrestelli at gmail dot com
2013-08-19 9:18 ` janus at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: janus at gcc dot gnu.org @ 2013-08-12 15:45 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46271
--- Comment #4 from janus at gcc dot gnu.org ---
(In reply to janus from comment #2)
> Here is a simple patch to accept version A:
... which regtests cleanly!
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/46271] [F03] OpenMP default(none) and procedure pointers
2010-11-02 16:56 [Bug fortran/46271] New: OpenMP default(none) and procedure pointers mrestelli at gmail dot com
` (3 preceding siblings ...)
2013-08-12 15:45 ` janus at gcc dot gnu.org
@ 2013-08-12 16:29 ` mrestelli at gmail dot com
2013-08-19 9:18 ` janus at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: mrestelli at gmail dot com @ 2013-08-12 16:29 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46271
--- Comment #5 from mrestelli <mrestelli at gmail dot com> ---
(In reply to janus from comment #3)
> (In reply to mrestelli from comment #0)
> > With version B:
> > gfortran -fopenmp omp_test.f90 -o omp_test
> > omp_test.f90: In function ‘test’:
> > omp_test.f90:25:0: error: ‘pf’ not specified in enclosing parallel
> > omp_test.f90:23:0: error: enclosing parallel
>
> What is actually the problem here? That error message looks correct to me,
> doesn't it?
Janus, you are probably right that version B should not compile. I
guess when I posted the bug report I was not sure which was the
correct version according to the OpenMP specifications, since fp is a
variable (requiring an OpenMP attribute), but it behaves like a
subroutine (so, no OpenMP attribute). Clearly however at least one of
the two versions should work, hence my pointing out that both
alternatives do not work. Well, at least this is my recollection,
since it was quite a while ago.
As a note, I mention that ifort (version 13.1) accepts both versions,
but maybe this is an issue with ifort itself.
Regards,
Marco Restelli
>From gcc-bugs-return-427732-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Aug 12 17:08:18 2013
Return-Path: <gcc-bugs-return-427732-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 3680 invoked by alias); 12 Aug 2013 17:08:17 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 3635 invoked by uid 48); 12 Aug 2013 17:08:15 -0000
From: "janus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/46271] [F03] OpenMP default(none) and procedure pointers
Date: Mon, 12 Aug 2013 17:08:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: fortran
X-Bugzilla-Version: 4.6.0
X-Bugzilla-Keywords: openmp, rejects-valid
X-Bugzilla-Severity: normal
X-Bugzilla-Who: janus at gcc dot gnu.org
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: janus at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-46271-4-s4w1Wr6beB@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-46271-4@http.gcc.gnu.org/bugzilla/>
References: <bug-46271-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-08/txt/msg00656.txt.bz2
Content-length: 1588
http://gcc.gnu.org/bugzilla/show_bug.cgi?idF271
--- Comment #6 from janus at gcc dot gnu.org ---
Hi Marco,
> Janus, you are probably right that version B should not compile. I
> guess when I posted the bug report I was not sure which was the
> correct version according to the OpenMP specifications, since fp is a
> variable (requiring an OpenMP attribute), but it behaves like a
> subroutine (so, no OpenMP attribute).
well, since a procedure pointer can be assigned and change its value, I would
say it counts as a variable and one should make up one's mind whether it is
supposed to be shared or private in an OpenMP loop (as for any other variable,
this can clearly make a difference). Hence my interpretation that the error
message is correct.
However, I should note that I'm not much of an OpenMP expert and haven't
checked whether the OpenMP specifications makes any definitive statement about
this. It's merely my 'gut feeling'.
> As a note, I mention that ifort (version 13.1) accepts both versions,
> but maybe this is an issue with ifort itself.
ifort is not exactly known for it's strictness on invalid programs, and of
course it may have bugs. I don't know if this is allowed on purpose or if the
missing error is an oversight.
If ifort accepts the program, it would be interesting whether it treats the
procptr as private or shared with default(none), and whether this behavior is
documented somewhere (either in the OpenMP spec or the ifort docs).
Some people claim that documentation is the only thing that distinguishes a
feature from a bug ;)
Cheers,
Janus
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/46271] [F03] OpenMP default(none) and procedure pointers
2010-11-02 16:56 [Bug fortran/46271] New: OpenMP default(none) and procedure pointers mrestelli at gmail dot com
` (4 preceding siblings ...)
2013-08-12 16:29 ` mrestelli at gmail dot com
@ 2013-08-19 9:18 ` janus at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: janus at gcc dot gnu.org @ 2013-08-19 9:18 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46271
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #7 from janus at gcc dot gnu.org ---
(In reply to janus from comment #2)
> Here is a simple patch to accept version A:
... which has been committed to 4.9 trunk:
Author: janus
Date: Mon Aug 19 09:03:20 2013
New Revision: 201835
URL: http://gcc.gnu.org/viewcvs?rev=201835&root=gcc&view=rev
Log:
2013-08-19 Janus Weil <janus@gcc.gnu.org>
PR fortran/46271
* openmp.c (resolve_omp_clauses): Bugfix for procedure pointers.
2013-08-19 Janus Weil <janus@gcc.gnu.org>
PR fortran/46271
* gfortran.dg/gomp/proc_ptr_1.f90: New.
Added:
trunk/gcc/testsuite/gfortran.dg/gomp/proc_ptr_1.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/openmp.c
trunk/gcc/testsuite/ChangeLog
I think the rejection of version B is ok (see above discussion), therefore I'm
closing this PR. Thanks for the report!
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-08-19 9:18 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-02 16:56 [Bug fortran/46271] New: OpenMP default(none) and procedure pointers mrestelli at gmail dot com
2013-06-23 14:08 ` [Bug fortran/46271] " dominiq at lps dot ens.fr
2013-08-12 13:55 ` [Bug fortran/46271] [F03] " janus at gcc dot gnu.org
2013-08-12 13:59 ` janus at gcc dot gnu.org
2013-08-12 15:45 ` janus at gcc dot gnu.org
2013-08-12 16:29 ` mrestelli at gmail dot com
2013-08-19 9:18 ` janus at gcc dot gnu.org
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).