public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/113305] New: ICE with do concurrent and ivdep
@ 2024-01-10 11:00 ivan.pribec at gmail dot com
2024-01-10 11:46 ` [Bug fortran/113305] " rguenth at gcc dot gnu.org
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: ivan.pribec at gmail dot com @ 2024-01-10 11:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113305
Bug ID: 113305
Summary: ICE with do concurrent and ivdep
Product: gcc
Version: 13.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: ivan.pribec at gmail dot com
Target Milestone: ---
Created attachment 57022
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57022&action=edit
mwe using do concurrent and ivdep directive
An internal compiler error is triggered by adding the ivdep directive to a do
concurrent loop:
program dc
implicit none
real :: a(12), b(12)
integer :: i
call random_number(b)
!GCC$ ivdep
do concurrent (i=1:12)
a(i) = 2*b(i)
end do
end program
...
$ gfortran -Wall dc.f90
f951: internal compiler error: Segmentation fault: 11
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
See <https://github.com/Homebrew/homebrew-core/issues> for instructions.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/113305] ICE with do concurrent and ivdep
2024-01-10 11:00 [Bug fortran/113305] New: ICE with do concurrent and ivdep ivan.pribec at gmail dot com
@ 2024-01-10 11:46 ` rguenth at gcc dot gnu.org
2024-01-10 18:15 ` kargl at gcc dot gnu.org
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-01-10 11:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113305
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2024-01-10
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.
f951: internal compiler error: Segmentation fault
0x17cf885 crash_signal
/space/rguenther/src/gcc/gcc/toplev.cc:316
0xe79b99 resolve_forall_iterators
/space/rguenther/src/gcc/gcc/fortran/resolve.cc:7620
0xe85f05 gfc_resolve_code(gfc_code*, gfc_namespace*)
/space/rguenther/src/gcc/gcc/fortran/resolve.cc:12745
0xe939ad resolve_codes
/space/rguenther/src/gcc/gcc/fortran/resolve.cc:18107
0xe93ad7 gfc_resolve(gfc_namespace*)
/space/rguenther/src/gcc/gcc/fortran/resolve.cc:18142
0xe5e8b9 resolve_all_program_units
/space/rguenther/src/gcc/gcc/fortran/parse.cc:6983
0xe5f0a6 gfc_parse_file()
/space/rguenther/src/gcc/gcc/fortran/parse.cc:7239
0xec4940 gfc_be_parse_file
/space/rguenther/src/gcc/gcc/fortran/f95-lang.cc:239
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/113305] ICE with do concurrent and ivdep
2024-01-10 11:00 [Bug fortran/113305] New: ICE with do concurrent and ivdep ivan.pribec at gmail dot com
2024-01-10 11:46 ` [Bug fortran/113305] " rguenth at gcc dot gnu.org
@ 2024-01-10 18:15 ` kargl at gcc dot gnu.org
2024-01-10 18:24 ` ivan.pribec at gmail dot com
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: kargl at gcc dot gnu.org @ 2024-01-10 18:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113305
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kargl at gcc dot gnu.org
--- Comment #2 from kargl at gcc dot gnu.org ---
(In reply to Richard Biener from comment #1)
> Confirmed.
>
> f951: internal compiler error: Segmentation fault
> 0x17cf885 crash_signal
> /space/rguenther/src/gcc/gcc/toplev.cc:316
> 0xe79b99 resolve_forall_iterators
> /space/rguenther/src/gcc/gcc/fortran/resolve.cc:7620
No idea what ivdep is suppose to do, but it is certainly messing up gfortran.
(gdb) b resolve.cc:7620
Breakpoint 1 at 0x9e076d: file ../../gccx/gcc/fortran/resolve.cc, line 7620.
(gdb) run a.f90
Breakpoint 1, resolve_forall_iterators (it=0x203c6d360)
at ../../gccx/gcc/fortran/resolve.cc:7620
7620 if (gfc_resolve_expr (iter->var)
(gdb) p *it
$5 = {var = 0x203c250a0, start = 0x203c25180, end = 0x203c25260,
stride = 0x203c25340, next = 0x10000}
it->next is set to an invalid address, so the for loop is not
exited. If I remove the '!GCC ivdep' directive, then one see
(gdb) p *it->next
Cannot access memory at address 0x0
the expected result. I think that this is not a Fortran bug, and the
component should be changed to middle-end.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/113305] ICE with do concurrent and ivdep
2024-01-10 11:00 [Bug fortran/113305] New: ICE with do concurrent and ivdep ivan.pribec at gmail dot com
2024-01-10 11:46 ` [Bug fortran/113305] " rguenth at gcc dot gnu.org
2024-01-10 18:15 ` kargl at gcc dot gnu.org
@ 2024-01-10 18:24 ` ivan.pribec at gmail dot com
2024-01-10 19:43 ` anlauf at gcc dot gnu.org
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: ivan.pribec at gmail dot com @ 2024-01-10 18:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113305
--- Comment #3 from Ivan Pribec <ivan.pribec at gmail dot com> ---
In the mail archive
(https://gcc.gnu.org/legacy-ml/fortran/2014-02/msg00077.html) I've read a
message implying that do concurrent gets translated into a regular for-loop
annotated with "#pragma ivdep", which assures the loop optimizer there are no
loop-carried dependencies. That said, I'm aware there is no good reason why
you'd want to use this directive on a do concurrent loop.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/113305] ICE with do concurrent and ivdep
2024-01-10 11:00 [Bug fortran/113305] New: ICE with do concurrent and ivdep ivan.pribec at gmail dot com
` (2 preceding siblings ...)
2024-01-10 18:24 ` ivan.pribec at gmail dot com
@ 2024-01-10 19:43 ` anlauf at gcc dot gnu.org
2024-01-10 19:58 ` sgk at troutmask dot apl.washington.edu
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: anlauf at gcc dot gnu.org @ 2024-01-10 19:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113305
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |anlauf at gcc dot gnu.org
--- Comment #4 from anlauf at gcc dot gnu.org ---
The underlying problem is that parse_do_block expects only simple do-loops
and attaches the loop annotation (ivdep, vector, novector, ...) to the
"wrong" component (ext.iterator instead of ext.forall_iterator).
However, gfc_forall_iterator has a slightly different structure than
gfc_iterator and needs to be amended.
Since the Intel compiler appears to accept "!DIR$ vector always" in front
of do concurrent, we might try to support it, too.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/113305] ICE with do concurrent and ivdep
2024-01-10 11:00 [Bug fortran/113305] New: ICE with do concurrent and ivdep ivan.pribec at gmail dot com
` (3 preceding siblings ...)
2024-01-10 19:43 ` anlauf at gcc dot gnu.org
@ 2024-01-10 19:58 ` sgk at troutmask dot apl.washington.edu
2024-01-10 20:38 ` anlauf at gcc dot gnu.org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: sgk at troutmask dot apl.washington.edu @ 2024-01-10 19:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113305
--- Comment #5 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Wed, Jan 10, 2024 at 06:24:40PM +0000, ivan.pribec at gmail dot com wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113305
>
> --- Comment #3 from Ivan Pribec <ivan.pribec at gmail dot com> ---
> In the mail archive
> (https://gcc.gnu.org/legacy-ml/fortran/2014-02/msg00077.html) I've read a
> message implying that do concurrent gets translated into a regular for-loop
> annotated with "#pragma ivdep", which assures the loop optimizer there are no
> loop-carried dependencies. That said, I'm aware there is no good reason why
> you'd want to use this directive on a do concurrent loop.
>
Note, I'm not saying that using '!GCC$ ivdep' is wrong. It's
that gfortran parses the do-concurrent correctly, but whatever
compiler pass(es) that ivdep activates seems to mishandle the
terminated linked list. it->var holds information about 'i'
and it->next points to the next do-index if one exists or
is NULL. ivdep seems to corrupt the NULL.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/113305] ICE with do concurrent and ivdep
2024-01-10 11:00 [Bug fortran/113305] New: ICE with do concurrent and ivdep ivan.pribec at gmail dot com
` (4 preceding siblings ...)
2024-01-10 19:58 ` sgk at troutmask dot apl.washington.edu
@ 2024-01-10 20:38 ` anlauf at gcc dot gnu.org
2024-01-10 22:25 ` anlauf at gcc dot gnu.org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: anlauf at gcc dot gnu.org @ 2024-01-10 20:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113305
--- Comment #6 from anlauf at gcc dot gnu.org ---
Created attachment 57026
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57026&action=edit
Draft patch
Draft patch that passes annotations to DO CONCURRENT loops.
Needs testing and feedback.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/113305] ICE with do concurrent and ivdep
2024-01-10 11:00 [Bug fortran/113305] New: ICE with do concurrent and ivdep ivan.pribec at gmail dot com
` (5 preceding siblings ...)
2024-01-10 20:38 ` anlauf at gcc dot gnu.org
@ 2024-01-10 22:25 ` anlauf at gcc dot gnu.org
2024-01-12 20:38 ` anlauf at gcc dot gnu.org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: anlauf at gcc dot gnu.org @ 2024-01-10 22:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113305
--- Comment #7 from anlauf at gcc dot gnu.org ---
Submitted: https://gcc.gnu.org/pipermail/fortran/2024-January/060110.html
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/113305] ICE with do concurrent and ivdep
2024-01-10 11:00 [Bug fortran/113305] New: ICE with do concurrent and ivdep ivan.pribec at gmail dot com
` (6 preceding siblings ...)
2024-01-10 22:25 ` anlauf at gcc dot gnu.org
@ 2024-01-12 20:38 ` anlauf at gcc dot gnu.org
2024-01-13 14:08 ` cvs-commit at gcc dot gnu.org
2024-01-13 21:14 ` anlauf at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: anlauf at gcc dot gnu.org @ 2024-01-12 20:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113305
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |anlauf at gcc dot gnu.org
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/113305] ICE with do concurrent and ivdep
2024-01-10 11:00 [Bug fortran/113305] New: ICE with do concurrent and ivdep ivan.pribec at gmail dot com
` (7 preceding siblings ...)
2024-01-12 20:38 ` anlauf at gcc dot gnu.org
@ 2024-01-13 14:08 ` cvs-commit at gcc dot gnu.org
2024-01-13 21:14 ` anlauf at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-01-13 14:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113305
--- Comment #8 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>:
https://gcc.gnu.org/g:9935667a69896865b848dfa690f94c9c693a48a3
commit r14-7226-g9935667a69896865b848dfa690f94c9c693a48a3
Author: Harald Anlauf <anlauf@gmx.de>
Date: Fri Jan 12 19:51:11 2024 +0100
Fortran: annotations for DO CONCURRENT loops [PR113305]
gcc/fortran/ChangeLog:
PR fortran/113305
* gfortran.h (gfc_loop_annot): New.
(gfc_iterator, gfc_forall_iterator): Use for annotation control.
* array.cc (gfc_copy_iterator): Adjust.
* gfortran.texi: Document annotations IVDEP, UNROLL n, VECTOR,
NOVECTOR as applied to DO CONCURRENT.
* parse.cc (parse_do_block): Parse annotations IVDEP, UNROLL n,
VECTOR, NOVECTOR as applied to DO CONCURRENT. Apply UNROLL only to
first loop control variable.
* trans-stmt.cc (iter_info): Use gfc_loop_annot.
(gfc_trans_simple_do): Adjust.
(gfc_trans_forall_loop): Annotate loops with IVDEP, UNROLL n,
VECTOR, NOVECTOR as needed for DO CONCURRENT.
(gfc_trans_forall_1): Handle loop annotations.
gcc/testsuite/ChangeLog:
PR fortran/113305
* gfortran.dg/do_concurrent_7.f90: New test.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/113305] ICE with do concurrent and ivdep
2024-01-10 11:00 [Bug fortran/113305] New: ICE with do concurrent and ivdep ivan.pribec at gmail dot com
` (8 preceding siblings ...)
2024-01-13 14:08 ` cvs-commit at gcc dot gnu.org
@ 2024-01-13 21:14 ` anlauf at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: anlauf at gcc dot gnu.org @ 2024-01-13 21:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113305
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |14.0
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #9 from anlauf at gcc dot gnu.org ---
Fixed in gcc-14.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2024-01-13 21:14 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-10 11:00 [Bug fortran/113305] New: ICE with do concurrent and ivdep ivan.pribec at gmail dot com
2024-01-10 11:46 ` [Bug fortran/113305] " rguenth at gcc dot gnu.org
2024-01-10 18:15 ` kargl at gcc dot gnu.org
2024-01-10 18:24 ` ivan.pribec at gmail dot com
2024-01-10 19:43 ` anlauf at gcc dot gnu.org
2024-01-10 19:58 ` sgk at troutmask dot apl.washington.edu
2024-01-10 20:38 ` anlauf at gcc dot gnu.org
2024-01-10 22:25 ` anlauf at gcc dot gnu.org
2024-01-12 20:38 ` anlauf at gcc dot gnu.org
2024-01-13 14:08 ` cvs-commit at gcc dot gnu.org
2024-01-13 21:14 ` anlauf 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).