[Bug fortran/57117] [OOP] ICE for sourced allocation of a polymorphic entity using TRANSPOSE

2016-11-16 Thread janus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57117

janus at gcc dot gnu.org changed:

   What|Removed |Added

   Target Milestone|5.5 |7.0

[Bug fortran/57117] [OOP] ICE for sourced allocation of a polymorphic entity using TRANSPOSE

2016-10-31 Thread vehre at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57117

vehre at gcc dot gnu.org changed:

   What|Removed |Added

 Status|WAITING |RESOLVED
 Resolution|--- |FIXED

--- Comment #17 from vehre at gcc dot gnu.org ---
No complaints so far, closing.

[Bug fortran/57117] [OOP] ICE for sourced allocation of a polymorphic entity using TRANSPOSE

2016-10-24 Thread vehre at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57117

vehre at gcc dot gnu.org changed:

   What|Removed |Added

 Status|ASSIGNED|WAITING

--- Comment #16 from vehre at gcc dot gnu.org ---
Waiting one week for regression reports.

[Bug fortran/57117] [OOP] ICE for sourced allocation of a polymorphic entity using TRANSPOSE

2016-10-22 Thread vehre at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57117

--- Comment #15 from vehre at gcc dot gnu.org ---
Author: vehre
Date: Sat Oct 22 12:33:38 2016
New Revision: 241439

URL: https://gcc.gnu.org/viewcvs?rev=241439=gcc=rev
Log:
gcc/fortran/ChangeLog:

2016-10-22  Andre Vehreschild  

PR fortran/43366
PR fortran/51864
PR fortran/57117
PR fortran/61337
PR fortran/61376
* primary.c (gfc_expr_attr): For transformational functions on classes
get the attrs from the class argument.
* resolve.c (resolve_ordinary_assign): Remove error message due to
feature implementation.  Rewrite POINTER_ASSIGNS to ordinary ones when
the right-hand side is scalar class object (with some restrictions).
* trans-array.c (trans_array_constructor): Create the temporary from
class' inner type, i.e., the derived type.
(build_class_array_ref): Add support for class array's storage of the
class object or the array descriptor in the decl saved descriptor.
(gfc_conv_expr_descriptor): When creating temporaries for class objects
add the class object's handle into the decl saved descriptor.
(structure_alloc_comps): Use the common way to get the _data component.
(gfc_is_reallocatable_lhs): Add notion of allocatable class objects.
* trans-expr.c (gfc_find_and_cut_at_last_class_ref): Remove the only
ref
only when the expression's type is BT_CLASS.
(gfc_trans_class_init_assign): Correctly handle class arrays.
(gfc_trans_class_assign): Joined into gfc_trans_assignment_1.
(gfc_conv_procedure_call): Support for class types as arguments.
(trans_get_upoly_len): For unlimited polymorphics retrieve the _len
component's tree.
(trans_class_vptr_len_assignment): Catch all ways to assign the _vptr
and _len components of a class object correctly.
(pointer_assignment_is_proc_pointer): Identify assignments of
procedure pointers.
(gfc_trans_pointer_assignment): Enhance support for class object
pointer
assignments.
(gfc_trans_scalar_assign): Removed assert.
(trans_class_assignment): Assign to a class object.
(gfc_trans_assignment_1): Treat class objects correctly.
(gfc_trans_assignment): Propagate flags to trans_assignment_1.
* trans-stmt.c (gfc_trans_allocate): Use gfc_trans_assignment now
instead of copy_class_to_class.
* trans-stmt.h: Function prototype removed.
* trans.c (trans_code): Less special casing for class objects.
* trans.h: Added flags to gfc_trans_assignment () prototype.

gcc/testsuite/ChangeLog:

2016-10-22  Andre Vehreschild  

Forgot to add on original commit.
* gfortran.dg/coarray_alloc_comp_2.f08: New test.

2016-10-22  Andre Vehreschild  

PR fortran/43366
PR fortran/57117
PR fortran/61337
* gfortran.dg/alloc_comp_class_5.f03: New test.
* gfortran.dg/class_allocate_21.f90: New test.
* gfortran.dg/class_allocate_22.f90: New test.
* gfortran.dg/realloc_on_assign_27.f08: New test.



Added:
trunk/gcc/testsuite/gfortran.dg/alloc_comp_class_5.f03
trunk/gcc/testsuite/gfortran.dg/class_allocate_21.f90
trunk/gcc/testsuite/gfortran.dg/class_allocate_22.f90
trunk/gcc/testsuite/gfortran.dg/coarray_alloc_comp_2.f08
trunk/gcc/testsuite/gfortran.dg/realloc_on_assign_27.f08
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/primary.c
trunk/gcc/fortran/resolve.c
trunk/gcc/fortran/trans-array.c
trunk/gcc/fortran/trans-expr.c
trunk/gcc/fortran/trans-stmt.c
trunk/gcc/fortran/trans-stmt.h
trunk/gcc/fortran/trans.c
trunk/gcc/fortran/trans.h
trunk/gcc/testsuite/ChangeLog

[Bug fortran/57117] [OOP] ICE for sourced allocation of a polymorphic entity using TRANSPOSE

2016-09-08 Thread vehre at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57117

vehre at gcc dot gnu.org changed:

   What|Removed |Added

   Priority|P3  |P4
 Status|NEW |ASSIGNED
   Assignee|pault at gcc dot gnu.org   |vehre at gcc dot gnu.org
   Target Milestone|--- |5.5

[Bug fortran/57117] [OOP] ICE for sourced allocation of a polymorphic entity using TRANSPOSE

