public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/49961] New: type bounded function can not return a pointer of a array
@ 2011-08-03 13:02 quaintchewster at gmail dot com
2011-08-03 13:18 ` [Bug fortran/49961] " dominiq at lps dot ens.fr
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: quaintchewster at gmail dot com @ 2011-08-03 13:02 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49961
Summary: type bounded function can not return a pointer of a
array
Product: gcc
Version: 4.5.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: quaintchewster@gmail.com
!------------------- code -------------------------
module aa
type bb
integer,pointer,dimension(:) :: cc
integer,pointer :: dd
contains
procedure :: getcc
procedure :: getdd
end type
contains
function getcc(this) result(cc)
class(bb) :: this
integer,pointer,dimension(:) :: cc
cc => this%cc
end function
function getdd(this) result(dd)
class(bb) :: this
integer,pointer :: dd
dd => this%dd
end function
end module
program main
use aa
implicit none
type(bb) :: b1
integer,pointer,dimension(:) :: p1
integer,pointer :: p2
allocate(b1%cc(10),b1%dd)
b1%cc = 10
b1%dd = 5
p1 => b1%getcc() ! Line 34, HERE !!
write(*,*) 'p1 ',p1(1)
p2 => b1%getdd()
write(*,*) 'p2 ',p2
end
!------------------- code -------------------------
2 compile command line and info
$ gfortran -v -save-temps test_point_arg02.f95
Driving: gfortran -v -save-temps test_point_arg02.f95 -lgfortran -lm
-shared-libgcc
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
4.5.2-8ubuntu4' --with-bugurl=file:///usr/share/doc/gcc-4.5/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.5 --enable-shared --enable-multiarch
--with-multiarch-defaults=x86_64-linux-gnu --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib/x86_64-linux-gnu
--without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.5 --libdir=/usr/lib/x86_64-linux-gnu
--enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-plugin --enable-gold --enable-ld=default
--with-plugin-ld=ld.gold --enable-objc-gc --disable-werror --with-arch-32=i686
--with-tune=generic --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4)
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-shared-libgcc' '-mtune=generic'
'-march=x86-64'
/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/f951 test_point_arg02.f95
-quiet -dumpbase test_point_arg02.f95 -mtune=generic -march=x86-64 -auxbase
test_point_arg02 -version -fintrinsic-modules-path
/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/finclude -o
test_point_arg02.s
GNU Fortran (Ubuntu/Linaro 4.5.2-8ubuntu4) version 4.5.2 (x86_64-linux-gnu)
compiled by GNU C version 4.5.2, GMP version 4.3.2, MPFR version 3.0.0-p8,
MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU Fortran (Ubuntu/Linaro 4.5.2-8ubuntu4) version 4.5.2 (x86_64-linux-gnu)
compiled by GNU C version 4.5.2, GMP version 4.3.2, MPFR version 3.0.0-p8,
MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
test_point_arg02.f95: In function ‘MAIN__’:
test_point_arg02.f95:34:0: internal compiler error: in gfc_conv_variable, at
fortran/trans-expr.c:551
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.5/README.Bugs> for instructions.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/49961] type bounded function can not return a pointer of a array
2011-08-03 13:02 [Bug fortran/49961] New: type bounded function can not return a pointer of a array quaintchewster at gmail dot com
@ 2011-08-03 13:18 ` dominiq at lps dot ens.fr
2011-08-03 15:21 ` burnus at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: dominiq at lps dot ens.fr @ 2011-08-03 13:18 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49961
--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2011-08-03 13:17:42 UTC ---
With gfortran 4.6.1 and trunk, the code compiles and gives at run time
p1 10
p2 5
but I get the ICE with 4.5.3. So the bug has been fixed, but not backported to
4.5.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/49961] type bounded function can not return a pointer of a array
2011-08-03 13:02 [Bug fortran/49961] New: type bounded function can not return a pointer of a array quaintchewster at gmail dot com
2011-08-03 13:18 ` [Bug fortran/49961] " dominiq at lps dot ens.fr
@ 2011-08-03 15:21 ` burnus at gcc dot gnu.org
2011-08-04 17:25 ` [Bug fortran/49961] [OOP] type-bound " janus at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-08-03 15:21 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49961
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |burnus at gcc dot gnu.org
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-08-03 15:21:32 UTC ---
Thanks for the report. As it is not a regression, I don't think the fix will be
back-ported. Fortunately, it seems to be fixed in 4.6.x and in the current
developer version 4.7.
For using OOP programming features such as type-bound procedures and
polymorphism, it is best to use GCC 4.6 or 4.7. See http://gcc.gnu.org/wiki/OOP
for an overview of fixed and still unfixed OOP bugs by GCC version.
Maybe Ubuntu also has a newer version, which can be installed besides (or
instead of) the system GCC. If not, Debian has GCC 4.6.1 in Testing/Unstable,
cf.
http://packages.debian.org/search?keywords=gfortran&searchon=names&suite=all§ion=all
Additionally, unofficial nightly builds of GCC are available from
http://gcc.gnu.org/wiki/GFortranBinaries
Those can also be installed without root permissions in some directory.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/49961] [OOP] type-bound function can not return a pointer of a array
2011-08-03 13:02 [Bug fortran/49961] New: type bounded function can not return a pointer of a array quaintchewster at gmail dot com
2011-08-03 13:18 ` [Bug fortran/49961] " dominiq at lps dot ens.fr
2011-08-03 15:21 ` burnus at gcc dot gnu.org
@ 2011-08-04 17:25 ` janus at gcc dot gnu.org
2011-08-04 17:46 ` janus at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: janus at gcc dot gnu.org @ 2011-08-04 17:25 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49961
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ice-on-valid-code
CC| |janus at gcc dot gnu.org
Summary|type bounded function can |[OOP] type-bound function
|not return a pointer of a |can not return a pointer of
|array |a array
--- Comment #3 from janus at gcc dot gnu.org 2011-08-04 17:24:29 UTC ---
Here's maximally reduced test case:
module aa
type bb
end type
contains
function getcc(this) result(cc)
class(bb) :: this
integer,dimension(2) :: cc
end function
end module
use aa
type(bb) :: b1
print *,getcc(b1)
end
Apparently this PR is a duplicate of PR42051/PR43896 and has supposedly been
fixed by r160622:
http://gcc.gnu.org/viewcvs?view=revision&revision=160622
The patch looks very simple and it may be feasible to backport it to 4.5.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/49961] [OOP] type-bound function can not return a pointer of a array
2011-08-03 13:02 [Bug fortran/49961] New: type bounded function can not return a pointer of a array quaintchewster at gmail dot com
` (2 preceding siblings ...)
2011-08-04 17:25 ` [Bug fortran/49961] [OOP] type-bound " janus at gcc dot gnu.org
@ 2011-08-04 17:46 ` janus at gcc dot gnu.org
2011-08-11 3:45 ` quaintchewster at gmail dot com
2011-08-15 10:41 ` janus at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: janus at gcc dot gnu.org @ 2011-08-04 17:46 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49961
--- Comment #4 from janus at gcc dot gnu.org 2011-08-04 17:46:35 UTC ---
(In reply to comment #3)
> http://gcc.gnu.org/viewcvs?view=revision&revision=160622
>
> The patch looks very simple and it may be feasible to backport it to 4.5.
I just checked: It's indeed easy to backport this, and it will also make the
original test case run and produce correct results.
Dear bug reporter: Would it help you if we backport this fix to the 4.5 branch,
so that it becomes part of release 4.5.4, or is it possible for you to use
gfortran 4.6.x?
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/49961] [OOP] type-bound function can not return a pointer of a array
2011-08-03 13:02 [Bug fortran/49961] New: type bounded function can not return a pointer of a array quaintchewster at gmail dot com
` (3 preceding siblings ...)
2011-08-04 17:46 ` janus at gcc dot gnu.org
@ 2011-08-11 3:45 ` quaintchewster at gmail dot com
2011-08-15 10:41 ` janus at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: quaintchewster at gmail dot com @ 2011-08-11 3:45 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49961
--- Comment #5 from quaintchewster at gmail dot com 2011-08-11 03:45:09 UTC ---
Thank all of you !!
I will use 4.6 or 4.7
2011/8/5 janus at gcc dot gnu.org <gcc-bugzilla@gcc.gnu.org>:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49961
>
> --- Comment #4 from janus at gcc dot gnu.org 2011-08-04 17:46:35 UTC ---
> (In reply to comment #3)
>> http://gcc.gnu.org/viewcvs?view=revision&revision=160622
>>
>> The patch looks very simple and it may be feasible to backport it to 4.5.
>
> I just checked: It's indeed easy to backport this, and it will also make the
> original test case run and produce correct results.
>
> Dear bug reporter: Would it help you if we backport this fix to the 4.5 branch,
> so that it becomes part of release 4.5.4, or is it possible for you to use
> gfortran 4.6.x?
>
> --
> Configure bugmail: http://gcc.gnu.org/bugzilla/userprefs.cgi?tab=email
> ------- You are receiving this mail because: -------
> You reported the bug.
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/49961] [OOP] type-bound function can not return a pointer of a array
2011-08-03 13:02 [Bug fortran/49961] New: type bounded function can not return a pointer of a array quaintchewster at gmail dot com
` (4 preceding siblings ...)
2011-08-11 3:45 ` quaintchewster at gmail dot com
@ 2011-08-15 10:41 ` janus at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: janus at gcc dot gnu.org @ 2011-08-15 10:41 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49961
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
--- Comment #6 from janus at gcc dot gnu.org 2011-08-15 09:53:16 UTC ---
(In reply to comment #5)
> I will use 4.6 or 4.7
Great. Closing this one as fixed.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-08-15 9:53 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-03 13:02 [Bug fortran/49961] New: type bounded function can not return a pointer of a array quaintchewster at gmail dot com
2011-08-03 13:18 ` [Bug fortran/49961] " dominiq at lps dot ens.fr
2011-08-03 15:21 ` burnus at gcc dot gnu.org
2011-08-04 17:25 ` [Bug fortran/49961] [OOP] type-bound " janus at gcc dot gnu.org
2011-08-04 17:46 ` janus at gcc dot gnu.org
2011-08-11 3:45 ` quaintchewster at gmail dot com
2011-08-15 10:41 ` janus 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).