public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/57117] New: ICE for sourced allocation of a UP entity that uses the transpose intrinsic
@ 2013-04-29 19:59 Bader at lrz dot de
  2013-04-29 21:34 ` [Bug fortran/57117] " dominiq at lps dot ens.fr
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: Bader at lrz dot de @ 2013-04-29 19:59 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57117

             Bug #: 57117
           Summary: ICE for sourced allocation of a UP entity that uses
                    the transpose intrinsic
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: Bader@lrz.de


Created attachment 29977
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29977
module and main program as standalone source.

The attached source code causes a segfault in gfortran at compile time: 

intrinsics_02_pos.f90:61:0: internal compiler error: Segmentation fault
   allocate(y(3,3), source=transpose(x))
0x87e07f crash_signal             
        ../../gcc-4.8.0/gcc/toplev.c:332
0x5ad22b gfc_conv_scalarized_array_ref
        ../../gcc-4.8.0/gcc/fortran/trans-array.c:3037
0x5adb89 gfc_conv_array_ref(gfc_se*, gfc_array_ref*, gfc_symbol*, locus*)
        ../../gcc-4.8.0/gcc/fortran/trans-array.c:3172
0x5d0cdf gfc_conv_variable
        ../../gcc-4.8.0/gcc/fortran/trans-expr.c:1809
0x5cddaa gfc_conv_expr(gfc_se*, gfc_expr*)
        ../../gcc-4.8.0/gcc/fortran/trans-expr.c:6266
0x5e158c gfc_conv_intrinsic_function(gfc_se*, gfc_expr*)
        ../../gcc-4.8.0/gcc/fortran/trans-intrinsic.c:6697
0x5cd832 gfc_conv_function_expr
        ../../gcc-4.8.0/gcc/fortran/trans-expr.c:5547
0x5cdd1a gfc_conv_expr(gfc_se*, gfc_expr*)
        ../../gcc-4.8.0/gcc/fortran/trans-expr.c:6258
0x5d1d05 gfc_conv_expr_reference(gfc_se*, gfc_expr*)
        ../../gcc-4.8.0/gcc/fortran/trans-expr.c:6387
0x5f30be gfc_trans_allocate(gfc_code*)
        ../../gcc-4.8.0/gcc/fortran/trans-stmt.c:4911
0x5a7647 trans_code
        ../../gcc-4.8.0/gcc/fortran/trans.c:1577
0x5c4be2 gfc_generate_function_code(gfc_namespace*)
        ../../gcc-4.8.0/gcc/fortran/trans-decl.c:5397
0x568880 translate_all_program_units
        ../../gcc-4.8.0/gcc/fortran/parse.c:4468
0x568880 gfc_parse_file()
        ../../gcc-4.8.0/gcc/fortran/parse.c:4682
0x5a3c25 gfc_be_parse_file
        ../../gcc-4.8.0/gcc/fortran/f95-lang.c:189


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/57117] ICE for sourced allocation of a UP entity that uses the transpose intrinsic
  2013-04-29 19:59 [Bug fortran/57117] New: ICE for sourced allocation of a UP entity that uses the transpose intrinsic Bader at lrz dot de
@ 2013-04-29 21:34 ` dominiq at lps dot ens.fr
  2013-04-30 12:22 ` [Bug fortran/57117] [OOP] ICE for sourced allocation of a polymorphic entity using TRANSPOSE janus at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: dominiq at lps dot ens.fr @ 2013-04-29 21:34 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57117

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-04-29
     Ever Confirmed|0                           |1

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2013-04-29 21:34:28 UTC ---
Confirmed. If I comment out the block

  call construct(x, 1)

  allocate(y(3,3), source=transpose(x))
  select type (y)
  type is(ti)
     if (y(3,1)%i /= 7) ok(5) = .false.
  class default
     ok(6) = .false.
  end select
  deallocate(y)  <--- it should be deallocate(x, y) otherwise call construct(x,
2) complains

then I get the following ICE

pr57117_db.f90: In function 'intr_02':
pr57117_db.f90:86:0: internal compiler error: in gfc_conv_procedure_call, at
fortran/trans-expr.c:4888
   allocate(z(9), source=reshape(x, (/ 9 /)))


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/57117] [OOP] ICE for sourced allocation of a polymorphic entity using TRANSPOSE
  2013-04-29 19:59 [Bug fortran/57117] New: ICE for sourced allocation of a UP entity that uses the transpose intrinsic Bader at lrz dot de
  2013-04-29 21:34 ` [Bug fortran/57117] " dominiq at lps dot ens.fr
