public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/63553] New: [OOP] Wrong code when assigning a CLASS to a TYPE
@ 2014-10-16 5:12 burnus at gcc dot gnu.org
2014-10-16 10:06 ` [Bug fortran/63553] " dominiq at lps dot ens.fr
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: burnus at gcc dot gnu.org @ 2014-10-16 5:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63553
Bug ID: 63553
Summary: [OOP] Wrong code when assigning a CLASS to a TYPE
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: burnus at gcc dot gnu.org
>From https://gcc.gnu.org/ml/fortran/2014-10/msg00072.html
Gives with Cray's ftn:
tm = cm 2*1
but with gfortran 5 the wrong:
tm = cm 19967872 1
program toto
implicit none
type mother
integer :: i
end type mother
type,extends(mother) :: child
end type child
type(mother) :: tm
type(child) :: tc
class(mother),allocatable :: cm,cm2
class(child),allocatable :: cc
allocate(cm,cc)
tc%i=0
cc%i=2
tm%i=2
cm%i=1
tm=cm
print *,'tm = cm',tm%i,cm%i
end program
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/63553] [OOP] Wrong code when assigning a CLASS to a TYPE
2014-10-16 5:12 [Bug fortran/63553] New: [OOP] Wrong code when assigning a CLASS to a TYPE burnus at gcc dot gnu.org
@ 2014-10-16 10:06 ` dominiq at lps dot ens.fr
2014-10-16 14:01 ` patnel97269-gfortran at yahoo dot fr
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: dominiq at lps dot ens.fr @ 2014-10-16 10:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63553
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-10-16
Ever confirmed|0 |1
--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Confirmed on 4.9.1 up to trunk (5.0). 4.8.3 gives the error
pr63553.f90:21.3:
tm=cm
1
Error: Can't convert CLASS(mother) to TYPE(mother) at (1)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/63553] [OOP] Wrong code when assigning a CLASS to a TYPE
2014-10-16 5:12 [Bug fortran/63553] New: [OOP] Wrong code when assigning a CLASS to a TYPE burnus at gcc dot gnu.org
2014-10-16 10:06 ` [Bug fortran/63553] " dominiq at lps dot ens.fr
@ 2014-10-16 14:01 ` patnel97269-gfortran at yahoo dot fr
2014-10-17 5:03 ` paul.richard.thomas at gmail dot com
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: patnel97269-gfortran at yahoo dot fr @ 2014-10-16 14:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63553
patnel97269-gfortran at yahoo dot fr changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |patnel97269-gfortran@yahoo.
| |fr
--- Comment #2 from patnel97269-gfortran at yahoo dot fr ---
As I wrote here https://gcc.gnu.org/ml/fortran/2014-10/msg00079.html,
I think this case is also related :
program toto
implicit none
type mother
integer :: i
end type mother
type,extends(mother) :: child
end type child
type(mother) :: tm
type(child) :: tc
class(mother),allocatable :: cm,cm2
class(child),allocatable :: cc
allocate(cm)
allocate(child::cm2)
cm%i=10
select type (cm2)
type is (child)
cm2%mother=cm
end select
print *,'class cm2 is type tm',extends_type_of(cm2,tm)
print *,'class cm2 is class cm',extends_type_of(cm2,cm)
print *,'class cm2 is type tc',extends_type_of(cm2,tc)
print *,'class cm2 is class cc',extends_type_of(cm2,cc)
print *,'cm2=cm', cm%i,cm2%i
end program
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/63553] [OOP] Wrong code when assigning a CLASS to a TYPE
2014-10-16 5:12 [Bug fortran/63553] New: [OOP] Wrong code when assigning a CLASS to a TYPE burnus at gcc dot gnu.org
2014-10-16 10:06 ` [Bug fortran/63553] " dominiq at lps dot ens.fr
2014-10-16 14:01 ` patnel97269-gfortran at yahoo dot fr
@ 2014-10-17 5:03 ` paul.richard.thomas at gmail dot com
2014-10-18 14:36 ` pault at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: paul.richard.thomas at gmail dot com @ 2014-10-17 5:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63553
paul.richard.thomas at gmail dot com <paul.richard.thomas at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |paul.richard.thomas at gmail dot c
| |om
--- Comment #3 from paul.richard.thomas at gmail dot com <paul.richard.thomas at gmail dot com> ---
Created attachment 33742
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33742&action=edit
patch
This fixes both testcases but causes a few trivial regressions:
class_array_15.f03
data_constraints_4.f90
data_constraints_6.f90
The fix is applied in the wrong place and the above regressions are easily
fixed.
It will be done tonight!
Paul
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/63553] [OOP] Wrong code when assigning a CLASS to a TYPE
2014-10-16 5:12 [Bug fortran/63553] New: [OOP] Wrong code when assigning a CLASS to a TYPE burnus at gcc dot gnu.org
` (2 preceding siblings ...)
2014-10-17 5:03 ` paul.richard.thomas at gmail dot com
@ 2014-10-18 14:36 ` pault at gcc dot gnu.org
2014-10-20 16:13 ` patnel97269-gfortran at yahoo dot fr
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pault at gcc dot gnu.org @ 2014-10-18 14:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63553
--- Comment #4 from Paul Thomas <pault at gcc dot gnu.org> ---
Author: pault
Date: Sat Oct 18 14:35:51 2014
New Revision: 216427
URL: https://gcc.gnu.org/viewcvs?rev=216427&root=gcc&view=rev
Log:
2014-10-18 Paul Thomas <pault@gcc.gnu.org>
PR fortran/63553
* resolve.c (resolve_ordinary_assign): Add data component to
rvalue expression for class to type assignment.
2014-10-18 Paul Thomas <pault@gcc.gnu.org>
PR fortran/63553
* gfortran.dg/class_to_type_3.f03 : New test
Added:
trunk/gcc/testsuite/gfortran.dg/class_to_type_3.f03
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/resolve.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/63553] [OOP] Wrong code when assigning a CLASS to a TYPE
2014-10-16 5:12 [Bug fortran/63553] New: [OOP] Wrong code when assigning a CLASS to a TYPE burnus at gcc dot gnu.org
` (3 preceding siblings ...)
2014-10-18 14:36 ` pault at gcc dot gnu.org
@ 2014-10-20 16:13 ` patnel97269-gfortran at yahoo dot fr
2015-02-11 17:25 ` dominiq at lps dot ens.fr
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: patnel97269-gfortran at yahoo dot fr @ 2014-10-20 16:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63553
--- Comment #5 from patnel97269-gfortran at yahoo dot fr ---
Thanks for the patch.
Another similar case, this time the type contains an allocatable field,
produces a internal compiler error (without applying the patch) :
internal compiler error: in fold_convert_loc, at fold-const.c:2112
program toto
implicit none
type mother
integer :: i
double precision,dimension(:),allocatable :: values
end type mother
class(mother),allocatable :: cm,cm2
allocate(cm)
allocate(cm%values(10))
cm%i=3
cm%values=80d0
allocate(cm2)
select type(cm2)
type is (mother)
cm2=cm
end select
print *,cm2%i,cm2%values
end program
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/63553] [OOP] Wrong code when assigning a CLASS to a TYPE
2014-10-16 5:12 [Bug fortran/63553] New: [OOP] Wrong code when assigning a CLASS to a TYPE burnus at gcc dot gnu.org
` (4 preceding siblings ...)
2014-10-20 16:13 ` patnel97269-gfortran at yahoo dot fr
@ 2015-02-11 17:25 ` dominiq at lps dot ens.fr
2015-02-11 20:05 ` paul.richard.thomas at gmail dot com
2015-02-11 21:10 ` dominiq at lps dot ens.fr
7 siblings, 0 replies; 9+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-02-11 17:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63553
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |WAITING
--- Comment #6 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
AFAICT all the tests in this PR compile now without any problem. May I close it
as FIXED?
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/63553] [OOP] Wrong code when assigning a CLASS to a TYPE
2014-10-16 5:12 [Bug fortran/63553] New: [OOP] Wrong code when assigning a CLASS to a TYPE burnus at gcc dot gnu.org
` (5 preceding siblings ...)
2015-02-11 17:25 ` dominiq at lps dot ens.fr
@ 2015-02-11 20:05 ` paul.richard.thomas at gmail dot com
2015-02-11 21:10 ` dominiq at lps dot ens.fr
7 siblings, 0 replies; 9+ messages in thread
From: paul.richard.thomas at gmail dot com @ 2015-02-11 20:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63553
--- Comment #7 from paul.richard.thomas at gmail dot com <paul.richard.thomas at gmail dot com> ---
For sure. Please do.
Thanks
Paul
On 11 February 2015 at 18:25, dominiq at lps dot ens.fr
<gcc-bugzilla@gcc.gnu.org> wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63553
>
> Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
>
> What |Removed |Added
> ----------------------------------------------------------------------------
> Status|NEW |WAITING
>
> --- Comment #6 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> AFAICT all the tests in this PR compile now without any problem. May I close it
> as FIXED?
>
> --
> 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] 9+ messages in thread
* [Bug fortran/63553] [OOP] Wrong code when assigning a CLASS to a TYPE
2014-10-16 5:12 [Bug fortran/63553] New: [OOP] Wrong code when assigning a CLASS to a TYPE burnus at gcc dot gnu.org
` (6 preceding siblings ...)
2015-02-11 20:05 ` paul.richard.thomas at gmail dot com
@ 2015-02-11 21:10 ` dominiq at lps dot ens.fr
7 siblings, 0 replies; 9+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-02-11 21:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63553
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |RESOLVED
Resolution|--- |FIXED
--- Comment #8 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> For sure. Please do.
Done!
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2015-02-11 21:10 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-16 5:12 [Bug fortran/63553] New: [OOP] Wrong code when assigning a CLASS to a TYPE burnus at gcc dot gnu.org
2014-10-16 10:06 ` [Bug fortran/63553] " dominiq at lps dot ens.fr
2014-10-16 14:01 ` patnel97269-gfortran at yahoo dot fr
2014-10-17 5:03 ` paul.richard.thomas at gmail dot com
2014-10-18 14:36 ` pault at gcc dot gnu.org
2014-10-20 16:13 ` patnel97269-gfortran at yahoo dot fr
2015-02-11 17:25 ` dominiq at lps dot ens.fr
2015-02-11 20:05 ` paul.richard.thomas at gmail dot com
2015-02-11 21:10 ` 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).