Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Expand fortran array bounds sizes to LONGEST
@ 2012-08-21  9:56 Siddhesh Poyarekar
  2012-08-21 11:12 ` Siddhesh Poyarekar
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Siddhesh Poyarekar @ 2012-08-21  9:56 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1221 bytes --]

Hi,

Range bounds for a gdb type can have LONGEST values for low and high
bounds. Fortran range bounds functions however use only int. The larger
ranges don't compile by default on gcc, but it is possible to override
the check in the compiler by using -fno-range-check. As a result, this
check is necessary so that we don't print junk in case of an overflow.

Attached patch does this expansion and also includes a test case that
verifies that the problem is fixed. I have also verified on x86_64 that
this patch does not cause any regressions.

Regards,
Siddhesh

gdb/ChangeLog:

	* f-lang.h (f77_get_upperbound): Return LONGEST.
	(f77_get_lowerbound): Likewise.
	* f-typeprint.c (f_type_print_varspec_suffix): Expand
	UPPER_BOUND and LOWER_BOUND to LONGEST.  Use plongest to format
	print them.
	(f_type_print_base): Expand UPPER_BOUND to LONGEST.  Use
	plongest to format print it.
	* f-valprint.c (f77_get_lowerbound): Return LONGEST.
	(f77_get_upperbound): Likewise.
	(f77_get_dynamic_length_of_aggregate): Expand UPPER_BOUND,
	LOWER_BOUND to LONGEST.
	(f77_create_arrayprint_offset_tbl): Likewise.

testsuite/ChangeLog:

	* gdb.fortran/array-bounds.exp: New test case.
	* gdb.fortran/array-bounds.f: New test case.

[-- Attachment #2: f77-bounds.patch --]
[-- Type: text/x-patch, Size: 6084 bytes --]

diff --git a/gdb/f-lang.h b/gdb/f-lang.h
index d20a46f..46ea267 100644
--- a/gdb/f-lang.h
+++ b/gdb/f-lang.h
@@ -96,9 +96,9 @@ extern SAVED_F77_COMMON_PTR find_common_for_function (const char *,
 extern char *real_main_name;	/* Name of main function.  */
 extern int real_main_c_value;	/* C_value field of main function.  */
 
-extern int f77_get_upperbound (struct type *);
+extern LONGEST f77_get_upperbound (struct type *);
 
-extern int f77_get_lowerbound (struct type *);
+extern LONGEST f77_get_lowerbound (struct type *);
 
 extern void f77_get_dynamic_array_length (struct type *);
 
diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c
index c59e639..f6877fa 100644
--- a/gdb/f-typeprint.c
+++ b/gdb/f-typeprint.c
@@ -150,7 +150,7 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
 			     int show, int passed_a_ptr, int demangled_args,
 			     int arrayprint_recurse_level)
 {
-  int upper_bound, lower_bound;
+  LONGEST upper_bound, lower_bound;
 
   /* No static variables are permitted as an error call may occur during
      execution of this function.  */
@@ -177,7 +177,7 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
 
       lower_bound = f77_get_lowerbound (type);
       if (lower_bound != 1)	/* Not the default.  */
-	fprintf_filtered (stream, "%d:", lower_bound);
+	fprintf_filtered (stream, "%s:", plongest (lower_bound));
 
       /* Make sure that, if we have an assumed size array, we
          print out a warning and print the upperbound as '*'.  */
@@ -187,7 +187,7 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
       else
 	{
 	  upper_bound = f77_get_upperbound (type);
-	  fprintf_filtered (stream, "%d", upper_bound);
+	  fprintf_filtered (stream, "%s", plongest (upper_bound));
 	}
 
       if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_ARRAY)
@@ -255,7 +255,7 @@ void
 f_type_print_base (struct type *type, struct ui_file *stream, int show,
 		   int level)
 {
-  int upper_bound;
+  LONGEST upper_bound;
   int index;
 
   QUIT;
@@ -337,7 +337,7 @@ f_type_print_base (struct type *type, struct ui_file *stream, int show,
       else
 	{
 	  upper_bound = f77_get_upperbound (type);
-	  fprintf_filtered (stream, "character*%d", upper_bound);
+	  fprintf_filtered (stream, "character*%s", plongest (upper_bound));
 	}
       break;
 
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
index a422ac2..b4ce356 100644
--- a/gdb/f-valprint.c
+++ b/gdb/f-valprint.c
@@ -60,7 +60,7 @@ LONGEST f77_array_offset_tbl[MAX_FORTRAN_DIMS + 1][2];
 
 #define F77_DIM_OFFSET(n) (f77_array_offset_tbl[n][0])
 
-int
+LONGEST
 f77_get_lowerbound (struct type *type)
 {
   if (TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED (type))
@@ -69,7 +69,7 @@ f77_get_lowerbound (struct type *type)
   return TYPE_ARRAY_LOWER_BOUND_VALUE (type);
 }
 
-int
+LONGEST
 f77_get_upperbound (struct type *type)
 {
   if (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
@@ -90,8 +90,8 @@ f77_get_upperbound (struct type *type)
 static void
 f77_get_dynamic_length_of_aggregate (struct type *type)
 {
-  int upper_bound = -1;
-  int lower_bound = 1;
+  LONGEST upper_bound = -1;
+  LONGEST lower_bound = 1;
 
   /* Recursively go all the way down into a possibly multi-dimensional
      F77 array and get the bounds.  For simple arrays, this is pretty
@@ -126,7 +126,7 @@ f77_create_arrayprint_offset_tbl (struct type *type, struct ui_file *stream)
   struct type *tmp_type;
   LONGEST eltlen;
   int ndimen = 1;
-  int upper, lower;
+  LONGEST upper, lower;
 
   tmp_type = type;
 
diff --git a/gdb/testsuite/gdb.fortran/array-bounds.exp b/gdb/testsuite/gdb.fortran/array-bounds.exp
new file mode 100644
index 0000000..68873fe
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/array-bounds.exp
@@ -0,0 +1,35 @@
+# Copyright 2012 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 3 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, see <http://www.gnu.org/licenses/>.
+
+# This file is part of the gdb testsuite.  It contains test to ensure that
+# array bounds accept LONGEST.
+
+if { [skip_fortran_tests] } { return -1 }
+
+standard_testfile .f
+
+if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug additional_flags=-fno-range-check f90}]} {
+    print "compile failed"
+    return -1
+}
+
+if { ![runto MAIN__] } {
+    perror "Could not run to breakpoint `MAIN__'."
+    continue
+}
+
+gdb_test "print &foo" {.*\(4294967296:4294967297\).*}
+gdb_test "print &bar" {.*\(-4294967297:-4294967296\).*}
+
diff --git a/gdb/testsuite/gdb.fortran/array-bounds.f b/gdb/testsuite/gdb.fortran/array-bounds.f
new file mode 100644
index 0000000..a43184c
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/array-bounds.f
@@ -0,0 +1,21 @@
+c Copyright 2012 Free Software Foundation, Inc.
+
+c This program is free software; you can redistribute it and/or modify
+c it under the terms of the GNU General Public License as published by
+c the Free Software Foundation; either version 3 of the License, or
+c (at your option) any later version.
+c
+c This program is distributed in the hope that it will be useful,
+c but WITHOUT ANY WARRANTY; without even the implied warranty of
+c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+c GNU General Public License for more details.
+c
+c You should have received a copy of the GNU General Public License
+c along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+        dimension foo(4294967296:4294967297)
+        dimension bar(-4294967297:-4294967296)
+        foo=bar
+        stop
+        end
+

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Expand fortran array bounds sizes to LONGEST
  2012-08-21  9:56 [PATCH] Expand fortran array bounds sizes to LONGEST Siddhesh Poyarekar