@ 2013-04-30 12:22 ` janus at gcc dot gnu.org
  2015-10-25 15:54 ` pault at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: janus at gcc dot gnu.org @ 2013-04-30 12:22 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57117

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |janus at gcc dot gnu.org
            Summary|CLASS(*): ICE for sourced   |[OOP] ICE for sourced
                   |allocation of a UP entity   |allocation of a polymorphic
                   |that uses the transpose     |entity using TRANSPOSE
                   |intrinsic                   |

--- Comment #2 from janus at gcc dot gnu.org 2013-04-30 12:22:40 UTC ---
Also this one can be triggered without UP:


  implicit none

  type :: ti
  end type

  class(ti), allocatable :: x(:,:), y(:,:)

  allocate(y(3,3), source=transpose(x))

end


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/57117] [OOP] ICE for sourced allocation of a polymorphic entity using TRANSPOSE
  2013-04-29 19:59 [Bug fortran/57117] New: ICE for sourced allocation of a UP entity that uses the transpose intrinsic Bader at lrz dot de
  2013-04-29 21:34 ` [Bug fortran/57117] " dominiq at lps dot ens.fr
  2013-04-30 12:22 ` [Bug fortran/57117] [OOP] ICE for sourced allocation of a polymorphic entity using TRANSPOSE janus at gcc dot gnu.org
@ 2015-10-25 15:54 ` pault at gcc dot gnu.org
  2015-10-28 14:58 ` pault at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pault at gcc dot gnu.org @ 2015-10-25 15:54 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57117

Paul Thomas <pault at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |pault at gcc dot gnu.org

--- Comment #4 from Paul Thomas <pault at gcc dot gnu.org> ---
The result from the reshape call is completely screwed up. The temporary, is
descriptor, whose data field is class objects, rather than returning the _data
field of the class object.

I can see how to fix this.

Paul


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/57117] [OOP] ICE for sourced allocation of a polymorphic entity using TRANSPOSE
  2013-04-29 19:59 [Bug fortran/57117] New: ICE for sourced allocation of a UP entity that uses the transpose intrinsic Bader at lrz dot de
                   ` (2 preceding siblings ...)
  2015-10-25 15:54 ` pault at gcc dot gnu.org
@ 2015-10-28 14:58 ` pault at gcc dot gnu.org
  2015-10-28 17:24 ` dominiq at lps dot ens.fr
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pault at gcc dot gnu.org @ 2015-10-28 14:58 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57117

--- Comment #5 from Paul Thomas <pault at gcc dot gnu.org> ---
Created attachment 36609
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36609&action=edit
Draft patch for the PR

The two TODOs should be noted. These must be fixed before submission. However,
this patch does regtest without regressions.

The following version of the testcase runs correctly.

Cheers

Paul

  implicit none
  integer :: j, k
  type :: ti
   real(8) :: r
  end type
  type, extends (ti) :: ri
    integer :: i
  end type
  class(ti), allocatable :: x(:,:), z(:)

  allocate (z, source = [(ti (real (j)), j = 1, 9)])
  allocate(x(3,3), source=reshape(z, (/ 3,3 /)))
  call foo
  deallocate (z, x)

  allocate (z, source = [(ri (real (j), j), j = 1, 9)])
  allocate(x(3,3), source=reshape(z, (/ 3,3 /)))
  call foo
  deallocate (z, x)