2016-09-07 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57117

--- Comment #14 from Dominique d'Humieres  ---
> Created attachment 39581 [details]
> Shorter version to fix the issue.
> ...

The patch fixes the ICEs, but generates wrong-code for the original test: the
output at run time is

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

Same thing for the test in comment 5:

 ti
   1.2.3.  
 4.5.6.   
7.8.9. 
 ri
   1.2.3.  
 4.5.0.   
0.0.0. 
   1   2   3   4   0   0   
   0   0   0

[Bug fortran/57117] [OOP] ICE for sourced allocation of a polymorphic entity using TRANSPOSE

2016-09-07 Thread vehre at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57117

--- Comment #13 from vehre at gcc dot gnu.org ---
Created attachment 39581
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=39581=edit
Shorter version to fix the issue.

Hi all,

Dominique pointed out, that the patches proposed by Paul conflict with my accaf
patch. I took a look and found a less-intrusive version to fix this issue.

Note!!! This patch is base on my patch for pr72832 available from:

https://gcc.gnu.org/ml/fortran/2016-09/msg7.html

Bootstraps and regtests ok on x86_64-linux/F23. I haven't tested this patch in
combination with my accaf patch yet (time constraints).

- Andre

[Bug fortran/57117] [OOP] ICE for sourced allocation of a polymorphic entity using TRANSPOSE

2015-10-30 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57117

--- Comment #10 from Dominique d'Humieres  ---
> Created attachment 36618
>   --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36618=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.


[Bug fortran/57117] [OOP] ICE for sourced allocation of a polymorphic entity using TRANSPOSE

2015-10-30 Thread paul.richard.thomas at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57117

--- Comment #11 from 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
 wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57117
>
> --- Comment #10 from Dominique d'Humieres  ---
>> Created attachment 36618
>>   --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36618=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.


[Bug fortran/57117] [OOP] ICE for sourced allocation of a polymorphic entity using TRANSPOSE

2015-10-30 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57117

--- Comment #12 from Dominique d'Humieres  ---
> 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  0x00010010d6fc in vptr_field_get(tree_node*, int) ()
#1  0x000100114003 in gfc_copy_class_to_class(tree_node*, tree_node*,
tree_node*, bool) ()
#2  0x00010016615e in gfc_trans_allocate(gfc_code*) ()
#3  0x0001000d7798 in trans_code(gfc_code*, tree_node*) ()
#4  0x00010010a0b6 in gfc_generate_function_code(gfc_namespace*) ()
#5  0x00010008cd4c in gfc_parse_file() ()
#6  0x0001000d407b in gfc_be_parse_file() ()
#7  0x000100ae893a in compile_file() ()
#8  0x000100fbafcc in toplev::main(int, char**) ()
#9  0x000100fbc989 in main ()


[Bug fortran/57117] [OOP] ICE for sourced allocation of a polymorphic entity using TRANSPOSE

2015-10-29 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57117

--- Comment #8 from Dominique d'Humieres  ---
Related to/duplicate of pr55824? Still fails for
"allocate(vector,source=pack(array,.true.))".


[Bug fortran/57117] [OOP] ICE for sourced allocation of a polymorphic entity using TRANSPOSE

2015-10-29 Thread pault at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57117

--- Comment #9 from Paul Thomas  ---
Created attachment 36618
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36618=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


[Bug fortran/57117] [OOP] ICE for sourced allocation of a polymorphic entity using TRANSPOSE

2015-10-28 Thread pault at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57117

--- Comment #5 from Paul Thomas  ---
Created attachment 36609
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36609=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


[Bug fortran/57117] [OOP] ICE for sourced allocation of a polymorphic entity using TRANSPOSE

2015-10-28 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57117

--- Comment #6 from Dominique d'Humieres  ---
> 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)'.


[Bug fortran/57117] [OOP] ICE for sourced allocation of a polymorphic entity using TRANSPOSE

2015-10-28 Thread paul.richard.thomas at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57117

--- Comment #7 from paul.richard.thomas at gmail dot com  ---
Dear Dominique,

That is entirely possible. I concentrated exclusively on reshape. I
will have a look at the original problem later.

Thanks a lot

Paul


On 28 October 2015 at 18:24, dominiq at lps dot ens.fr
 wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57117
>
> --- Comment #6 from Dominique d'Humieres  ---
>> 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)'.
>
> --
> You are receiving this mail because:
> You are on the CC list for the bug.
> You are the assignee for the bug.


[Bug fortran/57117] [OOP] ICE for sourced allocation of a polymorphic entity using TRANSPOSE

2015-10-25 Thread pault at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57117

Paul Thomas  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |pault at gcc dot gnu.org

--- Comment #4 from Paul Thomas  ---
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


[Bug fortran/57117] [OOP] ICE for sourced allocation of a polymorphic entity using TRANSPOSE

2013-04-30 Thread janus at gcc dot gnu.org


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


[Bug fortran/57117] [OOP] ICE for sourced allocation of a polymorphic entity using TRANSPOSE

2013-04-30 Thread dominiq at lps dot ens.fr


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



--- Comment #3 from Dominique d'Humieres dominiq at lps dot ens.fr 2013-04-30 
16:39:38 UTC ---

Reduced test for RESHAPE:



  implicit none



  type :: ti

  end type



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



  allocate(z(9), source=reshape(x, (/ 9 /)))



end



pr57117_2.f90:8:0: internal compiler error: in gfc_conv_procedure_call, at

fortran/trans-expr.c:4902

   allocate(z(9), source=reshape(x, (/ 9 /)))