@ 2012-08-21 11:12 ` Siddhesh Poyarekar
  2012-08-21 18:22   ` Tom Tromey
  2012-08-21 18:22 ` Tom Tromey
  2012-10-15 13:26 ` Jan Kratochvil
  2 siblings, 1 reply; 9+ messages in thread
From: Siddhesh Poyarekar @ 2012-08-21 11:12 UTC (permalink / raw)
  To: gdb-patches

On Tue, 21 Aug 2012 15:25:40 +0530, Siddhesh wrote:
> Range bounds for a gdb type can have LONGEST values for low and high
> bounds. Fortran range bounds functions however use only int. The
> larger ranges don't compile by default on gcc, but it is possible to
> override the check in the compiler by using -fno-range-check. As a
> result, this check is necessary so that we don't print junk in case
> of an overflow.

Sorry, I forgot to mention that this goes on top of the bitpos patch
since it needs some changes from the bitpos patch as well.

Regards,
Siddhesh


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Expand fortran array bounds sizes to LONGEST
  2012-08-21 18:22   ` Tom Tromey
@ 2012-08-21 18:10     ` Siddhesh Poyarekar
  2012-08-21 18:21       ` Tom Tromey
  0 siblings, 1 reply; 9+ messages in thread
From: Siddhesh Poyarekar @ 2012-08-21 18:10 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On Tue, 21 Aug 2012 10:53:46 -0600, Tom wrote:

> >>>>> "Siddhesh" == Siddhesh Poyarekar <siddhesh@redhat.com> writes:
> 
> Siddhesh> Sorry, I forgot to mention that this goes on top of the
> Siddhesh> bitpos patch since it needs some changes from the bitpos
> Siddhesh> patch as well.
> 
> What did it need?  It seemed independent to me.
> If it does need something then just wait until the rest goes in before
> committing it.

There are additional changes that were part of the bitpos patch, like
expansion of f77_array_offset_tbl, embedded_offset in
f77_print_array(_1) and resultant changes in f-lang.c and backwards
all the way to bitpos. I'll keep this in my stash to commit on top of
the bitpos changes.

Thanks,
Siddhesh


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Expand fortran array bounds sizes to LONGEST
  2012-08-21 18:10     ` Siddhesh Poyarekar
@ 2012-08-21 18:21       ` Tom Tromey
  0 siblings, 0 replies; 9+ messages in thread
From: Tom Tromey @ 2012-08-21 18:21 UTC (permalink / raw)
  To: Siddhesh Poyarekar; +Cc: gdb-patches

>>>>> "Siddhesh" == Siddhesh Poyarekar <siddhesh@redhat.com> writes:

Siddhesh> There are additional changes that were part of the bitpos patch, like
Siddhesh> expansion of f77_array_offset_tbl, embedded_offset in
Siddhesh> f77_print_array(_1) and resultant changes in f-lang.c and backwards
Siddhesh> all the way to bitpos.

Ok, I see.  Thanks.

Tom


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Expand fortran array bounds sizes to LONGEST
  2012-08-21  9:56 [PATCH] Expand fortran array bounds sizes to LONGEST Siddhesh Poyarekar
  2012-08-21 11:12 ` Siddhesh Poyarekar
@ 2012-08-21 18:22 ` Tom Tromey
  2012-10-15 13:26 ` Jan Kratochvil
  2 siblings, 0 replies; 9+ messages in thread
From: Tom Tromey @ 2012-08-21 18:22 UTC (permalink / raw)
  To: Siddhesh Poyarekar; +Cc: gdb-patches

>>>>> "Siddhesh" == Siddhesh Poyarekar <siddhesh@redhat.com> writes:

