diff mbox

[V4,00/21] Fortran dynamic array support

Message ID 20160912210453.GA32414@host1.jankratochvil.net
State New
Headers show

Commit Message

Jan Kratochvil Sept. 12, 2016, 9:04 p.m. UTC
On Wed, 07 Sep 2016 12:29:06 +0200, Bernhard Heckel wrote:
> I just recreated my two user branches.

I see a regression against former Intel VLA patchset for the attached testcase.

gdb_test "p c40pt(2)" " = '1-hello.*"
p c40pt(2)^M
$2 = '\001\000\000\000\061-hello', ' ' <repeats 29 times>^M
(gdb) FAIL: gdb.fortran/dwarf-stride.exp: p c40pt(2)


Thanks,
Jan

Comments

Heckel, Bernhard Sept. 14, 2016, 7:24 a.m. UTC | #1
On 12/09/2016 23:04, Jan Kratochvil wrote:
> On Wed, 07 Sep 2016 12:29:06 +0200, Bernhard Heckel wrote:
>> I just recreated my two user branches.
> I see a regression against former Intel VLA patchset for the attached testcase.
>
> gdb_test "p c40pt(2)" " = '1-hello.*"
> p c40pt(2)^M
> $2 = '\001\000\000\000\061-hello', ' ' <repeats 29 times>^M
> (gdb) FAIL: gdb.fortran/dwarf-stride.exp: p c40pt(2)
>
>
> Thanks,
> Jan
Hi Jan,

I tested with GCC 4.8.3 and IFORT 17.0.0. Both passes.

With Fedora24, GCC 6.1.1 I see the same results as you. Investigation is 
showing that
GCC 6.1.1 doesn't provide the stride information (DWARF) which results 
in incorrect offsets.

Are you going to file a bug for GCC?


BTW: Nice testcase
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
Jan Kratochvil Sept. 14, 2016, 12:52 p.m. UTC | #2
On Wed, 14 Sep 2016 09:24:15 +0200, Bernhard Heckel wrote:
> With Fedora24, GCC 6.1.1 I see the same results as you. Investigation is
> showing that
> GCC 6.1.1 doesn't provide the stride information (DWARF) which results in
> incorrect offsets.
> 
> Are you going to file a bug for GCC?

Thanks for the investigation, sorry I did not verify that myself.

I have filed it as:
	https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77589


Thanks,
Jan
diff mbox

Patch

diff --git a/gdb/testsuite/gdb.fortran/dwarf-stride.exp b/gdb/testsuite/gdb.fortran/dwarf-stride.exp
new file mode 100644
index 0000000..d7b8bea
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/dwarf-stride.exp
@@ -0,0 +1,42 @@ 
+# Copyright 2009 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
+
+# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>.
+
+# This file is part of the gdb testsuite.  Array element stride must not be
+# specified in the number of elements but in a number of bytes instead.
+# Original problem:
+# (gdb) p c40pt(1)
+# $1 = '0-hello', ' ' <repeats 33 times>
+# (gdb) p c40pt(2)
+# warning: Fortran array stride not divisible by the element size
+
+set testfile dwarf-stride
+set srcfile ${testfile}.f90
+
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug f90}] } {
+    return -1
+}
+
+if ![runto MAIN__] then {
+    perror "couldn't run to breakpoint MAIN__"
+    continue
+}
+
+gdb_breakpoint [gdb_get_line_number "break-here"]
+gdb_continue_to_breakpoint "break-here" ".*break-here.*"
+gdb_test "p c40pt(1)" " = '0-hello.*"
+gdb_test "p c40pt(2)" " = '1-hello.*"
diff --git a/gdb/testsuite/gdb.fortran/dwarf-stride.f90 b/gdb/testsuite/gdb.fortran/dwarf-stride.f90
new file mode 100644
index 0000000..e492b3a
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/dwarf-stride.f90
@@ -0,0 +1,40 @@ 
+! Copyright 2009 Free Software Foundation, Inc.
+!
+! This program is free software; you can redistribute it and/or modify
+! it under the terms of the GNU General Public License as published by
+! the Free Software Foundation; either version 2 of the License, or
+! (at your option) any later version.
+!
+! This program is distributed in the hope that it will be useful,
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+! GNU General Public License for more details.
+!
+! You should have received a copy of the GNU General Public License
+! along with this program; if not, write to the Free Software
+! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+!
+! File written by Alan Matsuoka.
+
+program repro
+
+  type small_stride
+     character*40 long_string
+     integer      small_pad
+  end type small_stride
+
+  type(small_stride), dimension (20), target :: unpleasant
+  character*40, pointer, dimension(:):: c40pt
+
+  integer i
+
+  do i = 0,19
+     unpleasant(i+1)%small_pad = i+1
+     unpleasant(i+1)%long_string = char (ichar('0') + i) // '-hello'
+  end do
+
+  c40pt => unpleasant%long_string
+
+  print *, c40pt  ! break-here
+
+end program repro