public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/100892] New: ICE on procedure pointer to function returning array of size n
@ 2021-06-03 11:17 daniel.price at monash dot edu
2021-06-03 14:02 ` [Bug fortran/100892] " marxin at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: daniel.price at monash dot edu @ 2021-06-03 11:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100892
Bug ID: 100892
Summary: ICE on procedure pointer to function returning array
of size n
Product: gcc
Version: 11.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: daniel.price at monash dot edu
Target Milestone: ---
Created attachment 50920
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50920&action=edit
test code
Attached code shows test case giving ICE on associated(ptr, func) if the
function returns an array of size(n), where n is an input to the function:
```
module testmodule
implicit none
procedure(func1), pointer :: my_ptr => null()
contains
subroutine test_sub
if (associated(my_ptr, func1)) print*,'associated'
end subroutine test_sub
function func1(n)
integer, intent(in) :: n
real, dimension(n) :: func1
end function
end module testmodule
```
compiling this gives:
% gfortran -c test-ice.f90 -o test-ice.o
f951: internal compiler error: Segmentation fault: 11
Please submit a full bug report,
with preprocessed source if appropriate.
Checked with gfortran v11.1.0 via Homebrew on Mac OS:
% gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc/11.1.0_1/libexec/gcc/x86_64-apple-darwin20/11.1.0/lto-wrapper
Target: x86_64-apple-darwin20
Configured with: ../configure --prefix=/usr/local/Cellar/gcc/11.1.0_1
--libdir=/usr/local/Cellar/gcc/11.1.0_1/lib/gcc/11 --disable-nls
--enable-checking=release --enable-languages=c,c++,objc,obj-c++,fortran,d
--program-suffix=-11 --with-gmp=/usr/local/opt/gmp
--with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc
--with-isl=/usr/local/opt/isl --with-zstd=/usr/local/opt/zstd
--with-pkgversion='Homebrew GCC 11.1.0_1'
--with-bugurl=https://github.com/Homebrew/homebrew-core/issues
--enable-libphobos --build=x86_64-apple-darwin20 --with-system-zlib
--disable-multilib --without-build-config
--with-native-system-header-dir=/usr/include
--with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.1.0 (Homebrew GCC 11.1.0_1)
Cheers,
Daniel
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/100892] ICE on procedure pointer to function returning array of size n
2021-06-03 11:17 [Bug fortran/100892] New: ICE on procedure pointer to function returning array of size n daniel.price at monash dot edu
@ 2021-06-03 14:02 ` marxin at gcc dot gnu.org
2022-03-30 19:31 ` anlauf at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-06-03 14:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100892
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |marxin at gcc dot gnu.org
Last reconfirmed| |2021-06-03
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed, an old bug (at least 4.8.0).
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/100892] ICE on procedure pointer to function returning array of size n
2021-06-03 11:17 [Bug fortran/100892] New: ICE on procedure pointer to function returning array of size n daniel.price at monash dot edu
2021-06-03 14:02 ` [Bug fortran/100892] " marxin at gcc dot gnu.org
@ 2022-03-30 19:31 ` anlauf at gcc dot gnu.org
2022-03-30 20:38 ` cvs-commit at gcc dot gnu.org
2022-03-30 20:44 ` anlauf at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-03-30 19:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100892
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |anlauf at gcc dot gnu.org
Keywords| |ice-on-valid-code
--- Comment #2 from anlauf at gcc dot gnu.org ---
Fixing NULL pointer dereference:
diff --git a/gcc/fortran/check.cc b/gcc/fortran/check.cc
index fc97bb1371e..0c2cb50c6a7 100644
--- a/gcc/fortran/check.cc
+++ b/gcc/fortran/check.cc
@@ -1504,7 +1504,7 @@ gfc_check_associated (gfc_expr *pointer, gfc_expr
*target)
argument of intrinsic inquiry functions. */
if (pointer->rank != -1 && !rank_check (target, 0, pointer->rank))
t = false;
- if (target->rank > 0)
+ if (target->rank > 0 && target->ref)
{
for (i = 0; i < target->rank; i++)
if (target->ref->u.ar.dimen_type[i] == DIMEN_VECTOR)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/100892] ICE on procedure pointer to function returning array of size n
2021-06-03 11:17 [Bug fortran/100892] New: ICE on procedure pointer to function returning array of size n daniel.price at monash dot edu
2021-06-03 14:02 ` [Bug fortran/100892] " marxin at gcc dot gnu.org
2022-03-30 19:31 ` anlauf at gcc dot gnu.org
@ 2022-03-30 20:38 ` cvs-commit at gcc dot gnu.org
2022-03-30 20:44 ` anlauf at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-03-30 20:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100892
--- Comment #3 from CVS 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:b4e4b35f4ebe561826489bed971324efc99c5423
commit r12-7927-gb4e4b35f4ebe561826489bed971324efc99c5423
Author: Harald Anlauf <anlauf@gmx.de>
Date: Wed Mar 30 22:36:12 2022 +0200
Fortran: NULL pointer dereference checking arguments to ASSOCIATED
intrinsic
gcc/fortran/ChangeLog:
PR fortran/100892
* check.cc (gfc_check_associated): Avoid NULL pointer dereference.
gcc/testsuite/ChangeLog:
PR fortran/100892
* gfortran.dg/associated_target_8.f90: New test.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/100892] ICE on procedure pointer to function returning array of size n
2021-06-03 11:17 [Bug fortran/100892] New: ICE on procedure pointer to function returning array of size n daniel.price at monash dot edu
` (2 preceding siblings ...)
2022-03-30 20:38 ` cvs-commit at gcc dot gnu.org
@ 2022-03-30 20:44 ` anlauf at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-03-30 20:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100892
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|NEW |RESOLVED
Target Milestone|--- |12.0
--- Comment #4 from anlauf at gcc dot gnu.org ---
Fixed for gcc-12. Closing.
Thanks for the report!
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-03-30 20:44 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-03 11:17 [Bug fortran/100892] New: ICE on procedure pointer to function returning array of size n daniel.price at monash dot edu
2021-06-03 14:02 ` [Bug fortran/100892] " marxin at gcc dot gnu.org
2022-03-30 19:31 ` anlauf at gcc dot gnu.org
2022-03-30 20:38 ` cvs-commit at gcc dot gnu.org
2022-03-30 20:44 ` 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).