]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/ChangeLog:
authorSiddhesh Poyarekar <siddhesh@sourceware.org>
Tue, 25 Sep 2012 12:20:42 +0000 (12:20 +0000)
committerSiddhesh Poyarekar <siddhesh@sourceware.org>
Tue, 25 Sep 2012 12:20:42 +0000 (12:20 +0000)
* c-typeprint.c (c_type_print_varspec_suffix): Remove cast and
use plongest to print the array size.

testsuite/ChangeLog:

* gdb.base/longest-types.c: New test case.
* gdb.base/longest-types.exp: New test case.

gdb/ChangeLog
gdb/c-typeprint.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/longest-types.c [new file with mode: 0644]
gdb/testsuite/gdb.base/longest-types.exp [new file with mode: 0644]

index 0a1ccdff41dfcac2daaa8d5ae21d9baddb614ee9..a6a75b5bbaa9125cab9fc3526f973a7eef09c017 100644 (file)
@@ -1,3 +1,8 @@
+2012-09-25  Siddhesh Poyarekar  <siddhesh@redhat.com>
+
+       * c-typeprint.c (c_type_print_varspec_suffix): Remove cast and
+       use plongest to print the array size.
+
 2012-09-24  Siddhesh Poyarekar  <siddhesh@redhat.com>
 
        * m2-typeprint.c (m2_enum): Expand LASTVAL to LONGEST.
index 9ce6f632b712a52b7e4b8c8bf60476d57c240e91..8b5bc2170ac9f1df51b9df1ca3e8f92c6e3b6bba 100644 (file)
@@ -621,8 +621,8 @@ c_type_print_varspec_suffix (struct type *type,
        fprintf_filtered (stream, (is_vector ?
                                   "__attribute__ ((vector_size(" : "["));
        if (get_array_bounds (type, &low_bound, &high_bound))
-         fprintf_filtered (stream, "%d", 
-                           (int) (high_bound - low_bound + 1));
+         fprintf_filtered (stream, "%s", 
+                           plongest (high_bound - low_bound + 1));
        fprintf_filtered (stream, (is_vector ? ")))" : "]"));
 
        c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream,
index da01f8d32cf36421fb83392d77528ccf6149ab78..5e2bc5fc364afb330ff06b8aada07bc41d06044f 100644 (file)
@@ -1,3 +1,8 @@
+2012-09-25  Siddhesh Poyarekar  <siddhesh@redhat.com>
+
+       * gdb.base/longest-types.c: New test case.
+       * gdb.base/longest-types.exp: New test case.
+
 2012-09-25  Yao Qi  <yao@codesourcery.com>
 
        * gdb.mi/mi2-cli.exp: Check breakpoint notification.
diff --git a/gdb/testsuite/gdb.base/longest-types.c b/gdb/testsuite/gdb.base/longest-types.c
new file mode 100644 (file)
index 0000000..1394c08
--- /dev/null
@@ -0,0 +1,28 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+   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/>.  */
+
+struct foo
+{
+  char buf[0xffff000000];
+  char buf2[2];
+} *f;
+
+int
+main (void)
+{
+  return 0;
+}
diff --git a/gdb/testsuite/gdb.base/longest-types.exp b/gdb/testsuite/gdb.base/longest-types.exp
new file mode 100644 (file)
index 0000000..334307a
--- /dev/null
@@ -0,0 +1,25 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# 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/>.
+
+standard_testfile
+
+if { [prepare_for_testing ${testfile}.exp ${testfile} $srcfile {debug quiet}] } {
+    return -1
+}
+
+# 64-bit array size should not overflow
+gdb_test "print &f->buf" {= \(char \(\*\)\[1099494850560\]\) 0x0}