public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/55824] New: [OOP] ICE with ALLOCATE and SOURCE= TRANSPOSE/RESHAPE
@ 2012-12-28 16:50 burnus at gcc dot gnu.org
2012-12-28 23:34 ` [Bug fortran/55824] " burnus at gcc dot gnu.org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-12-28 16:50 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55824
Bug #: 55824
Summary: [OOP] ICE with ALLOCATE and SOURCE= TRANSPOSE/RESHAPE
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: burnus@gcc.gnu.org
CC: janus@gcc.gnu.org, pault@gcc.gnu.org
Created attachment 29057
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29057
Failing test case
The following example by Reinhold Bader gives an ICE.
It uses CLASS(*) but allegedly the issue also occurs with nonunlimited
polymorphics.
The ICE occurs for:
class(*), allocatable :: x(:,:), y(:,:), z(:)
...
allocate(y(3,3), source=transpose(x)) ! <<< ICE
...
allocate(z(9), source=reshape(x, (/ 9 /))) ! <<< ICE
Backtraces:
0x5fd05b gfc_conv_scalarized_array_ref
../../gcc/fortran/trans-array.c:3042
0x5fda71 gfc_conv_array_ref(gfc_se*, gfc_array_ref*, gfc_symbol*, locus*)
../../gcc/fortran/trans-array.c:3168
0x62ba7f gfc_conv_variable
../../gcc/fortran/trans-expr.c:1795
and
0x62794d 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:4955
0x63f7b5 conv_generic_with_optional_char_arg
../../gcc/fortran/trans-intrinsic.c:4526
0x63f7b5 gfc_conv_intrinsic_function(gfc_se*, gfc_expr*)
../../gcc/fortran/trans-intrinsic.c:6306
0x628488 gfc_conv_function_expr
../../gcc/fortran/trans-expr.c:5524
0x628488 gfc_conv_expr(gfc_se*, gfc_expr*)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/55824] [OOP] ICE with ALLOCATE and SOURCE= TRANSPOSE/RESHAPE
2012-12-28 16:50 [Bug fortran/55824] New: [OOP] ICE with ALLOCATE and SOURCE= TRANSPOSE/RESHAPE burnus at gcc dot gnu.org
@ 2012-12-28 23:34 ` burnus at gcc dot gnu.org
2012-12-29 10:13 ` burnus at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-12-28 23:34 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55824
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |burnus at gcc dot gnu.org
--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-12-28 23:34:26 UTC ---
> allocate(y(3,3), source=transpose(x))
This one fails in trans-stmt.c's gfc_trans_allocate for expr3:
gfc_init_se (&se_sz, NULL);
gfc_conv_expr_reference (&se_sz, code->expr3);
which invokes gfc_conv_variable as se->ss is NULL and se->descriptor_only is
false:
case REF_ARRAY:
...
gfc_conv_array_ref (se, &ref->u.ar, sym, &expr->where);
which expects se->ss != NULL.
If one sets descriptor_only = 1, it will fail for:
memsize = gfc_vtable_size_get (classexpr);
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/55824] [OOP] ICE with ALLOCATE and SOURCE= TRANSPOSE/RESHAPE
2012-12-28 16:50 [Bug fortran/55824] New: [OOP] ICE with ALLOCATE and SOURCE= TRANSPOSE/RESHAPE burnus at gcc dot gnu.org
2012-12-28 23:34 ` [Bug fortran/55824] " burnus at gcc dot gnu.org
@ 2012-12-29 10:13 ` burnus at gcc dot gnu.org
2013-01-08 12:37 ` dominiq at lps dot ens.fr
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-12-29 10:13 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55824
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-12-29 10:12:46 UTC ---
>From trans-stmt.c's gfc_trans_allocate
/* Evaluate expr3 just once if not a variable. */
...
&& code->expr3->ts.type == BT_CLASS
&& code->expr3->expr_type != EXPR_VARIABLE)
...
classexpr = gfc_evaluate_now (classexpr, &se.pre);
I think we should handle intrinsic functions in a special way as they never
change the actual type BT_CLASS; thus, the actual type can be taken from the
actual argument of RESHAPE/TRANSPOSE. (Though, check that "transfer(f())"
doesn't evaluate "f" twice.)
(If one skips that if block, the ICE occurs in gfc_array_allocate when
obtaining the size via gfc_array_init_size.)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/55824] [OOP] ICE with ALLOCATE and SOURCE= TRANSPOSE/RESHAPE
2012-12-28 16:50 [Bug fortran/55824] New: [OOP] ICE with ALLOCATE and SOURCE= TRANSPOSE/RESHAPE burnus at gcc dot gnu.org
2012-12-28 23:34 ` [Bug fortran/55824] " burnus at gcc dot gnu.org
2012-12-29 10:13 ` burnus at gcc dot gnu.org
@ 2013-01-08 12:37 ` dominiq at lps dot ens.fr
2015-06-30 0:23 ` damian at sourceryinstitute dot org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: dominiq at lps dot ens.fr @ 2013-01-08 12:37 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55824
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2013-01-08
Ever Confirmed|0 |1
--- Comment #3 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2013-01-08 12:37:05 UTC ---
Confirmed.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/55824] [OOP] ICE with ALLOCATE and SOURCE= TRANSPOSE/RESHAPE
2012-12-28 16:50 [Bug fortran/55824] New: [OOP] ICE with ALLOCATE and SOURCE= TRANSPOSE/RESHAPE burnus at gcc dot gnu.org
` (2 preceding siblings ...)
2013-01-08 12:37 ` dominiq at lps dot ens.fr
@ 2015-06-30 0:23 ` damian at sourceryinstitute dot org
2015-06-30 0:24 ` damian at sourceryinstitute dot org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: damian at sourceryinstitute dot org @ 2015-06-30 0:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55824
Damian Rouson <damian at sourceryinstitute dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |damian at sourceryinstitute dot or
| |g
--- Comment #4 from Damian Rouson <damian at sourceryinstitute dot org> ---
I'm guessing the code below is another manifestation of the this bug:
$ cat ice-on-pack-unlimited-polymorphic.f90
contains
subroutine array_to_vector(array)
class(*), allocatable :: vector(:),array(:,:)
allocate(vector,source=pack(array,.true.))
end subroutine
end
$ gfortran ice-on-pack-unlimited-polymorphic.f90
ice-on-pack-unlimited-polymorphic.f90:4:0:
allocate(vector,source=pack(array,.true.))
1
internal compiler error: Segmentation fault: 11
ice-on-pack-unlimited-polymorphic.f90:4:0: internal compiler error: Abort trap:
6
gfortran: internal compiler error: Abort trap: 6 (program f951)
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://trac.macports.org/newticket> for instructions.
$ gfortran --version
GNU Fortran (MacPorts gcc6 6-20150621_0) 6.0.0 20150621 (experimental)
...
$ sudo port select --set gcc mp-gcc5
Selecting 'mp-gcc5' for 'gcc' succeeded. 'mp-gcc5' is now active.
$ gfortran ice-on-pack-unlimited-polymorphic.f90
ice-on-pack-unlimited-polymorphic.f90:4:13:
allocate(vector,source=pack(array,.true.))
1
Error: Array specification required in ALLOCATE statement at (1)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/55824] [OOP] ICE with ALLOCATE and SOURCE= TRANSPOSE/RESHAPE
2012-12-28 16:50 [Bug fortran/55824] New: [OOP] ICE with ALLOCATE and SOURCE= TRANSPOSE/RESHAPE burnus at gcc dot gnu.org
` (3 preceding siblings ...)
2015-06-30 0:23 ` damian at sourceryinstitute dot org
@ 2015-06-30 0:24 ` damian at sourceryinstitute dot org
2015-10-29 12:32 ` dominiq at lps dot ens.fr
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: damian at sourceryinstitute dot org @ 2015-06-30 0:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55824
--- Comment #5 from Damian Rouson <damian at sourceryinstitute dot org> ---
I'm guessing the code below is another manifestation of the this bug:
$ cat ice-on-pack-unlimited-polymorphic.f90
contains
subroutine array_to_vector(array)
class(*), allocatable :: vector(:),array(:,:)
allocate(vector,source=pack(array,.true.))
end subroutine
end
$ gfortran ice-on-pack-unlimited-polymorphic.f90
ice-on-pack-unlimited-polymorphic.f90:4:0:
allocate(vector,source=pack(array,.true.))
1
internal compiler error: Segmentation fault: 11
ice-on-pack-unlimited-polymorphic.f90:4:0: internal compiler error: Abort trap:
6
gfortran: internal compiler error: Abort trap: 6 (program f951)
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://trac.macports.org/newticket> for instructions.
$ gfortran --version
GNU Fortran (MacPorts gcc6 6-20150621_0) 6.0.0 20150621 (experimental)
...
$ sudo port select --set gcc mp-gcc5
Selecting 'mp-gcc5' for 'gcc' succeeded. 'mp-gcc5' is now active.
$ gfortran ice-on-pack-unlimited-polymorphic.f90
ice-on-pack-unlimited-polymorphic.f90:4:13:
allocate(vector,source=pack(array,.true.))
1
Error: Array specification required in ALLOCATE statement at (1)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/55824] [OOP] ICE with ALLOCATE and SOURCE= TRANSPOSE/RESHAPE
2012-12-28 16:50 [Bug fortran/55824] New: [OOP] ICE with ALLOCATE and SOURCE= TRANSPOSE/RESHAPE burnus at gcc dot gnu.org
` (4 preceding siblings ...)
2015-06-30 0:24 ` damian at sourceryinstitute dot org
@ 2015-10-29 12:32 ` dominiq at lps dot ens.fr
2021-12-17 21:58 ` pinskia at gcc dot gnu.org
2023-11-29 10:47 ` pault at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-10-29 12:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55824
--- Comment #6 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Related to/duplicate of pr57117? With the patch in comment 5 of pr57117, the
original code in comment 0 compiles but segfault at run time, while the
original test in pr57117 does not (altho there is a problem with
"allocate(y(3,3), source=transpose(x))".
Compiling the test in comment 4 still gives an ICE at r229494 with the patch
pr55824_1.f90:4:0:
allocate(vector,source=pack(array,.true.))
1
internal compiler error: in wide_int_to_tree, at tree.c:1480
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/55824] [OOP] ICE with ALLOCATE and SOURCE= TRANSPOSE/RESHAPE
2012-12-28 16:50 [Bug fortran/55824] New: [OOP] ICE with ALLOCATE and SOURCE= TRANSPOSE/RESHAPE burnus at gcc dot gnu.org
` (5 preceding siblings ...)
2015-10-29 12:32 ` dominiq at lps dot ens.fr
@ 2021-12-17 21:58 ` pinskia at gcc dot gnu.org
2023-11-29 10:47 ` pault at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-17 21:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55824
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to work| |7.1.0
Known to fail| |5.5.0, 6.3.0
--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Seems to be working in GCC 7+.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/55824] [OOP] ICE with ALLOCATE and SOURCE= TRANSPOSE/RESHAPE
2012-12-28 16:50 [Bug fortran/55824] New: [OOP] ICE with ALLOCATE and SOURCE= TRANSPOSE/RESHAPE burnus at gcc dot gnu.org
` (6 preceding siblings ...)
2021-12-17 21:58 ` pinskia at gcc dot gnu.org
@ 2023-11-29 10:47 ` pault at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: pault at gcc dot gnu.org @ 2023-11-29 10:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55824
--- Comment #8 from Paul Thomas <pault at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #7)
> Seems to be working in GCC 7+.
Hmmm! It seems to me to be broken from 7-branch through the current mainline.
Cheers
Paul
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2023-11-29 10:47 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-28 16:50 [Bug fortran/55824] New: [OOP] ICE with ALLOCATE and SOURCE= TRANSPOSE/RESHAPE burnus at gcc dot gnu.org
2012-12-28 23:34 ` [Bug fortran/55824] " burnus at gcc dot gnu.org
2012-12-29 10:13 ` burnus at gcc dot gnu.org
2013-01-08 12:37 ` dominiq at lps dot ens.fr
2015-06-30 0:23 ` damian at sourceryinstitute dot org
2015-06-30 0:24 ` damian at sourceryinstitute dot org
2015-10-29 12:32 ` dominiq at lps dot ens.fr
2021-12-17 21:58 ` pinskia at gcc dot gnu.org
2023-11-29 10:47 ` 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).