Siddhesh> gdb/ChangeLog:
Siddhesh> 	* f-lang.h (f77_get_upperbound): Return LONGEST.
Siddhesh> 	(f77_get_lowerbound): Likewise.
Siddhesh> 	* f-typeprint.c (f_type_print_varspec_suffix): Expand
Siddhesh> 	UPPER_BOUND and LOWER_BOUND to LONGEST.  Use plongest to format
Siddhesh> 	print them.
Siddhesh> 	(f_type_print_base): Expand UPPER_BOUND to LONGEST.  Use
Siddhesh> 	plongest to format print it.
Siddhesh> 	* f-valprint.c (f77_get_lowerbound): Return LONGEST.
Siddhesh> 	(f77_get_upperbound): Likewise.
Siddhesh> 	(f77_get_dynamic_length_of_aggregate): Expand UPPER_BOUND,
Siddhesh> 	LOWER_BOUND to LONGEST.
Siddhesh> 	(f77_create_arrayprint_offset_tbl): Likewise.

Siddhesh> testsuite/ChangeLog:

Siddhesh> 	* gdb.fortran/array-bounds.exp: New test case.
Siddhesh> 	* gdb.fortran/array-bounds.f: New test case.

Ok.  Thanks.

Tom


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Expand fortran array bounds sizes to LONGEST
  2012-08-21 11:12 ` Siddhesh Poyarekar
@ 2012-08-21 18:22   ` Tom Tromey
  2012-08-21 18:10     ` Siddhesh Poyarekar
  0 siblings, 1 reply; 9+ messages in thread
From: Tom Tromey @ 2012-08-21 18:22 UTC (permalink / raw)
  To: Siddhesh Poyarekar; +Cc: gdb-patches

>>>>> "Siddhesh" == Siddhesh Poyarekar <siddhesh@redhat.com> writes:

Siddhesh> Sorry, I forgot to mention that this goes on top of the bitpos patch
Siddhesh> since it needs some changes from the bitpos patch as well.

What did it need?  It seemed independent to me.
If it does need something then just wait until the rest goes in before
committing it.

Tom


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Expand fortran array bounds sizes to LONGEST
  2012-08-21  9:56 [PATCH] Expand fortran array bounds sizes to LONGEST Siddhesh Poyarekar
  2012-08-21 11:12 ` Siddhesh Poyarekar
  2012-08-21 18:22 ` Tom Tromey
@ 2012-10-15 13:26 ` Jan Kratochvil
  2012-10-15 18:56   ` Jan Kratochvil
  2 siblings, 1 reply; 9+ messages in thread
From: Jan Kratochvil @ 2012-10-15 13:26 UTC (permalink / raw)
  To: Siddhesh Poyarekar; +Cc: gdb-patches

Hi Siddhesh,

On Tue, 21 Aug 2012 11:55:40 +0200, Siddhesh Poyarekar wrote:
> Attached patch does this expansion and also includes a test case that
> verifies that the problem is fixed. I have also verified on x86_64 that
> this patch does not cause any regressions.
[...]
> 	* gdb.fortran/array-bounds.exp: New test case.
> 	* gdb.fortran/array-bounds.f: New test case.
[...]
> +        dimension foo(4294967296:4294967297)
> +        dimension bar(-4294967297:-4294967296)

Sergio has found it FAILS with 32-bit i386 target (even on x86_64 with -m32).

I have filed for it now:
	Invalid debug/ array bounds w/-fno-range-check and 32-bit target
	http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54934

It should be at least XFAILed for 32-bit targets.  If GCC accepts it as
a valid bug GDB should provide a hand-modified pre-compiled .S file for i386.

One should re-check the GCC Bug state before checking this GDB part it.


Thanks,
Jan


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Expand fortran array bounds sizes to LONGEST
  2012-10-15 13:26 ` Jan Kratochvil
@ 2012-10-15 18:56   ` Jan Kratochvil
  2012-10-21  7:44     ` Siddhesh Poyarekar
  0 siblings, 1 reply; 9+ messages in thread
From: Jan Kratochvil @ 2012-10-15 18:56 UTC (permalink / raw)
  To: Siddhesh Poyarekar; +Cc: gdb-patches, Sergio Durigan Junior

On Mon, 15 Oct 2012 15:25:55 +0200, Jan Kratochvil wrote:
> I have filed for it now:
> 	Invalid debug/ array bounds w/-fno-range-check and 32-bit target
> 	http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54934

Therefore it looks as a valid gfortran FSF GCC HEAD bug so provided
a hand-patched .S file for i386; patched GDB PASSes with it.


Thanks,
Jan


2012-10-15  Siddhesh Poyarekar  <siddhesh@redhat.com>
	    Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gdb.fortran/array-bounds.exp: New test file.
	* gdb.fortran/array-bounds.f: New test file.
	* gdb.fortran/array-bounds.S: New test file.

