public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/99112] New: [11 Regression] ICE in gfc_conv_component_ref, at fortran/trans-expr.c:2646
@ 2021-02-15 17:58 gscfq@t-online.de
2021-02-16 7:27 ` [Bug fortran/99112] " rguenth at gcc dot gnu.org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: gscfq@t-online.de @ 2021-02-15 17:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99112
Bug ID: 99112
Summary: [11 Regression] ICE in gfc_conv_component_ref, at
fortran/trans-expr.c:2646
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: gscfq@t-online.de
Target Milestone: ---
Changed between 20201115 and 20201122 :
$ cat z1.f90
module m
type t
end type
contains
function f(x, y) result(z)
class(t) :: x(:)
class(t) :: y(size(x))
type(t) :: z(size(x))
end
subroutine s
class(t), allocatable :: a(:), b(:), c(:)
c = f(a, b)
end
end
$ gfortran-11-20201115 -c z1.f90 -fcheck=all
$ gfortran-11-20210214 -c z1.f90
$
$ gfortran-11-20210214 -c z1.f90 -fcheck=all
z1.f90:12:17:
12 | c = f(a, b)
| 1
internal compiler error: Segmentation fault
0xc09bcf crash_signal
../../gcc/toplev.c:327
0x764181 gfc_conv_component_ref(gfc_se*, gfc_ref*)
../../gcc/fortran/trans-expr.c:2646
0x76b9c7 gfc_conv_variable
../../gcc/fortran/trans-expr.c:3019
0x767d4a gfc_conv_expr(gfc_se*, gfc_expr*)
../../gcc/fortran/trans-expr.c:8887
0x76abb0 gfc_conv_expr_lhs(gfc_se*, gfc_expr*)
../../gcc/fortran/trans-expr.c:8917
0x73dea8 gfc_conv_ss_descriptor
../../gcc/fortran/trans-array.c:3047
0x74894f gfc_conv_expr_descriptor(gfc_se*, gfc_expr*)
../../gcc/fortran/trans-array.c:7364
0x77b014 gfc_conv_intrinsic_size
../../gcc/fortran/trans-intrinsic.c:8021
0x79248b gfc_conv_intrinsic_function(gfc_se*, gfc_expr*)
../../gcc/fortran/trans-intrinsic.c:10690
0x767d2a gfc_conv_expr(gfc_se*, gfc_expr*)
../../gcc/fortran/trans-expr.c:8879
0x76a1ca gfc_apply_interface_mapping(gfc_interface_mapping*, gfc_se*,
gfc_expr*)
../../gcc/fortran/trans-expr.c:4779
0x73cd27 gfc_set_loop_bounds_from_array_spec(gfc_interface_mapping*, gfc_se*,
gfc_array_spec*)
../../gcc/fortran/trans-array.c:940
0x774233 gfc_conv_procedure_call(gfc_se*, gfc_symbol*, gfc_actual_arglist*,
gfc_expr*, vec<tree_node*, va_gc, vl_embed>*)
../../gcc/fortran/trans-expr.c:6953
0x77584c gfc_trans_arrayfunc_assign
../../gcc/fortran/trans-expr.c:10350
0x7793a4 gfc_trans_assignment(gfc_expr*, gfc_expr*, bool, bool, bool, bool)
../../gcc/fortran/trans-expr.c:11519
0x739de7 trans_code
../../gcc/fortran/trans.c:1922
0x760554 gfc_generate_function_code(gfc_namespace*)
../../gcc/fortran/trans-decl.c:6880
0x73a659 gfc_generate_module_code(gfc_namespace*)
../../gcc/fortran/trans.c:2322
0x6e6981 translate_all_program_units
../../gcc/fortran/parse.c:6338
0x6e6981 gfc_parse_file()
../../gcc/fortran/parse.c:6620
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/99112] [11 Regression] ICE in gfc_conv_component_ref, at fortran/trans-expr.c:2646
2021-02-15 17:58 [Bug fortran/99112] New: [11 Regression] ICE in gfc_conv_component_ref, at fortran/trans-expr.c:2646 gscfq@t-online.de
@ 2021-02-16 7:27 ` rguenth at gcc dot gnu.org
2021-02-16 9:49 ` marxin at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-02-16 7:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99112
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P4
Target Milestone|--- |11.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/99112] [11 Regression] ICE in gfc_conv_component_ref, at fortran/trans-expr.c:2646
2021-02-15 17:58 [Bug fortran/99112] New: [11 Regression] ICE in gfc_conv_component_ref, at fortran/trans-expr.c:2646 gscfq@t-online.de
2021-02-16 7:27 ` [Bug fortran/99112] " rguenth at gcc dot gnu.org
@ 2021-02-16 9:49 ` marxin at gcc dot gnu.org
2021-02-18 20:13 ` pault at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-02-16 9:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99112
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |anlauf at gcc dot gnu.org,
| |marxin at gcc dot gnu.org
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2021-02-16
--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed, started with r11-5064-g0c81ccc3d87098b9.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/99112] [11 Regression] ICE in gfc_conv_component_ref, at fortran/trans-expr.c:2646
2021-02-15 17:58 [Bug fortran/99112] New: [11 Regression] ICE in gfc_conv_component_ref, at fortran/trans-expr.c:2646 gscfq@t-online.de
2021-02-16 7:27 ` [Bug fortran/99112] " rguenth at gcc dot gnu.org
2021-02-16 9:49 ` marxin at gcc dot gnu.org
@ 2021-02-18 20:13 ` pault at gcc dot gnu.org
2021-03-11 22:27 ` anlauf at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu.org @ 2021-02-18 20:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99112
Paul Thomas <pault at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pault at gcc dot gnu.org
--- Comment #2 from Paul Thomas <pault at gcc dot gnu.org> ---
Created attachment 50219
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50219&action=edit
Patch for the PR
In tackling the problem in gfc_conv_intrinsic_size, I noticed that there is
similar code in gfc_conv_procedure_call that is plain and simple wrong. I have
fixed both but, in the example, the incidental fix over-rides the intended one
:-)
For whatever reason, the chunk in gfc_conv_intrinsic_size doesn't quite work
correctly because the wrong message is selected. Thus a bit more work is
required....
Cheers
Paul
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/99112] [11 Regression] ICE in gfc_conv_component_ref, at fortran/trans-expr.c:2646
2021-02-15 17:58 [Bug fortran/99112] New: [11 Regression] ICE in gfc_conv_component_ref, at fortran/trans-expr.c:2646 gscfq@t-online.de
` (2 preceding siblings ...)
2021-02-18 20:13 ` pault at gcc dot gnu.org
@ 2021-03-11 22:27 ` anlauf at gcc dot gnu.org
2021-03-12 20:45 ` anlauf at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-03-11 22:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99112
--- Comment #3 from anlauf at gcc dot gnu.org ---
(In reply to Paul Thomas from comment #2)
> For whatever reason, the chunk in gfc_conv_intrinsic_size doesn't quite work
> correctly because the wrong message is selected. Thus a bit more work is
> required....
Playing around with reduced testcases shows that the origin might be
rather obscure. The following case does not generate any runtime error
with -fcheck=pointer:
module m
type t
end type
contains
function f(x) result(z)
integer :: x(:)
type(t) :: z(size(x))
end
subroutine s
integer :: a(2)
class(t), allocatable :: c(:)
c = f(a)
end
end
while replacing the type of dummy x in f to class(*):
module m
type t
end type
contains
function f(x) result(z)
class(*) :: x(:)
type(t) :: z(size(x))
end
subroutine s
integer :: a(2)
class(t), allocatable :: c(:)
c = f(a)
end
end
now has in the dump tree within the caller s:
_gfortran_runtime_error_at (&"At line 7 of file pr99112-z3.f90"[1]{lb: 1 sz:
1}, &"Pointer argument \'x\' is not associated"[1]{lb: 1 sz: 1});
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/99112] [11 Regression] ICE in gfc_conv_component_ref, at fortran/trans-expr.c:2646
2021-02-15 17:58 [Bug fortran/99112] New: [11 Regression] ICE in gfc_conv_component_ref, at fortran/trans-expr.c:2646 gscfq@t-online.de
` (3 preceding siblings ...)
2021-03-11 22:27 ` anlauf at gcc dot gnu.org
@ 2021-03-12 20:45 ` anlauf at gcc dot gnu.org
2021-03-14 19:41 ` cvs-commit at gcc dot gnu.org
2021-03-14 19:57 ` anlauf at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-03-12 20:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99112
--- Comment #4 from anlauf at gcc dot gnu.org ---
A simple one-liner on top of Paul's patch fixes it:
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
index 9cf3642f694..5e53d1162fa 100644
--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -8006,8 +8006,10 @@ gfc_conv_intrinsic_size (gfc_se * se, gfc_expr * expr)
{
symbol_attribute attr;
char *msg;
+ tree temp;
+ tree cond;
- attr = gfc_expr_attr (e);
+ attr = sym ? sym->attr : gfc_expr_attr (e);
if (attr.allocatable)
msg = xasprintf ("Allocatable argument '%s' is not allocated",
e->symtree->n.sym->name);
Submitted: https://gcc.gnu.org/pipermail/fortran/2021-March/055809.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/99112] [11 Regression] ICE in gfc_conv_component_ref, at fortran/trans-expr.c:2646
2021-02-15 17:58 [Bug fortran/99112] New: [11 Regression] ICE in gfc_conv_component_ref, at fortran/trans-expr.c:2646 gscfq@t-online.de
` (4 preceding siblings ...)
2021-03-12 20:45 ` anlauf at gcc dot gnu.org
@ 2021-03-14 19:41 ` cvs-commit at gcc dot gnu.org
2021-03-14 19:57 ` anlauf at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-14 19:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99112
--- Comment #5 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:c2d7c39fcb8a3cb67600cdb6fde49ecb0e951589
commit r11-7661-gc2d7c39fcb8a3cb67600cdb6fde49ecb0e951589
Author: Harald Anlauf <anlauf@gmx.de>
Date: Sun Mar 14 20:39:58 2021 +0100
PR fortran/99112 - ICE with runtime diagnostics for SIZE intrinsic function
Add/fix handling of runtime checks for CLASS arguments with ALLOCATABLE
or POINTER attribute.
gcc/fortran/ChangeLog:
* trans-expr.c (gfc_conv_procedure_call): Fix runtime checks for
CLASS arguments.
* trans-intrinsic.c (gfc_conv_intrinsic_size): Likewise.
gcc/testsuite/ChangeLog:
* gfortran.dg/pr99112.f90: New test.
Co-authored-by: Paul Thomas <pault@gcc.gnu.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/99112] [11 Regression] ICE in gfc_conv_component_ref, at fortran/trans-expr.c:2646
2021-02-15 17:58 [Bug fortran/99112] New: [11 Regression] ICE in gfc_conv_component_ref, at fortran/trans-expr.c:2646 gscfq@t-online.de
` (5 preceding siblings ...)
2021-03-14 19:41 ` cvs-commit at gcc dot gnu.org
@ 2021-03-14 19:57 ` anlauf at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-03-14 19:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99112
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #6 from anlauf at gcc dot gnu.org ---
Committed to mainline for gcc-11.
This fixes the testcase, but there are related cases which are not addressed
yet, see e.g. pr99585 which ICEs even without -fcheck=pointer.
Thanks for the report!
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-03-14 19:57 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-15 17:58 [Bug fortran/99112] New: [11 Regression] ICE in gfc_conv_component_ref, at fortran/trans-expr.c:2646 gscfq@t-online.de
2021-02-16 7:27 ` [Bug fortran/99112] " rguenth at gcc dot gnu.org
2021-02-16 9:49 ` marxin at gcc dot gnu.org
2021-02-18 20:13 ` pault at gcc dot gnu.org
2021-03-11 22:27 ` anlauf at gcc dot gnu.org
2021-03-12 20:45 ` anlauf at gcc dot gnu.org
2021-03-14 19:41 ` cvs-commit at gcc dot gnu.org
2021-03-14 19:57 ` 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).