contains
  subroutine foo
    select type (x)
      type is (ti)
        print *, "ti"
        print *, x%r
      type is (ri)
        print *, "ri"
        print *, x%r
        print *, x%i
      class default
        call abort
    end select
  end subroutine
end


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/57117] [OOP] ICE for sourced allocation of a polymorphic entity using TRANSPOSE
  2013-04-29 19:59 [Bug fortran/57117] New: ICE for sourced allocation of a UP entity that uses the transpose intrinsic Bader at lrz dot de
                   ` (3 preceding siblings ...)
  2015-10-28 14:58 ` pault at gcc dot gnu.org
@ 2015-10-28 17:24 ` dominiq at lps dot ens.fr
  2015-10-29 12:33 ` dominiq at lps dot ens.fr
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-10-28 17:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57117

--- Comment #6 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> Created attachment 36609 [details]
> Draft patch for the PR

With this patch, the tests in this PR compile. However it seems that there is a
remaining issue with "allocate(y(3,3), source=transpose(x))": running the
original test outputs

 FAIL:  T T T T F T T T T T T T T T T

'y' seems to be filled with 'x' and not 'transpose(x)'.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/57117] [OOP] ICE for sourced allocation of a polymorphic entity using TRANSPOSE
  2013-04-29 19:59 [Bug fortran/57117] New: ICE for sourced allocation of a UP entity that uses the transpose intrinsic Bader at lrz dot de
                   ` (4 preceding siblings ...)
  2015-10-28 17:24 ` dominiq at lps dot ens.fr
@ 2015-10-29 12:33 ` dominiq at lps dot ens.fr
  2015-10-29 19:02 ` pault at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-10-29 12:33 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57117

--- Comment #8 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Related to/duplicate of pr55824? Still fails for
"allocate(vector,source=pack(array,.true.))".


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/57117] [OOP] ICE for sourced allocation of a polymorphic entity using TRANSPOSE
  2013-04-29 19:59 [Bug fortran/57117] New: ICE for sourced allocation of a UP entity that uses the transpose intrinsic Bader at lrz dot de
                   ` (5 preceding siblings ...)
  2015-10-29 12:33 ` dominiq at lps dot ens.fr
@ 2015-10-29 19:02 ` pault at gcc dot gnu.org
  2015-10-30  8:38 ` dominiq at lps dot ens.fr
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pault at gcc dot gnu.org @ 2015-10-29 19:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57117

--- Comment #9 from Paul Thomas <pault at gcc dot gnu.org> ---
Created attachment 36618
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36618&action=edit
A completely different approach to the fix.

This one does far better and is less invasive. It is not yet regtested but I am
certain that any problems will be trivial.

I will try with other transformational intrinsics than transpose and rehape,
whilst on tonight's flight to London.

Cheers

Paul


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/57117] [OOP] ICE for sourced allocation of a polymorphic entity using TRANSPOSE
  2013-04-29 19:59 [Bug fortran/57117] New: ICE for sourced allocation of a UP entity that uses the transpose intrinsic Bader at lrz dot de
                   ` (6 preceding siblings ...)
  2015-10-29 19:02 ` pault at gcc dot gnu.org