--- /dev/null	2012-09-26 15:32:16.098506310 +0200
+++ gdb-7.2/gdb/testsuite/gdb.fortran/array-bounds.exp	2012-10-15 20:53:26.427072583 +0200
@@ -0,0 +1,43 @@
+# Copyright 2012 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 3 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, see <http://www.gnu.org/licenses/>.
+
+# This file is part of the gdb testsuite.  It contains test to ensure that
+# array bounds accept LONGEST.
+
+if { [skip_fortran_tests] } { return -1 }
+
+set testfile "array-bounds"
+
+if { [is_ilp32_target] && ([istarget "i\[34567\]86-*-linux*"]
+			   || [istarget "x86_64-*-linux*"]) } {
+    set srcfile ${testfile}.S
+    set opts {nodebug f77}
+} else {
+    set srcfile ${testfile}.f
+    set opts {debug f77}
+}
+
+if {[prepare_for_testing $testfile.exp $testfile $srcfile $opts]} {
+    print "compile failed"
+    return -1
+}
+
+if { ![runto MAIN__] } {
+    perror "Could not run to breakpoint `MAIN__'."
+    continue
+}
+
+gdb_test "print &foo" {.*\(4294967296:4294967297\).*}
+gdb_test "print &bar" {.*\(-4294967297:-4294967296\).*}
--- /dev/null	2012-09-26 15:32:16.098506310 +0200
+++ gdb-7.2/gdb/testsuite/gdb.fortran/array-bounds.f	2012-10-15 19:35:12.500254261 +0200
@@ -0,0 +1,22 @@
+c Copyright 2012 Free Software Foundation, Inc.
+
+c This program is free software; you can redistribute it and/or modify
+c it under the terms of the GNU General Public License as published by
+c the Free Software Foundation; either version 3 of the License, or
+c (at your option) any later version.
+c
+c This program is distributed in the hope that it will be useful,
+c but WITHOUT ANY WARRANTY; without even the implied warranty of
+c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+c GNU General Public License for more details.
+c
+c You should have received a copy of the GNU General Public License
+c along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+        dimension foo(4294967296_8:4294967297_8)
+        dimension bar(-4294967297_8:-4294967296_8)
+        bar = 42
+        foo=bar
+        stop
+        end
+
--- /dev/null	2012-09-26 15:32:16.098506310 +0200
+++ gdb-7.2/gdb/testsuite/gdb.fortran/array-bounds.S	2012-10-15 20:52:36.851118215 +0200
@@ -0,0 +1,529 @@
+/* Copyright 2012 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 3 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, see <http://www.gnu.org/licenses/>.
+
+   This file is part of the gdb testsuite.  */
+
+	.file	"array-bounds.f"
+	.text
+.Ltext0:
+	.type	MAIN__, @function
+MAIN__:
+.LFB0:
+	.file 1 "gdb.fortran/array-bounds.f"
+	# gdb.fortran/array-bounds.f:16
+	.loc 1 16 0
+	.cfi_startproc
+# BLOCK 2 seq:0
+# PRED: ENTRY (FALLTHRU)
+	pushl	%ebp
+.LCFI0:
+	.cfi_def_cfa_offset 8
+	.cfi_offset 5, -8
+	movl	%esp, %ebp
+.LCFI1:
+	.cfi_def_cfa_register 5
+	subl	$40, %esp
+.LBB2:
+# SUCC: 3 (FALLTHRU)
+	# gdb.fortran/array-bounds.f:18
+	.loc 1 18 0
+	movl	$-1, %eax
+# BLOCK 3 seq:1
+# PRED: 2 (FALLTHRU) 4 [100.0%] 
+.L3:
+	# gdb.fortran/array-bounds.f:18
+	.loc 1 18 0 is_stmt 0 discriminator 1
+	testl	%eax, %eax
+# SUCC: 5 4 (FALLTHRU)
+	jg	.L2
+# BLOCK 4 seq:2
+# PRED: 3 (FALLTHRU)
+	# gdb.fortran/array-bounds.f:18
+	.loc 1 18 0 discriminator 2
+	leal	1(%eax), %ecx
+	movl	.LC0, %edx
+	movl	%edx, -16(%ebp,%ecx,4)
+	addl	$1, %eax
+# SUCC: 3 [100.0%] 
+	jmp	.L3
+# BLOCK 5 seq:3
+# PRED: 3
+.L2:
+.LBE2:
+	# gdb.fortran/array-bounds.f:19
+	.loc 1 19 0 is_stmt 1
+	movl	-16(%ebp), %eax
+	movl	-12(%ebp), %edx
+	movl	%eax, -24(%ebp)
+	movl	%edx, -20(%ebp)
+	# gdb.fortran/array-bounds.f:20
+	.loc 1 20 0
+	movl	$0, 4(%esp)
+	movl	$0, (%esp)
+# SUCC:
+	call	_gfortran_stop_string
+	.cfi_endproc
+.LFE0:
+	.size	MAIN__, .-MAIN__
+	.globl	main
+	.type	main, @function
+main:
+.LFB1:
+	# gdb.fortran/array-bounds.f:21
+	.loc 1 21 0
+	.cfi_startproc
+# BLOCK 2 seq:0
+# PRED: ENTRY (FALLTHRU)
+	pushl	%ebp
+.LCFI2:
+	.cfi_def_cfa_offset 8
+	.cfi_offset 5, -8
+	movl	%esp, %ebp
+.LCFI3:
+	.cfi_def_cfa_register 5
+	andl	$-16, %esp
+	subl	$16, %esp
+	# gdb.fortran/array-bounds.f:21
+	.loc 1 21 0
+	movl	12(%ebp), %eax
+	movl	%eax, 4(%esp)
+	movl	8(%ebp), %eax
+	movl	%eax, (%esp)
+	call	_gfortran_set_args
+	movl	$options.1.1824, 4(%esp)
+	movl	$7, (%esp)
+	call	_gfortran_set_options
+	call	MAIN__
+	movl	$0, %eax
+	leave
+.LCFI4:
+	.cfi_restore 5
+	.cfi_def_cfa 4, 4
+# SUCC: EXIT [100.0%] 
+	ret
+	.cfi_endproc
+.LFE1:
+	.size	main, .-main
+	.section	.rodata
+	.align 4
+	.type	options.1.1824, @object
+	.size	options.1.1824, 28
+options.1.1824:
+	.long	68
+	.long	1023
+	.long	0
+	.long	0
+	.long	1
+	.long	1
+	.long	0
+	.align 4
+.LC0:
+	.long	1109917696
+	.text
+.Letext0:
+	.section	.debug_info,"",@progbits
+.Ldebug_info0:
+	.long	2f - 1f	# Length of Compilation Unit Info
+1:
+	.value	0x2	# DWARF version number
+	.long	.Ldebug_abbrev0	# Offset Into Abbrev. Section
+	.byte	0x4	# Pointer Size (in bytes)
+dieb:	.uleb128 0x1	# (DIE (0xb) DW_TAG_compile_unit)
+	.long	.LASF5	# DW_AT_producer: "GNU Fortran 4.8.0 20121015 (experimental) -ffixed-form -m32 -mtune=generic -march=x86-64 -g -gdwarf-2 -fintrinsic-modules-path .../gcchead-root/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/finclude"
+	.byte	0xe	# DW_AT_language
+	.byte	0x2	# DW_AT_identifier_case
+	.long	.LASF6	# DW_AT_name: "gdb.fortran/array-bounds.f"
+	.long	.LASF7	# DW_AT_comp_dir: ""
+	.long	.Ltext0	# DW_AT_low_pc
+	.long	.Letext0	# DW_AT_high_pc
+	.long	.Ldebug_line0	# DW_AT_stmt_list
+die26:	.uleb128 0x2	# (DIE (0x26) DW_TAG_subprogram)
+	.long	.LASF8	# DW_AT_name: "MAIN__"
+	.byte	0x1	# DW_AT_decl_file (gdb.fortran/array-bounds.f)
+	.byte	0x10	# DW_AT_decl_line
+	.long	.LFB0	# DW_AT_low_pc
+	.long	.LFE0	# DW_AT_high_pc
+	.long	.LLST0	# DW_AT_frame_base
+	.byte	0x1	# DW_AT_GNU_all_tail_call_sites
+	.byte	0x1	# DW_AT_main_subprogram
+	.byte	0x2	# DW_AT_calling_convention
+	.long	die66 - .Ldebug_info0	# DW_AT_sibling
+die40:	.uleb128 0x3	# (DIE (0x40) DW_TAG_variable)
+	.ascii "bar\0"	# DW_AT_name
+	.byte	0x1	# DW_AT_decl_file (gdb.fortran/array-bounds.f)
+	.byte	0x11	# DW_AT_decl_line
+	.long	die66 - .Ldebug_info0	# DW_AT_type
+	.byte	0x2	# DW_AT_location
+	.byte	0x91	# DW_OP_fbreg
+	.sleb128 -24
+die4e:	.uleb128 0x3	# (DIE (0x4e) DW_TAG_variable)
+	.ascii "foo\0"	# DW_AT_name
+	.byte	0x1	# DW_AT_decl_file (gdb.fortran/array-bounds.f)
+	.byte	0x10	# DW_AT_decl_line
+	.long	die88 - .Ldebug_info0	# DW_AT_type
+	.byte	0x2	# DW_AT_location
+	.byte	0x91	# DW_OP_fbreg
+	.sleb128 -32
+die5c:	.uleb128 0x4	# (DIE (0x5c) DW_TAG_lexical_block)
+	.long	.LBB2	# DW_AT_low_pc
+	.long	.LBE2	# DW_AT_high_pc
+	.byte	0	# end of children of DIE 0x26
+die66:	.uleb128 0x5	# (DIE (0x66) DW_TAG_array_type)
+	.long	die81 - .Ldebug_info0	# DW_AT_type
+	.long	die7a - .Ldebug_info0	# DW_AT_sibling
+die6f:	.uleb128 0x6	# (DIE (0x6f) DW_TAG_subrange_type)
+	.long	die7a - .Ldebug_info0	# DW_AT_type
+#if 0
+	.long	0xffffffff	# DW_AT_lower_bound
+	.byte	0	# DW_AT_upper_bound
+#else
+	.quad	0xfffffffeffffffff	# DW_AT_lower_bound
+	.quad	0xffffffff00000000	# DW_AT_upper_bound
+#endif
+	.byte	0	# end of children of DIE 0x66
+die7a:	.uleb128 0x7	# (DIE (0x7a) DW_TAG_base_type)
+#if 0
+	.byte	0x4	# DW_AT_byte_size
+#else
+	.byte	0x8	# DW_AT_byte_size
+#endif
+	.byte	0x5	# DW_AT_encoding
+	.long	.LASF0	# DW_AT_name: "integer(kind=4)"
+die81:	.uleb128 0x7	# (DIE (0x81) DW_TAG_base_type)
+	.byte	0x4	# DW_AT_byte_size
+	.byte	0x4	# DW_AT_encoding
+	.long	.LASF1	# DW_AT_name: "real(kind=4)"
+die88:	.uleb128 0x5	# (DIE (0x88) DW_TAG_array_type)
+	.long	die81 - .Ldebug_info0	# DW_AT_type
+	.long	die99 - .Ldebug_info0	# DW_AT_sibling
+die91:	.uleb128 0x8	# (DIE (0x91) DW_TAG_subrange_type)
+	.long	die7a - .Ldebug_info0	# DW_AT_type
+#if 0
+	.byte	0	# DW_AT_lower_bound
+	.byte	0x1	# DW_AT_upper_bound
+#else
+	.quad	0x100000000	# DW_AT_lower_bound
+	.quad	0x100000001	# DW_AT_upper_bound
+#endif
+	.byte	0	# end of children of DIE 0x88
+die99:	.uleb128 0x9	# (DIE (0x99) DW_TAG_subprogram)
+	.byte	0x1	# DW_AT_external
+	.long	.LASF9	# DW_AT_name: "main"
+	.byte	0x1	# DW_AT_decl_file (gdb.fortran/array-bounds.f)
+	.byte	0x15	# DW_AT_decl_line
+	.long	die7a - .Ldebug_info0	# DW_AT_type
+	.long	.LFB1	# DW_AT_low_pc
+	.long	.LFE1	# DW_AT_high_pc
+	.long	.LLST1	# DW_AT_frame_base
+	.byte	0x1	# DW_AT_GNU_all_tail_call_sites
+	.long	died4 - .Ldebug_info0	# DW_AT_sibling
+dieb6:	.uleb128 0xa	# (DIE (0xb6) DW_TAG_formal_parameter)
+	.long	.LASF2	# DW_AT_name: "argc"
+	.byte	0x1	# DW_AT_decl_file (gdb.fortran/array-bounds.f)
+	.byte	0x15	# DW_AT_decl_line
+	.long	died4 - .Ldebug_info0	# DW_AT_type
+	.byte	0x2	# DW_AT_location
+	.byte	0x91	# DW_OP_fbreg
+	.sleb128 0
+diec4:	.uleb128 0xa	# (DIE (0xc4) DW_TAG_formal_parameter)
+	.long	.LASF3	# DW_AT_name: "argv"
+	.byte	0x1	# DW_AT_decl_file (gdb.fortran/array-bounds.f)
+	.byte	0x15	# DW_AT_decl_line
+	.long	died9 - .Ldebug_info0	# DW_AT_type
+	.byte	0x3	# DW_AT_location
+	.byte	0x91	# DW_OP_fbreg
+	.sleb128 4
+	.byte	0x6	# DW_OP_deref
+	.byte	0	# end of children of DIE 0x99
+died4:	.uleb128 0xb	# (DIE (0xd4) DW_TAG_const_type)
+	.long	die7a - .Ldebug_info0	# DW_AT_type
+died9:	.uleb128 0xc	# (DIE (0xd9) DW_TAG_pointer_type)
+	.byte	0x4	# DW_AT_byte_size
+	.long	diedf - .Ldebug_info0	# DW_AT_type
+diedf:	.uleb128 0x7	# (DIE (0xdf) DW_TAG_base_type)
+	.byte	0x1	# DW_AT_byte_size
+	.byte	0x8	# DW_AT_encoding
+	.long	.LASF4	# DW_AT_name: "character(kind=1)"
+	.byte	0	# end of children of DIE 0xb
+2:
+	.section	.debug_abbrev,"",@progbits
+.Ldebug_abbrev0:
+	.uleb128 0x1	# (abbrev code)
+	.uleb128 0x11	# (TAG: DW_TAG_compile_unit)
+	.byte	0x1	# DW_children_yes
+	.uleb128 0x25	# (DW_AT_producer)
+	.uleb128 0xe	# (DW_FORM_strp)
+	.uleb128 0x13	# (DW_AT_language)
+	.uleb128 0xb	# (DW_FORM_data1)
+	.uleb128 0x42	# (DW_AT_identifier_case)
+	.uleb128 0xb	# (DW_FORM_data1)
+	.uleb128 0x3	# (DW_AT_name)
+	.uleb128 0xe	# (DW_FORM_strp)
+	.uleb128 0x1b	# (DW_AT_comp_dir)
+	.uleb128 0xe	# (DW_FORM_strp)
+	.uleb128 0x11	# (DW_AT_low_pc)
+	.uleb128 0x1	# (DW_FORM_addr)
+	.uleb128 0x12	# (DW_AT_high_pc)
+	.uleb128 0x1	# (DW_FORM_addr)
+	.uleb128 0x10	# (DW_AT_stmt_list)
+	.uleb128 0x6	# (DW_FORM_data4)
+	.byte	0
+	.byte	0
+	.uleb128 0x2	# (abbrev code)
+	.uleb128 0x2e	# (TAG: DW_TAG_subprogram)
+	.byte	0x1	# DW_children_yes
+	.uleb128 0x3	# (DW_AT_name)
+	.uleb128 0xe	# (DW_FORM_strp)
+	.uleb128 0x3a	# (DW_AT_decl_file)
+	.uleb128 0xb	# (DW_FORM_data1)
+	.uleb128 0x3b	# (DW_AT_decl_line)
+	.uleb128 0xb	# (DW_FORM_data1)
+	.uleb128 0x11	# (DW_AT_low_pc)
+	.uleb128 0x1	# (DW_FORM_addr)
+	.uleb128 0x12	# (DW_AT_high_pc)
+	.uleb128 0x1	# (DW_FORM_addr)
+	.uleb128 0x40	# (DW_AT_frame_base)
+	.uleb128 0x6	# (DW_FORM_data4)
+	.uleb128 0x2116	# (DW_AT_GNU_all_tail_call_sites)
+	.uleb128 0xc	# (DW_FORM_flag)
+	.uleb128 0x6a	# (DW_AT_main_subprogram)
+	.uleb128 0xc	# (DW_FORM_flag)
+	.uleb128 0x36	# (DW_AT_calling_convention)
+	.uleb128 0xb	# (DW_FORM_data1)
+	.uleb128 0x1	# (DW_AT_sibling)
+	.uleb128 0x13	# (DW_FORM_ref4)
+	.byte	0
+	.byte	0
+	.uleb128 0x3	# (abbrev code)
+	.uleb128 0x34	# (TAG: DW_TAG_variable)
+	.byte	0	# DW_children_no
+	.uleb128 0x3	# (DW_AT_name)
+	.uleb128 0x8	# (DW_FORM_string)
+	.uleb128 0x3a	# (DW_AT_decl_file)
+	.uleb128 0xb	# (DW_FORM_data1)
+	.uleb128 0x3b	# (DW_AT_decl_line)
+	.uleb128 0xb	# (DW_FORM_data1)
+	.uleb128 0x49	# (DW_AT_type)
+	.uleb128 0x13	# (DW_FORM_ref4)
+	.uleb128 0x2	# (DW_AT_location)
+	.uleb128 0xa	# (DW_FORM_block1)
+	.byte	0
+	.byte	0
+	.uleb128 0x4	# (abbrev code)
+	.uleb128 0xb	# (TAG: DW_TAG_lexical_block)
+	.byte	0	# DW_children_no
+	.uleb128 0x11	# (DW_AT_low_pc)
+	.uleb128 0x1	# (DW_FORM_addr)
+	.uleb128 0x12	# (DW_AT_high_pc)
+	.uleb128 0x1	# (DW_FORM_addr)
+	.byte	0
+	.byte	0
+	.uleb128 0x5	# (abbrev code)
+	.uleb128 0x1	# (TAG: DW_TAG_array_type)
+	.byte	0x1	# DW_children_yes
+	.uleb128 0x49	# (DW_AT_type)
+	.uleb128 0x13	# (DW_FORM_ref4)
+	.uleb128 0x1	# (DW_AT_sibling)
+	.uleb128 0x13	# (DW_FORM_ref4)
+	.byte	0
+	.byte	0
+	.uleb128 0x6	# (abbrev code)
+	.uleb128 0x21	# (TAG: DW_TAG_subrange_type)
+	.byte	0	# DW_children_no
+	.uleb128 0x49	# (DW_AT_type)
+	.uleb128 0x13	# (DW_FORM_ref4)
+#if 0
+	.uleb128 0x22	# (DW_AT_lower_bound)
+	.uleb128 0x6	# (DW_FORM_data4)
+	.uleb128 0x2f	# (DW_AT_upper_bound)
+	.uleb128 0xb	# (DW_FORM_data1)
+#else
+	.uleb128 0x22	# (DW_AT_lower_bound)
+	.uleb128 0x7	# (DW_FORM_data8)
+	.uleb128 0x2f	# (DW_AT_upper_bound)
+	.uleb128 0x7	# (DW_FORM_data8)
+#endif
+	.byte	0
+	.byte	0
+	.uleb128 0x7	# (abbrev code)
+	.uleb128 0x24	# (TAG: DW_TAG_base_type)
+	.byte	0	# DW_children_no
+	.uleb128 0xb	# (DW_AT_byte_size)
+	.uleb128 0xb	# (DW_FORM_data1)
+	.uleb128 0x3e	# (DW_AT_encoding)
+	.uleb128 0xb	# (DW_FORM_data1)
+	.uleb128 0x3	# (DW_AT_name)
+	.uleb128 0xe	# (DW_FORM_strp)
+	.byte	0
+	.byte	0
+	.uleb128 0x8	# (abbrev code)
+	.uleb128 0x21	# (TAG: DW_TAG_subrange_type)
+	.byte	0	# DW_children_no
+	.uleb128 0x49	# (DW_AT_type)
+	.uleb128 0x13	# (DW_FORM_ref4)
+#if 0
+	.uleb128 0x22	# (DW_AT_lower_bound)
+	.uleb128 0xb	# (DW_FORM_data1)
+	.uleb128 0x2f	# (DW_AT_upper_bound)
+	.uleb128 0xb	# (DW_FORM_data1)
+#else
+	.uleb128 0x22	# (DW_AT_lower_bound)
+	.uleb128 0x7	# (DW_FORM_data8)
+	.uleb128 0x2f	# (DW_AT_upper_bound)
+	.uleb128 0x7	# (DW_FORM_data8)
+#endif
+	.byte	0
+	.byte	0
+	.uleb128 0x9	# (abbrev code)
+	.uleb128 0x2e	# (TAG: DW_TAG_subprogram)
+	.byte	0x1	# DW_children_yes
+	.uleb128 0x3f	# (DW_AT_external)
+	.uleb128 0xc	# (DW_FORM_flag)
+	.uleb128 0x3	# (DW_AT_name)
+	.uleb128 0xe	# (DW_FORM_strp)
+	.uleb128 0x3a	# (DW_AT_decl_file)
+	.uleb128 0xb	# (DW_FORM_data1)
+	.uleb128 0x3b	# (DW_AT_decl_line)
+	.uleb128 0xb	# (DW_FORM_data1)
+	.uleb128 0x49	# (DW_AT_type)
+	.uleb128 0x13	# (DW_FORM_ref4)
+	.uleb128 0x11	# (DW_AT_low_pc)
+	.uleb128 0x1	# (DW_FORM_addr)
+	.uleb128 0x12	# (DW_AT_high_pc)
+	.uleb128 0x1	# (DW_FORM_addr)
+	.uleb128 0x40	# (DW_AT_frame_base)
+	.uleb128 0x6	# (DW_FORM_data4)
+	.uleb128 0x2116	# (DW_AT_GNU_all_tail_call_sites)
+	.uleb128 0xc	# (DW_FORM_flag)
+	.uleb128 0x1	# (DW_AT_sibling)
+	.uleb128 0x13	# (DW_FORM_ref4)
+	.byte	0
+	.byte	0
+	.uleb128 0xa	# (abbrev code)
+	.uleb128 0x5	# (TAG: DW_TAG_formal_parameter)
+	.byte	0	# DW_children_no
+	.uleb128 0x3	# (DW_AT_name)
+	.uleb128 0xe	# (DW_FORM_strp)
+	.uleb128 0x3a	# (DW_AT_decl_file)
+	.uleb128 0xb	# (DW_FORM_data1)
+	.uleb128 0x3b	# (DW_AT_decl_line)
+	.uleb128 0xb	# (DW_FORM_data1)
+	.uleb128 0x49	# (DW_AT_type)
+	.uleb128 0x13	# (DW_FORM_ref4)
+	.uleb128 0x2	# (DW_AT_location)
+	.uleb128 0xa	# (DW_FORM_block1)
+	.byte	0
+	.byte	0
+	.uleb128 0xb	# (abbrev code)
+	.uleb128 0x26	# (TAG: DW_TAG_const_type)
+	.byte	0	# DW_children_no
+	.uleb128 0x49	# (DW_AT_type)
+	.uleb128 0x13	# (DW_FORM_ref4)
+	.byte	0
+	.byte	0
+	.uleb128 0xc	# (abbrev code)
+	.uleb128 0xf	# (TAG: DW_TAG_pointer_type)
+	.byte	0	# DW_children_no
+	.uleb128 0xb	# (DW_AT_byte_size)
+	.uleb128 0xb	# (DW_FORM_data1)
+	.uleb128 0x49	# (DW_AT_type)
+	.uleb128 0x13	# (DW_FORM_ref4)
+	.byte	0
+	.byte	0
+	.byte	0
+	.section	.debug_loc,"",@progbits
+.Ldebug_loc0:
+.LLST0:
+	.long	.LFB0-.Ltext0	# Location list begin address (*.LLST0)
+	.long	.LCFI0-.Ltext0	# Location list end address (*.LLST0)
+	.value	0x2	# Location expression size
+	.byte	0x74	# DW_OP_breg4
+	.sleb128 4
+	.long	.LCFI0-.Ltext0	# Location list begin address (*.LLST0)
+	.long	.LCFI1-.Ltext0	# Location list end address (*.LLST0)
+	.value	0x2	# Location expression size
+	.byte	0x74	# DW_OP_breg4
+	.sleb128 8
+	.long	.LCFI1-.Ltext0	# Location list begin address (*.LLST0)
+	.long	.LFE0-.Ltext0	# Location list end address (*.LLST0)
+	.value	0x2	# Location expression size
+	.byte	0x75	# DW_OP_breg5
+	.sleb128 8
+	.long	0	# Location list terminator begin (*.LLST0)
+	.long	0	# Location list terminator end (*.LLST0)
+.LLST1:
+	.long	.LFB1-.Ltext0	# Location list begin address (*.LLST1)
+	.long	.LCFI2-.Ltext0	# Location list end address (*.LLST1)
+	.value	0x2	# Location expression size
+	.byte	0x74	# DW_OP_breg4
+	.sleb128 4
+	.long	.LCFI2-.Ltext0	# Location list begin address (*.LLST1)
+	.long	.LCFI3-.Ltext0	# Location list end address (*.LLST1)
+	.value	0x2	# Location expression size
+	.byte	0x74	# DW_OP_breg4
+	.sleb128 8
+	.long	.LCFI3-.Ltext0	# Location list begin address (*.LLST1)
+	.long	.LCFI4-.Ltext0	# Location list end address (*.LLST1)
+	.value	0x2	# Location expression size
+	.byte	0x75	# DW_OP_breg5
+	.sleb128 8
+	.long	.LCFI4-.Ltext0	# Location list begin address (*.LLST1)
+	.long	.LFE1-.Ltext0	# Location list end address (*.LLST1)
+	.value	0x2	# Location expression size
+	.byte	0x74	# DW_OP_breg4
+	.sleb128 4
+	.long	0	# Location list terminator begin (*.LLST1)
+	.long	0	# Location list terminator end (*.LLST1)
+	.section	.debug_aranges,"",@progbits
+	.long	0x1c	# Length of Address Ranges Info
+	.value	0x2	# DWARF Version
+	.long	.Ldebug_info0	# Offset of Compilation Unit Info
+	.byte	0x4	# Size of Address
+	.byte	0	# Size of Segment Descriptor
+	.value	0	# Pad to 8 byte boundary
+	.value	0
+	.long	.Ltext0	# Address
+	.long	.Letext0-.Ltext0	# Length
+	.long	0
+	.long	0
+	.section	.debug_line,"",@progbits
+.Ldebug_line0:
+	.section	.debug_str,"MS",@progbits,1
+.LASF4:
+	.string	"character(kind=1)"
+.LASF5:
+	.string	"GNU Fortran 4.8.0 20121015 (experimental) -ffixed-form -m32 -mtune=generic -march=x86-64 -g -gdwarf-2 -fintrinsic-modules-path .../gcchead-root/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/finclude"
+.LASF7:
+	.string	""
+.LASF0:
+#if 0
+	.string	"integer(kind=4)"
+#else
+	.string	"integer(kind=8)"
+#endif
+.LASF9:
+	.string	"main"
+.LASF8:
+	.string	"MAIN__"
+.LASF6:
+	.string	"gdb.fortran/array-bounds.f"
+.LASF2:
+	.string	"argc"
+.LASF1:
+	.string	"real(kind=4)"
+.LASF3:
+	.string	"argv"
+	.ident	"GCC: (GNU) 4.8.0 20121015 (experimental)"
+	.section	.note.GNU-stack,"",@progbits


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Expand fortran array bounds sizes to LONGEST
  2012-10-15 18:56   ` Jan Kratochvil
@ 2012-10-21  7:44     ` Siddhesh Poyarekar
  0 siblings, 0 replies; 9+ messages in thread
From: Siddhesh Poyarekar @ 2012-10-21  7:44 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb-patches, Sergio Durigan Junior

On Mon, 15 Oct 2012 20:56:26 +0200, Jan wrote:
> On Mon, 15 Oct 2012 15:25:55 +0200, Jan Kratochvil wrote:
> > I have filed for it now:
> > 	Invalid debug/ array bounds w/-fno-range-check and 32-bit
> > target http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54934
> 
> Therefore it looks as a valid gfortran FSF GCC HEAD bug so provided
> a hand-patched .S file for i386; patched GDB PASSes with it.

Thanks, I'll update my stash with this test.


Siddhesh


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-10-21  7:44 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-21  9:56 [PATCH] Expand fortran array bounds sizes to LONGEST Siddhesh Poyarekar
2012-08-21 11:12 ` Siddhesh Poyarekar
2012-08-21 18:22   ` Tom Tromey
2012-08-21 18:10     ` Siddhesh Poyarekar
2012-08-21 18:21       ` Tom Tromey
2012-08-21 18:22 ` Tom Tromey
2012-10-15 13:26 ` Jan Kratochvil
2012-10-15 18:56   ` Jan Kratochvil
2012-10-21  7:44     ` Siddhesh Poyarekar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox