[Bug fortran/56691] [OOP] Allocatable array: wrong offset when passing to CLASS dummy
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56691 Paul Thomas changed: What|Removed |Added Status|NEW |RESOLVED CC||pault at gcc dot gnu.org Resolution|--- |FIXED --- Comment #12 from Paul Thomas --- Fixed on trunk. Thanks for the report, Marco. Paul
[Bug fortran/56691] [OOP] Allocatable array: wrong offset when passing to CLASS dummy
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56691 --- Comment #11 from Paul Thomas --- Author: pault Date: Sat Feb 10 18:16:14 2018 New Revision: 257550 URL: https://gcc.gnu.org/viewcvs?rev=257550&root=gcc&view=rev Log: 2018-02-10 Paul Thomas PR fortran/84141 PR fortran/84155 * trans-array.c (gfc_array_init_size): Revert the change made in revision 257356 setting the dtype. * trans-types.c (gfc_get_dtype): Do not use the cached dtype. Call gfc_get_dtype_rank_type every time. PR fortran/56691 * trans-array.c (gfc_conv_expr_descriptor): If the source array is a descriptor type, use its offset, removing the condition that is be a class expression. 2018-02-10 Paul Thomas PR fortran/56691 * gfortran.dg/type_to_class_4.f03: New test. Added: trunk/gcc/testsuite/gfortran.dg/type_to_class_4.f03 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/trans-array.c trunk/gcc/fortran/trans-types.c trunk/gcc/testsuite/ChangeLog
[Bug fortran/56691] [OOP] Allocatable array: wrong offset when passing to CLASS dummy
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56691 --- Comment #10 from Dominique d'Humieres --- The test in comment 3 has likely been fixed by revision r222361 (pr60322).
[Bug fortran/56691] [OOP] Allocatable array: wrong offset when passing to CLASS dummy
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56691 Dominique d'Humieres changed: What|Removed |Added CC||vladimir.fuka at gmail dot com --- Comment #9 from Dominique d'Humieres --- *** Bug 84074 has been marked as a duplicate of this bug. ***
[Bug fortran/56691] [OOP] Allocatable array: wrong offset when passing to CLASS dummy
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56691 janus at gcc dot gnu.org changed: What|Removed |Added Target Milestone|7.2 |8.0
[Bug fortran/56691] [OOP] Allocatable array: wrong offset when passing to CLASS dummy
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56691 Jakub Jelinek changed: What|Removed |Added Target Milestone|7.0 |7.2 --- Comment #8 from Jakub Jelinek --- GCC 7.1 has been released.
[Bug fortran/56691] [OOP] Allocatable array: wrong offset when passing to CLASS dummy
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56691 janus at gcc dot gnu.org changed: What|Removed |Added Known to work|6.2.0, 7.0 | Target Milestone|6.2 |7.0 Known to fail||6.2.0 --- Comment #7 from janus at gcc dot gnu.org --- (In reply to Dominique d'Humieres from comment #6) > The test in comment 0 is still giving an off by 1 result (7.0 at r243758): Right, I missed that. Sorry for closing too early. Reduced test case for the remaining failure: module m2 implicit none type :: t_stv real :: f1 end type contains subroutine lcb(y) class(t_stv), intent(in) :: y(:) integer :: k write(*,*) 'Inside LCB: size is ',size(y) do k=1,size(y) write(*,*) 'f1: ', k, y(k)%f1 enddo end subroutine end module program test use m2 implicit none type(t_stv), allocatable :: work(:) allocate(work(4)) work(:)%f1 = (/ 1.,2.,3.,4./) write(*,*) 'Call with whole array: works fine' call lcb(work) write(*,*) 'Call with array slice: off by 1' call lcb(work(:4)) end program Prints: Call with whole array: works fine Inside LCB: size is4 f1:1 1. f1:2 2. f1:3 3. f1:4 4. Call with array slice: off by 1 Inside LCB: size is4 f1:1 2. f1:2 3. f1:3 4. f1:4 0.
[Bug fortran/56691] [OOP] Allocatable array: wrong offset when passing to CLASS dummy
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56691 Dominique d'Humieres changed: What|Removed |Added Status|RESOLVED|NEW Resolution|FIXED |--- --- Comment #6 from Dominique d'Humieres --- The test in comment 0 is still giving an off by 1 result (7.0 at r243758): Call with array slice: off by 1 Inside LCB: size is4 Show: f12. Show: f13. Show: f14. Show: f10.
[Bug fortran/56691] [OOP] Allocatable array: wrong offset when passing to CLASS dummy
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56691 janus at gcc dot gnu.org changed: What|Removed |Added Status|NEW |RESOLVED Known to work||6.2.0, 7.0 Resolution|--- |FIXED Target Milestone|--- |6.2 Known to fail||4.9.0, 5.4.1 --- Comment #5 from janus at gcc dot gnu.org --- (In reply to physiker from comment #4) > When I use gfortran version 7 to compile the code listed in comment 3, > executing the resulting binary yields the following output: > > ./pr56691 > Values in work are: >1. 2. 3. 4. > Call with whole array: works fine > Inside LCB: size is4 >1. 2. 3. 4. > Call with array slice: off by 1 > Inside LCB: size is4 >1. 2. 3. 4. > > This is the expected result. The bug might be fixed. Confirmed. In fact I see it working already in 6.2. It can definitely be closed.
[Bug fortran/56691] [OOP] Allocatable array: wrong offset when passing to CLASS dummy
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56691 physiker at toast2 dot net changed: What|Removed |Added CC||physiker at toast2 dot net --- Comment #4 from physiker at toast2 dot net --- When I use gfortran version 7 to compile the code listed in comment 3, executing the resulting binary yields the following output: ./pr56691 Values in work are: 1. 2. 3. 4. Call with whole array: works fine Inside LCB: size is4 1. 2. 3. 4. Call with array slice: off by 1 Inside LCB: size is4 1. 2. 3. 4. This is the expected result. The bug might be fixed. LANG=C gfortran-7 -o pr56691 pr56691.f90 -v -W -Wall Driving: gfortran-7 -o pr56691 pr56691.f90 -v -W -Wall -mmacosx-version-min=10.11.6 -asm_macosx_version_min=10.11 -l gfortran -shared-libgcc Using built-in specs. COLLECT_GCC=gfortran-7 COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/lto-wrapper Target: x86_64-apple-darwin15.6.0 Configured with: ../gcc/configure --enable-languages=c,c++,fortran,lto --with-gmp=/sw --with-libiconv-prefix=/sw --with-isl=/sw --with-mpc=/sw --with-system-zlib --program-suffix=-7 Thread model: posix gcc version 7.0.0 20161215 (experimental) [trunk revision 243680] (GCC) COLLECT_GCC_OPTIONS='-o' 'pr56691' '-v' '-Wextra' '-Wall' '-mmacosx-version-min=10.11.6' '-asm_macosx_version_min=10.11' '-shared-libgcc' '-mtune=core2' /usr/local/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/f951 pr56691.f90 -fPIC -quiet -dumpbase pr56691.f90 -mmacosx-version-min=10.11.6 -mtune=core2 -auxbase pr56691 -Wextra -Wall -version -fintrinsic-modules-path /usr/local/lib/gcc/x86_64-apple-darwin15.6.0/7.0.0/finclude -o /var/folders/97/4qnhjhtn25s86s9hkz0h37_mgn/T//ccv54gNH.s GNU Fortran (GCC) version 7.0.0 20161215 (experimental) [trunk revision 243680] (x86_64-apple-darwin15.6.0) compiled by GNU C version 7.0.0 20161215 (experimental) [trunk revision 243680], GMP version 6.1.0, MPFR version 3.1.4, MPC version 1.0.3, isl version 0.15 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 GNU Fortran2008 (GCC) version 7.0.0 20161215 (experimental) [trunk revision 243680] (x86_64-apple-darwin15.6.0) compiled by GNU C version 7.0.0 20161215 (experimental) [trunk revision 243680], GMP version 6.1.0, MPFR version 3.1.4, MPC version 1.0.3, isl version 0.15 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 COLLECT_GCC_OPTIONS='-o' 'pr56691' '-v' '-Wextra' '-Wall' '-mmacosx-version-min=10.11.6' '-shared-libgcc' '-mtune=core2' as -arch x86_64 -v -force_cpusubtype_ALL -mmacosx-version-min=10.11 -o /var/folders/97/4qnhjhtn25s86s9hkz0h37_mgn/T//ccSNEf1F.o /var/folders/97/4qnhjhtn25s86s9hkz0h37_mgn/T//ccv54gNH.s Apple LLVM version 8.0.0 (clang-800.0.42.1) Target: x86_64-apple-darwin15.6.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin "/Library/Developer/CommandLineTools/usr/bin/clang" -cc1as -triple x86_64-apple-macosx10.11.0 -filetype obj -main-file-name ccv54gNH.s -target-cpu core2 -fdebug-compilation-dir /Users/Peter/Devel/f90 -dwarf-debug-producer Apple LLVM version 8.0.0 (clang-800.0.42.1) -dwarf-version=2 -mrelocation-model pic -o /var/folders/97/4qnhjhtn25s86s9hkz0h37_mgn/T//ccSNEf1F.o /var/folders/97/4qnhjhtn25s86s9hkz0h37_mgn/T//ccv54gNH.s Reading specs from /usr/local/lib/gcc/x86_64-apple-darwin15.6.0/7.0.0/../../../libgfortran.spec rename spec lib to liborig COLLECT_GCC_OPTIONS='-o' 'pr56691' '-v' '-Wextra' '-Wall' '-mmacosx-version-min=10.11.6' '-shared-libgcc' '-mtune=core2' COMPILER_PATH=/usr/local/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/:/usr/local/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/:/usr/local/libexec/gcc/x86_64-apple-darwin15.6.0/:/usr/local/lib/gcc/x86_64-apple-darwin15.6.0/7.0.0/:/usr/local/lib/gcc/x86_64-apple-darwin15.6.0/ LIBRARY_PATH=/usr/local/lib/gcc/x86_64-apple-darwin15.6.0/7.0.0/:/usr/local/lib/gcc/x86_64-apple-darwin15.6.0/7.0.0/../../../ COLLECT_GCC_OPTIONS='-o' 'pr56691' '-v' '-Wextra' '-Wall' '-mmacosx-version-min=10.11.6' '-shared-libgcc' '-mtune=core2' /usr/local/libexec/gcc/x86_64-apple-darwin15.6.0/7.0.0/collect2 -dynamic -arch x86_64 -macosx_version_min 10.11.6 -weak_reference_mismatches non-weak -o pr56691 -L/usr/local/lib/gcc/x86_64-apple-darwin15.6.0/7.0.0 -L/usr/local/lib/gcc/x86_64-apple-darwin15.6.0/7.0.0/../../.. /var/folders/97/4qnhjhtn25s86s9hkz0h37_mgn/T//ccSNEf1F.o -lgfortran -no_compact_unwind -lSystem -lgcc_ext.10.5 -lgcc -lquadmath -lm -lgcc_ext.10.5 -lgcc -lSystem -v collect2 version 7.0.0 20161215 (experimental) [trunk revision 243680] /usr/bin/ld -dynamic -arch x86_64 -macosx_version_min 10.11.6 -weak_reference_mismatc
[Bug fortran/56691] [OOP] Allocatable array: wrong offset when passing to CLASS dummy
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56691 janus at gcc dot gnu.org changed: What|Removed |Added CC||janus at gcc dot gnu.org Version|fortran-dev |4.9.0 Summary|Allocatable array of|[OOP] Allocatable array: |extended type, wrong|wrong offset when passing |indexes after passing to a |to CLASS dummy |subroutine | --- Comment #3 from janus at gcc dot gnu.org 2013-03-23 13:10:41 UTC --- Reduced test case which shows that the problem is CLASS-specific: module m2 implicit none type :: t_stv real :: f1 end type contains subroutine lcb(y) class(t_stv), intent(in) :: y(:) write(*,*) 'Inside LCB: size is ',size(y) print *,y(1:size(y))%f1 end subroutine end module program test use m2 implicit none type(t_stv), allocatable :: work(:) allocate(work(4)) work(:)%f1 = (/ 1.,2.,3.,4./) write(*,*) 'Values in work are:' print *, work(1:4)%f1 write(*,*) 'Call with whole array: works fine' call lcb(work) write(*,*) 'Call with array slice: off by 1' call lcb(work(:4)) end program When making 'y' a TYPE instead of CLASS, the output is as expected.