@ 2015-10-30  8:38 ` dominiq at lps dot ens.fr
  2015-10-30  9:29 ` paul.richard.thomas at gmail dot com
  2015-10-30  9:39 ` dominiq at lps dot ens.fr
  9 siblings, 0 replies; 11+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-10-30  8:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57117

--- Comment #10 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> Created attachment 36618
>   --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36618&action=edit
> A completely different approach to the fix.
>
> This one does far better and is less invasive. It is not yet regtested
> but I am certain that any problems will be trivial.

This patch does not like reshape and pack.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/57117] [OOP] ICE for sourced allocation of a polymorphic entity using TRANSPOSE
  2013-04-29 19:59 [Bug fortran/57117] New: ICE for sourced allocation of a UP entity that uses the transpose intrinsic Bader at lrz dot de
                   ` (7 preceding siblings ...)
  2015-10-30  8:38 ` dominiq at lps dot ens.fr
@ 2015-10-30  9:29 ` paul.richard.thomas at gmail dot com
  2015-10-30  9:39 ` dominiq at lps dot ens.fr
  9 siblings, 0 replies; 11+ messages in thread
From: paul.richard.thomas at gmail dot com @ 2015-10-30  9:29 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57117

--- Comment #11 from paul.richard.thomas at gmail dot com <paul.richard.thomas at gmail dot com> ---
Dear Dominique,

That's odd, it does fine with reshape on my machine ****sigh****

Could you send me the error, please?

pack generates a completely new ICE in the most peculiar place.

I have to put this on one side for a few days. I feel that I have got
to the core of the problem.but need to sort out the implementation.

With best regards

Paul

On 30 October 2015 at 09:38, dominiq at lps dot ens.fr
<gcc-bugzilla@gcc.gnu.org> wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57117
>
> --- Comment #10 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
>> Created attachment 36618
>>   --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36618&action=edit
>> A completely different approach to the fix.
>>
>> This one does far better and is less invasive. It is not yet regtested
>> but I am certain that any problems will be trivial.
>
> This patch does not like reshape and pack.
>
> --
> You are receiving this mail because:
> You are on the CC list for the bug.
> You are the assignee for the bug.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/57117] [OOP] ICE for sourced allocation of a polymorphic entity using TRANSPOSE
  2013-04-29 19:59 [Bug fortran/57117] New: ICE for sourced allocation of a UP entity that uses the transpose intrinsic Bader at lrz dot de
                   ` (8 preceding siblings ...)
  2015-10-30  9:29 ` paul.richard.thomas at gmail dot com
@ 2015-10-30  9:39 ` dominiq at lps dot ens.fr
  9 siblings, 0 replies; 11+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-10-30  9:39 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57117

--- Comment #12 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> That's odd, it does fine with reshape on my machine ****sigh****

Are you sure to have attached the right patch?

> Could you send me the error, please?

Compiling the test in comment 5 gives

pr57117_3.f90:12:0:

   allocate(x(3,3), source=reshape(z, (/ 3,3 /)))
1
internal compiler error: Segmentation fault: 11

The backtrace is

#0  0x000000010010d6fc in vptr_field_get(tree_node*, int) ()
#1  0x0000000100114003 in gfc_copy_class_to_class(tree_node*, tree_node*,
tree_node*, bool) ()
#2  0x000000010016615e in gfc_trans_allocate(gfc_code*) ()
#3  0x00000001000d7798 in trans_code(gfc_code*, tree_node*) ()
#4  0x000000010010a0b6 in gfc_generate_function_code(gfc_namespace*) ()
#5  0x000000010008cd4c in gfc_parse_file() ()
#6  0x00000001000d407b in gfc_be_parse_file() ()
#7  0x0000000100ae893a in compile_file() ()
#8  0x0000000100fbafcc in toplev::main(int, char**) ()
#9  0x0000000100fbc989 in main ()


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2015-10-30  9:39 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-29 19:59 [Bug fortran/57117] New: ICE for sourced allocation of a UP entity that uses the transpose intrinsic Bader at lrz dot de
2013-04-29 21:34 ` [Bug fortran/57117] " dominiq at lps dot ens.fr
2013-04-30 12:22 ` [Bug fortran/57117] [OOP] ICE for sourced allocation of a polymorphic entity using TRANSPOSE janus at gcc dot gnu.org
2015-10-25 15:54 ` pault at gcc dot gnu.org
2015-10-28 14:58 ` pault at gcc dot gnu.org
2015-10-28 17:24 ` dominiq at lps dot ens.fr
2015-10-29 12:33 ` dominiq at lps dot ens.fr
2015-10-29 19:02 ` pault at gcc dot gnu.org
2015-10-30  8:38 ` dominiq at lps dot ens.fr
2015-10-30  9:29 ` paul.richard.thomas at gmail dot com
2015-10-30  9:39 ` dominiq at lps dot ens.fr

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).