public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/99171] New: [10 Regression] Optional procedure call inside Open MP parallel loop produces Segmentation Fault
@ 2021-02-19 20:32 am41119 at hotmail dot com
2021-02-20 12:22 ` [Bug fortran/99171] " dominiq at lps dot ens.fr
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: am41119 at hotmail dot com @ 2021-02-19 20:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99171
Bug ID: 99171
Summary: [10 Regression] Optional procedure call inside Open MP
parallel loop produces Segmentation Fault
Product: gcc
Version: 10.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: am41119 at hotmail dot com
Target Milestone: ---
Created attachment 50226
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50226&action=edit
Output of using -save-temps during compilation
When calling a passed optional procedure inside an Open MP parallel loop (even
with OMP_NUM_THREADS=1) the address of the optional procedure is no longer set
to the actual passed procedure. Because the address of the optional procedure
is no longer correct we get a Segmentation Fault when calling it.
The below program works on GCC9 and below.
main.f90:
-----------------------------------------------
program gcc10_omp_optional_bug
implicit none
call function_calling_optionals(print_something)
call function_calling_optionals_in_omp(print_something)
contains
subroutine optional_function_template()
implicit none
end subroutine
subroutine print_something()
implicit none
print *, "Printing Something"
end subroutine print_something
subroutine function_calling_optionals(optional_function)
implicit none
procedure(optional_function_template), optional :: optional_function
print *, "When optional function is called without Open MP directive:"
if (present(optional_function)) then
call optional_function()
end if
end subroutine function_calling_optionals
subroutine function_calling_optionals_in_omp(optional_function)
implicit none
procedure(optional_function_template), optional :: optional_function
print *, "When optional function is called inside Open MP directive:"
!$omp parallel
if (present(optional_function)) then
call optional_function()
end if
!$omp end parallel
end subroutine function_calling_optionals_in_omp
end program gcc10_omp_optional_bug
---------------------------------------------
gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/10/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
10.2.0-5ubuntu1~20.04' --with-bugurl=file:///usr/share/doc/gcc-10/README.Bugs
--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr
--with-gcc-major-version-only --program-suffix=-10
--program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new
--enable-gnu-unique-object --disable-vtable-verify --enable-plugin
--enable-default-pie --with-system-zlib --enable-libphobos-checking=release
--with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch
--disable-werror --with-arch-32=i686 --with-abi=m64
--with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic
--enable-offload-targets=nvptx-none=/build/gcc-10-WJNXnb/gcc-10-10.2.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-10-WJNXnb/gcc-10-10.2.0/debian/tmp-gcn/usr,hsa
--without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.2.0 (Ubuntu 10.2.0-5ubuntu1~20.04)
Compile Command:
gfortran main.f90 -fopenmp -o main
Execution output:
When optional function is called without Open MP directive:
Printing Something
When optional function is called inside Open MP directive:
Program received signal SIGILL: Illegal instruction.
Program received signal SIGILL: Illegal instruction.
Program received signal SIGILL: Illegal instruction.
Backtrace for this error:
Program received signal SIGILL: Illegal instruction.
Backtrace for this error:
Backtrace for this error:
Backtrace for this error:
Program received signal SIGILL: Illegal instruction.
Backtrace for this error:
Program received signal SIGSEGV: Segmentation fault - invalid memory reference.
Backtrace for this error:
Program received signal SIGILL: Illegal instruction.
Backtrace for this error:
Program received signal SIGILL: Illegal instruction.
Backtrace for this error:
#0 0x7f9e60dd1d01 in ???
#0 0x7f9e60dd1d01 in ???
#0 0x7f9e60dd1d01 in ???
#1 0x7f9e60dd0ed5 in ???
#2 0x7f9e60bc320f in ???
#3 0x7f9e5e993e27 in ???
Illegal instruction (core dumped)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/99171] [10 Regression] Optional procedure call inside Open MP parallel loop produces Segmentation Fault
2021-02-19 20:32 [Bug fortran/99171] New: [10 Regression] Optional procedure call inside Open MP parallel loop produces Segmentation Fault am41119 at hotmail dot com
@ 2021-02-20 12:22 ` dominiq at lps dot ens.fr
2021-02-20 12:23 ` [Bug fortran/99171] [10/11 " dominiq at lps dot ens.fr
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: dominiq at lps dot ens.fr @ 2021-02-20 12:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99171
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2021-02-20
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Confirmed on GCC10 and 11. With GCC9 the run time give
When optional function is called without Open MP directive:
Printing Something
When optional function is called inside Open MP directive:
Printing Something
Printing Something
Printing Something
Printing Something
Printing Something
Printing Something
Printing Something
Printing Something
Printing Something
Printing Something
Printing Something
Printing Something
Printing Something
Printing Something
Printing Something
Printing Something
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/99171] [10/11 Regression] Optional procedure call inside Open MP parallel loop produces Segmentation Fault
2021-02-19 20:32 [Bug fortran/99171] New: [10 Regression] Optional procedure call inside Open MP parallel loop produces Segmentation Fault am41119 at hotmail dot com
2021-02-20 12:22 ` [Bug fortran/99171] " dominiq at lps dot ens.fr
@ 2021-02-20 12:23 ` dominiq at lps dot ens.fr
2021-02-22 8:40 ` rguenth at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: dominiq at lps dot ens.fr @ 2021-02-20 12:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99171
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P4
Summary|[10 Regression] Optional |[10/11 Regression] Optional
|procedure call inside Open |procedure call inside Open
|MP parallel loop produces |MP parallel loop produces
|Segmentation Fault |Segmentation Fault
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/99171] [10/11 Regression] Optional procedure call inside Open MP parallel loop produces Segmentation Fault
2021-02-19 20:32 [Bug fortran/99171] New: [10 Regression] Optional procedure call inside Open MP parallel loop produces Segmentation Fault am41119 at hotmail dot com
2021-02-20 12:22 ` [Bug fortran/99171] " dominiq at lps dot ens.fr
2021-02-20 12:23 ` [Bug fortran/99171] [10/11 " dominiq at lps dot ens.fr
@ 2021-02-22 8:40 ` rguenth at gcc dot gnu.org
2021-02-22 12:20 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-02-22 8:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99171
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |10.3
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/99171] [10/11 Regression] Optional procedure call inside Open MP parallel loop produces Segmentation Fault
2021-02-19 20:32 [Bug fortran/99171] New: [10 Regression] Optional procedure call inside Open MP parallel loop produces Segmentation Fault am41119 at hotmail dot com
` (2 preceding siblings ...)
2021-02-22 8:40 ` rguenth at gcc dot gnu.org
@ 2021-02-22 12:20 ` cvs-commit at gcc dot gnu.org
2021-02-22 14:01 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-02-22 12:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99171
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tobias Burnus <burnus@gcc.gnu.org>:
https://gcc.gnu.org/g:e9b34037cdd196ab912a7ac3358f8a8d3e307e92
commit r11-7320-ge9b34037cdd196ab912a7ac3358f8a8d3e307e92
Author: Tobias Burnus <tobias@codesourcery.com>
Date: Mon Feb 22 13:20:26 2021 +0100
Fortran/OpenMP: Fix optional dummy procedures [PR99171]
gcc/fortran/ChangeLog:
PR fortran/99171
* trans-openmp.c (gfc_omp_is_optional_argument): Regard optional
dummy procs as nonoptional as no special treatment is needed.
libgomp/ChangeLog:
PR fortran/99171
* testsuite/libgomp.fortran/dummy-procs-1.f90: New test.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/99171] [10/11 Regression] Optional procedure call inside Open MP parallel loop produces Segmentation Fault
2021-02-19 20:32 [Bug fortran/99171] New: [10 Regression] Optional procedure call inside Open MP parallel loop produces Segmentation Fault am41119 at hotmail dot com
` (3 preceding siblings ...)
2021-02-22 12:20 ` cvs-commit at gcc dot gnu.org
@ 2021-02-22 14:01 ` cvs-commit at gcc dot gnu.org
2021-02-22 14:03 ` [Bug fortran/99171] [10/11 Regression] Optional procedure call inside OpenMP " burnus at gcc dot gnu.org
2021-02-22 14:03 ` burnus at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-02-22 14:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99171
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Tobias Burnus
<burnus@gcc.gnu.org>:
https://gcc.gnu.org/g:08f43c8c98196b2c9b9476aa20b36a3ee629b3a1
commit r10-9381-g08f43c8c98196b2c9b9476aa20b36a3ee629b3a1
Author: Tobias Burnus <tobias@codesourcery.com>
Date: Mon Feb 22 13:20:26 2021 +0100
Fortran/OpenMP: Fix optional dummy procedures [PR99171]
gcc/fortran/ChangeLog:
PR fortran/99171
* trans-openmp.c (gfc_omp_is_optional_argument): Regard optional
dummy procs as nonoptional as no special treatment is needed.
libgomp/ChangeLog:
PR fortran/99171
* testsuite/libgomp.fortran/dummy-procs-1.f90: New test.
(cherry picked from commit e9b34037cdd196ab912a7ac3358f8a8d3e307e92)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/99171] [10/11 Regression] Optional procedure call inside OpenMP parallel loop produces Segmentation Fault
2021-02-19 20:32 [Bug fortran/99171] New: [10 Regression] Optional procedure call inside Open MP parallel loop produces Segmentation Fault am41119 at hotmail dot com
` (4 preceding siblings ...)
2021-02-22 14:01 ` cvs-commit at gcc dot gnu.org
@ 2021-02-22 14:03 ` burnus at gcc dot gnu.org
2021-02-22 14:03 ` burnus at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu.org @ 2021-02-22 14:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99171
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |burnus at gcc dot gnu.org
Keywords| |wrong-code
Summary|[10/11 Regression] Optional |[10/11 Regression] Optional
|procedure call inside Open |procedure call inside
|MP parallel loop produces |OpenMP parallel loop
|Segmentation Fault |produces Segmentation Fault
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> ---
FIXED – both on mainline (GCC 11) and on the GCC 11 branch.
Thanks for the report!
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/99171] [10/11 Regression] Optional procedure call inside OpenMP parallel loop produces Segmentation Fault
2021-02-19 20:32 [Bug fortran/99171] New: [10 Regression] Optional procedure call inside Open MP parallel loop produces Segmentation Fault am41119 at hotmail dot com
` (5 preceding siblings ...)
2021-02-22 14:03 ` [Bug fortran/99171] [10/11 Regression] Optional procedure call inside OpenMP " burnus at gcc dot gnu.org
@ 2021-02-22 14:03 ` burnus at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu.org @ 2021-02-22 14:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99171
--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to Tobias Burnus from comment #4)
> FIXED – both on mainline (GCC 11) and on the GCC 11 branch.
... and GCC 10 (!) branch.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-02-22 14:03 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-19 20:32 [Bug fortran/99171] New: [10 Regression] Optional procedure call inside Open MP parallel loop produces Segmentation Fault am41119 at hotmail dot com
2021-02-20 12:22 ` [Bug fortran/99171] " dominiq at lps dot ens.fr
2021-02-20 12:23 ` [Bug fortran/99171] [10/11 " dominiq at lps dot ens.fr
2021-02-22 8:40 ` rguenth at gcc dot gnu.org
2021-02-22 12:20 ` cvs-commit at gcc dot gnu.org
2021-02-22 14:01 ` cvs-commit at gcc dot gnu.org
2021-02-22 14:03 ` [Bug fortran/99171] [10/11 Regression] Optional procedure call inside OpenMP " burnus at gcc dot gnu.org
2021-02-22 14:03 ` burnus 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).