public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/103312] New: ICE in gfc_find_component
@ 2021-11-18 11:40 asolokha at gmx dot com
2021-11-19 10:54 ` [Bug fortran/103312] [9/10/11/12 Regression] ICE in gfc_find_component since r9-1098-g3cf89a7b992d483e marxin at gcc dot gnu.org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: asolokha at gmx dot com @ 2021-11-18 11:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103312
Bug ID: 103312
Summary: ICE in gfc_find_component
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: asolokha at gmx dot com
Target Milestone: ---
Created attachment 51831
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51831&action=edit
Testcase
gfortran-12.0.0-alpha20111114 snapshot
(g:3057f1ab737582a9fb37a3fb967ed8bf3659f2f4) ICEs when compiling the attached
testcase from Neil Carlson's Fortran Compiler Tests repository[1]:
% gfortran-12.0.0 -c flang-20171123a.f90
f951: internal compiler error: Segmentation fault
0xf3712f crash_signal
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211114/work/gcc-12-20211114/gcc/toplev.c:322
0x940804 gfc_find_component(gfc_symbol*, char const*, bool, bool, gfc_ref**)
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211114/work/gcc-12-20211114/gcc/fortran/symbol.c:2527
0x865801 gfc_add_component_ref(gfc_expr*, char const*)
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211114/work/gcc-12-20211114/gcc/fortran/class.c:247
0x90dc10 resolve_typebound_function
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211114/work/gcc-12-20211114/gcc/fortran/resolve.c:6851
0x90dc10 gfc_resolve_expr(gfc_expr*)
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211114/work/gcc-12-20211114/gcc/fortran/resolve.c:7177
0x9114a2 gfc_resolve_expr(gfc_expr*)
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211114/work/gcc-12-20211114/gcc/fortran/resolve.c:7133
0x9114a2 resolve_index_expr
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211114/work/gcc-12-20211114/gcc/fortran/resolve.c:12547
0x9114a2 resolve_charlen
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211114/work/gcc-12-20211114/gcc/fortran/resolve.c:12600
0x915690 resolve_charlen
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211114/work/gcc-12-20211114/gcc/fortran/resolve.c:12568
0x915690 resolve_types
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211114/work/gcc-12-20211114/gcc/fortran/resolve.c:17451
0x907ed8 gfc_resolve(gfc_namespace*)
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211114/work/gcc-12-20211114/gcc/fortran/resolve.c:17568
0x907ed8 gfc_resolve(gfc_namespace*)
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211114/work/gcc-12-20211114/gcc/fortran/resolve.c:17549
0x90a651 resolve_symbol
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211114/work/gcc-12-20211114/gcc/fortran/resolve.c:16153
0x937b92 do_traverse_symtree
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211114/work/gcc-12-20211114/gcc/fortran/symbol.c:4174
0x9156ab resolve_types
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211114/work/gcc-12-20211114/gcc/fortran/resolve.c:17453
0x907ed8 gfc_resolve(gfc_namespace*)
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211114/work/gcc-12-20211114/gcc/fortran/resolve.c:17568
0x907ed8 gfc_resolve(gfc_namespace*)
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211114/work/gcc-12-20211114/gcc/fortran/resolve.c:17549
0x8fa1da gfc_parse_file()
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211114/work/gcc-12-20211114/gcc/fortran/parse.c:6779
0x94ea7f gfc_be_parse_file
/var/tmp/portage/sys-devel/gcc-12.0.0_alpha20211114/work/gcc-12-20211114/gcc/fortran/f95-lang.c:216
[1] https://github.com/nncarlson/fortran-compiler-tests
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/103312] [9/10/11/12 Regression] ICE in gfc_find_component since r9-1098-g3cf89a7b992d483e
2021-11-18 11:40 [Bug fortran/103312] New: ICE in gfc_find_component asolokha at gmx dot com
@ 2021-11-19 10:54 ` marxin at gcc dot gnu.org
2021-11-19 17:15 ` kargl at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-11-19 10:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103312
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|ICE in gfc_find_component |[9/10/11/12 Regression] ICE
| |in gfc_find_component since
| |r9-1098-g3cf89a7b992d483e
Ever confirmed|0 |1
Last reconfirmed| |2021-11-19
Status|UNCONFIRMED |NEW
CC| |kargl at gcc dot gnu.org,
| |marxin at gcc dot gnu.org
--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r9-1098-g3cf89a7b992d483e.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/103312] [9/10/11/12 Regression] ICE in gfc_find_component since r9-1098-g3cf89a7b992d483e
2021-11-18 11:40 [Bug fortran/103312] New: ICE in gfc_find_component asolokha at gmx dot com
2021-11-19 10:54 ` [Bug fortran/103312] [9/10/11/12 Regression] ICE in gfc_find_component since r9-1098-g3cf89a7b992d483e marxin at gcc dot gnu.org
@ 2021-11-19 17:15 ` kargl at gcc dot gnu.org
2022-01-17 9:01 ` rguenth at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: kargl at gcc dot gnu.org @ 2021-11-19 17:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103312
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 ---
Not regression tested. Allows the code to compile.
I don't use CLASS, so have not idea if this is correct.
The code in gfc_find_component is set up for only TYPE,
UNION, and STRUCT. See the assert.
diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c
index 93118ad3455..997fa0d7848 100644
--- a/gcc/fortran/class.c
+++ b/gcc/fortran/class.c
@@ -1692,8 +1692,10 @@ generate_finalization_wrapper (gfc_symbol *derived,
gfc_namespace *ns,
final->attr.artificial = 1;
final->attr.always_explicit = 1;
final->attr.if_source = expr_null_wrapper ? IFSRC_IFBODY : IFSRC_DECL;
- if (ns->proc_name->attr.flavor == FL_MODULE)
+
+ if (ns->proc_name && ns->proc_name->attr.flavor == FL_MODULE)
final->module = ns->proc_name->name;
+
gfc_set_sym_referenced (final);
gfc_commit_symbol (final);
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c
index 8c9a1d00ce0..52d47b8b872 100644
--- a/gcc/fortran/symbol.c
+++ b/gcc/fortran/symbol.c
@@ -2492,6 +2492,8 @@ gfc_find_component (gfc_symbol *sym, const char *name,
if (sym->attr.flavor == FL_DERIVED)
sym = gfc_use_derived (sym);
+ else if (sym->ts.type == BT_DERIVED)
+ sym = gfc_use_derived (sym->ts.u.derived);
else
gcc_assert (gfc_fl_struct (sym->attr.flavor));
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/103312] [9/10/11/12 Regression] ICE in gfc_find_component since r9-1098-g3cf89a7b992d483e
2021-11-18 11:40 [Bug fortran/103312] New: ICE in gfc_find_component asolokha at gmx dot com
2021-11-19 10:54 ` [Bug fortran/103312] [9/10/11/12 Regression] ICE in gfc_find_component since r9-1098-g3cf89a7b992d483e marxin at gcc dot gnu.org
2021-11-19 17:15 ` kargl at gcc dot gnu.org
@ 2022-01-17 9:01 ` rguenth at gcc dot gnu.org
2022-05-27 9:46 ` [Bug fortran/103312] [10/11/12/13 " rguenth at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-17 9:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103312
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P4
Target Milestone|--- |9.5
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/103312] [10/11/12/13 Regression] ICE in gfc_find_component since r9-1098-g3cf89a7b992d483e
2021-11-18 11:40 [Bug fortran/103312] New: ICE in gfc_find_component asolokha at gmx dot com
` (2 preceding siblings ...)
2022-01-17 9:01 ` rguenth at gcc dot gnu.org
@ 2022-05-27 9:46 ` rguenth at gcc dot gnu.org
2022-06-28 10:46 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-27 9:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103312
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|9.5 |10.4
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9 branch is being closed
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/103312] [10/11/12/13 Regression] ICE in gfc_find_component since r9-1098-g3cf89a7b992d483e
2021-11-18 11:40 [Bug fortran/103312] New: ICE in gfc_find_component asolokha at gmx dot com
` (3 preceding siblings ...)
2022-05-27 9:46 ` [Bug fortran/103312] [10/11/12/13 " rguenth at gcc dot gnu.org
@ 2022-06-28 10:46 ` jakub at gcc dot gnu.org
2023-07-07 10:41 ` [Bug fortran/103312] [11/12/13/14 " rguenth at gcc dot gnu.org
2024-04-17 7:10 ` pault at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 10:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103312
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|10.4 |10.5
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.4 is being released, retargeting bugs to GCC 10.5.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/103312] [11/12/13/14 Regression] ICE in gfc_find_component since r9-1098-g3cf89a7b992d483e
2021-11-18 11:40 [Bug fortran/103312] New: ICE in gfc_find_component asolokha at gmx dot com
` (4 preceding siblings ...)
2022-06-28 10:46 ` jakub at gcc dot gnu.org
@ 2023-07-07 10:41 ` rguenth at gcc dot gnu.org
2024-04-17 7:10 ` pault at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07 10:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103312
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|10.5 |11.5
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10 branch is being closed.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/103312] [11/12/13/14 Regression] ICE in gfc_find_component since r9-1098-g3cf89a7b992d483e
2021-11-18 11:40 [Bug fortran/103312] New: ICE in gfc_find_component asolokha at gmx dot com
` (5 preceding siblings ...)
2023-07-07 10:41 ` [Bug fortran/103312] [11/12/13/14 " rguenth at gcc dot gnu.org
@ 2024-04-17 7:10 ` pault at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu.org @ 2024-04-17 7:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103312
Paul Thomas <pault at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pault at gcc dot gnu.org
Assignee|unassigned at gcc dot gnu.org |pault at gcc dot gnu.org
--- Comment #6 from Paul Thomas <pault at gcc dot gnu.org> ---
Created attachment 57969
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57969&action=edit
Partial fix for the PR
The supplied testcase generates completely blank derived type symbols for the
_vptr component of 'this' in 'func'. The chunk in resolve.cc fixes that.
The rest of the patch allows the full testcase below to blast through to
translation, where it dies in trans-decl.cc - again with blanks symbols in the
default initializer this time.
Of the compilers to which I have access, only NAG succeeds with the full
testcase. If this%size() is replaced with a constant expression or an integer
dummy argument, all compilers succeed, including current versions of gfortran.
I have taken it but need to get on with daytime work for a few days.
Paul
module example
type, abstract :: foo
integer :: i
contains
procedure(foo_size), deferred :: size
procedure(foo_func), deferred :: func
end type
interface
function foo_func (this) result (string)
import :: foo
class(foo) :: this
character(this%size()) :: string
end function
pure integer function foo_size (this)
import foo
class(foo), intent(in) :: this
end function
end interface
end module
module extension
use example
implicit none
type, extends(foo) :: bar
! integer :: i
contains
procedure :: size
procedure :: func
end type
contains
pure integer function size (this)
class(bar), intent(in) :: this
size = this%i
end function
function func (this) result (string)
class(bar) :: this
character(this%size()) :: string
string = repeat ("x", len (string))
end function
end module
use example
use extension
type(bar) :: a
a%i = 5
print *, a%func()
end
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-04-17 7:10 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-18 11:40 [Bug fortran/103312] New: ICE in gfc_find_component asolokha at gmx dot com
2021-11-19 10:54 ` [Bug fortran/103312] [9/10/11/12 Regression] ICE in gfc_find_component since r9-1098-g3cf89a7b992d483e marxin at gcc dot gnu.org
2021-11-19 17:15 ` kargl at gcc dot gnu.org
2022-01-17 9:01 ` rguenth at gcc dot gnu.org
2022-05-27 9:46 ` [Bug fortran/103312] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:46 ` jakub at gcc dot gnu.org
2023-07-07 10:41 ` [Bug fortran/103312] [11/12/13/14 " rguenth at gcc dot gnu.org
2024-04-17 7:10 ` pault 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).