[Bug fortran/72832] [6/7 Regression] [OOP] ALLOCATE with SOURCE fails to allocate requested dimensions

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

vehre at gcc dot gnu.org changed:

   What|Removed |Added

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

--- Comment #14 from vehre at gcc dot gnu.org ---
Now closing.

[Bug fortran/72832] [6/7 Regression] [OOP] ALLOCATE with SOURCE fails to allocate requested dimensions

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

--- Comment #13 from vehre at gcc dot gnu.org ---
Author: vehre
Date: Sun Oct 23 11:55:44 2016
New Revision: 241448

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

2016-10-23  Andre Vehreschild  

Backport from trunk
PR fortran/72832
* trans-expr.c (gfc_copy_class_to_class): Add generation of
runtime array bounds check.
* trans-intrinsic.c (gfc_conv_intrinsic_size): Add a crutch to
get the descriptor of a function returning a class object.
* trans-stmt.c (gfc_trans_allocate): Use the array spec on the
array to allocate instead of the array spec from source=.

gcc/testsuite/ChangeLog:

2016-10-23  Andre Vehreschild  

Backport from trunk
PR fortran/72832
* gfortran.dg/allocate_with_source_22.f03: New test.
* gfortran.dg/allocate_with_source_23.f03: New test.  Expected to
fail.



Added:
branches/gcc-6-branch/gcc/testsuite/gfortran.dg/allocate_with_source_22.f03
branches/gcc-6-branch/gcc/testsuite/gfortran.dg/allocate_with_source_23.f03
Modified:
branches/gcc-6-branch/gcc/fortran/ChangeLog
branches/gcc-6-branch/gcc/fortran/trans-expr.c
branches/gcc-6-branch/gcc/fortran/trans-intrinsic.c
branches/gcc-6-branch/gcc/fortran/trans-stmt.c
branches/gcc-6-branch/gcc/testsuite/ChangeLog

[Bug fortran/72832] [6/7 Regression] [OOP] ALLOCATE with SOURCE fails to allocate requested dimensions

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

vehre at gcc dot gnu.org changed:

   What|Removed |Added

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

--- Comment #12 from vehre at gcc dot gnu.org ---
Whoops, that was wrong. Backporting to gcc-6 still pending.

[Bug fortran/72832] [6/7 Regression] [OOP] ALLOCATE with SOURCE fails to allocate requested dimensions

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

vehre at gcc dot gnu.org changed:

   What|Removed |Added

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

--- Comment #11 from vehre at gcc dot gnu.org ---
Closed due to no further complains.

[Bug fortran/72832] [6/7 Regression] [OOP] ALLOCATE with SOURCE fails to allocate requested dimensions

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

--- Comment #10 from vehre at gcc dot gnu.org ---
Waiting one week before backporting to gcc-6.

[Bug fortran/72832] [6/7 Regression] [OOP] ALLOCATE with SOURCE fails to allocate requested dimensions

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

--- Comment #9 from vehre at gcc dot gnu.org ---
Author: vehre
Date: Thu Oct 13 08:51:21 2016
New Revision: 241088

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

2016-09-01  Andre Vehreschild  

PR fortran/72832
* trans-expr.c (gfc_copy_class_to_class): Add generation of
runtime array bounds check.
* trans-intrinsic.c (gfc_conv_intrinsic_size): Add a crutch to
get the descriptor of a function returning a class object.
* trans-stmt.c (gfc_trans_allocate): Use the array spec on the
array to allocate instead of the array spec from source=.

gcc/testsuite/ChangeLog:

2016-09-01  Andre Vehreschild  

PR fortran/72832
* gfortran.dg/allocate_with_source_22.f03: New test.
* gfortran.dg/allocate_with_source_23.f03: New test.  Expected to
fail.



Added:
trunk/gcc/testsuite/gfortran.dg/allocate_with_source_22.f03
trunk/gcc/testsuite/gfortran.dg/allocate_with_source_23.f03
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/trans-expr.c
trunk/gcc/fortran/trans-intrinsic.c
trunk/gcc/fortran/trans-stmt.c
trunk/gcc/testsuite/ChangeLog

[Bug fortran/72832] [6/7 Regression] [OOP] ALLOCATE with SOURCE fails to allocate requested dimensions

2016-09-11 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72832

Andrew Pinski  changed:

   What|Removed |Added

   Target Milestone|--- |6.3

[Bug fortran/72832] [6/7 Regression] [OOP] ALLOCATE with SOURCE fails to allocate requested dimensions

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

--- Comment #8 from vehre at gcc dot gnu.org ---
Patch available at:

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

Awaiting comments/review.

[Bug fortran/72832] [6/7 Regression] [OOP] ALLOCATE with SOURCE fails to allocate requested dimensions

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

vehre at gcc dot gnu.org changed:

   What|Removed |Added

   Priority|P3  |P4

[Bug fortran/72832] [6/7 Regression] [OOP] ALLOCATE with SOURCE fails to allocate requested dimensions

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

vehre at gcc dot gnu.org changed:

   What|Removed |Added

   Priority|P4  |P3
   Assignee|unassigned at gcc dot gnu.org  |vehre at gcc dot gnu.org

[Bug fortran/72832] [6/7 Regression] [OOP] ALLOCATE with SOURCE fails to allocate requested dimensions

2016-08-10 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72832

--- Comment #7 from Dominique d'Humieres  ---
Likely caused by r229294 (PRs 67044 and 66927).

[Bug fortran/72832] [6/7 Regression] [OOP] ALLOCATE with SOURCE fails to allocate requested dimensions

2016-08-10 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72832

Dominique d'Humieres  changed:

   What|Removed |Added

   Priority|P3  |P4
  Known to work||5.4.0
Summary|[OOP] ALLOCATE with SOURCE  |[6/7 Regression] [OOP]
   |fails to allocate requested |ALLOCATE with SOURCE fails
   |dimensions  |to allocate requested
   ||dimensions
  Known to fail||6.1.0, 7.0

--- Comment #6 from Dominique d'Humieres  ---
BTW this is a regression. Compiling the code with 5.4.0 gives at runtime the
output

   2
   4

if compiled without -fcheck=bounds and

   2
At line 11 of file pr72832.f90
Fortran runtime error: Array bound mismatch for dimension 1 of array 'b' (4/2)

with it.

> Just out of interest: what is the recommended way to allocate a class(t)
> variable of the same type as a but different size?

Not 100% sure, but may be you can use a scalar (it does seem to work for me).