gdb/gdb-rhbz1964167-fortran-fix-type-format-mismatch-in-f-lang.c.patch

129 lines
6.2 KiB
Diff
Raw Normal View History

Rebase to FSF GDB 10.2. Drop gdb-6.3-test-pie-20050107.patch. Drop gdb-6.3-test-self-20050110.patch. Drop gdb-6.5-bz218379-ppc-solib-trampoline-test.patch. Drop gdb-6.6-buildid-locate-core-as-arg.patch. Drop gdb-6.8-quit-never-aborts.patch. Drop gdb-archer-pie-addons-keep-disabled.patch. Drop gdb-archer-pie-addons.patch. Drop gdb-archer-vla-tests.patch. Drop gdb-archer.patch. Drop gdb-attach-fail-reasons-5of5.patch. Drop gdb-btrobust.patch. Drop gdb-bz1219747-attach-kills.patch. Drop gdb-bz533176-fortran-omp-step.patch. Drop gdb-dts-rhel6-python-compat.patch. Drop gdb-gnat-dwarf-crash-3of3.patch. Drop gdb-jit-reader-multilib.patch. Drop gdb-moribund-utrace-workaround.patch. Drop gdb-rhbz1930528-fix-gnulib-build-error.patch. Drop gdb-rhbz1932645-aarch64-ptrace-header-order.patch. Drop gdb-vla-intel-fix-print-char-array.patch. Drop gdb-vla-intel-fortran-strides.patch. Drop gdb-vla-intel-stringbt-fix.patch. Drop gdb-vla-intel-tests.patch. Drop process_psymtab_comp_unit-type-unit.patch. Drop gdb-testsuite-readline63-sigint-revert.patch. Drop gdb-config.patch. Add following upstream patches for Fortran stride / slice support: gdb-rhbz1964167-convert-enum-range_type.patch gdb-rhbz1964167-fortran-array-slices-at-prompt.patch gdb-rhbz1964167-fortran-array-strides-in-expressions.patch gdb-rhbz1964167-fortran-clean-up-array-expression-evaluation.patch gdb-rhbz1964167-fortran-range_type-to-range_flag.patch gdb-rhbz1964167-fortran-whitespace_array.patch gdb-rhbz1964167-move-fortran-expr-handling.patch
2021-06-06 21:54:47 +00:00
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Kevin Buettner <kevinb@redhat.com>
Date: Tue, 25 May 2021 17:34:57 -0700
Subject: gdb-rhbz1964167-fortran-fix-type-format-mismatch-in-f-lang.c.patch
;; [fortran] Backport Simon Marchi's commit which fixes a 32-bit build
;; problem in gdb/f-lang.c.
gdb: fix format string warnings in f-lang.c
I get a bunch of these warnings when compiling for i386 (32-bit):
CXX f-lang.o
/home/simark/src/binutils-gdb/gdb/f-lang.c: In function 'value* fortran_value_subarray(value*, expression*, int*, int, noside)':
/home/simark/src/binutils-gdb/gdb/f-lang.c:453:48: error: format '%ld' expects argument of type 'long int', but argument 2 has type 'LONGEST' {aka 'long long int'} [-Werror=format=]
453 | debug_printf ("| | |-> Low bound: %ld\n", lb);
| ~~^ ~~
| | |
| | LONGEST {aka long long int}
| long int
| %lld
Fix them by using plongest/pulongest.
gdb/ChangeLog:
* f-lang.c (fortran_value_subarray): Use plongest/pulongest.
Change-Id: I666ead5593653d5a1a3dab2ffdc72942c928c7d2
diff --git a/gdb/f-lang.c b/gdb/f-lang.c
--- a/gdb/f-lang.c
+++ b/gdb/f-lang.c
@@ -463,21 +463,21 @@ fortran_value_subarray (struct value *array, struct expression *exp,
std::string str = type_to_string (dim_type);
debug_printf ("| |-> Type: %s\n", str.c_str ());
debug_printf ("| |-> Array:\n");
- debug_printf ("| | |-> Low bound: %ld\n", lb);
- debug_printf ("| | |-> High bound: %ld\n", ub);
- debug_printf ("| | |-> Bit stride: %ld\n", sd);
- debug_printf ("| | |-> Byte stride: %ld\n", sd / 8);
- debug_printf ("| | |-> Type size: %ld\n",
- TYPE_LENGTH (dim_type));
- debug_printf ("| | '-> Target type size: %ld\n",
- TYPE_LENGTH (target_type));
+ debug_printf ("| | |-> Low bound: %s\n", plongest (lb));
+ debug_printf ("| | |-> High bound: %s\n", plongest (ub));
+ debug_printf ("| | |-> Bit stride: %s\n", plongest (sd));
+ debug_printf ("| | |-> Byte stride: %s\n", plongest (sd / 8));
+ debug_printf ("| | |-> Type size: %s\n",
+ pulongest (TYPE_LENGTH (dim_type)));
+ debug_printf ("| | '-> Target type size: %s\n",
+ pulongest (TYPE_LENGTH (target_type)));
debug_printf ("| |-> Accessing:\n");
- debug_printf ("| | |-> Low bound: %ld\n",
- low);
- debug_printf ("| | |-> High bound: %ld\n",
- high);
- debug_printf ("| | '-> Element stride: %ld\n",
- stride);
+ debug_printf ("| | |-> Low bound: %s\n",
+ plongest (low));
+ debug_printf ("| | |-> High bound: %s\n",
+ plongest (high));
+ debug_printf ("| | '-> Element stride: %s\n",
+ plongest (stride));
}
/* Check the user hasn't asked for something invalid. */
@@ -519,13 +519,17 @@ fortran_value_subarray (struct value *array, struct expression *exp,
if (fortran_array_slicing_debug)
{
debug_printf ("| '-> Results:\n");
- debug_printf ("| |-> Offset = %ld\n", offset);
- debug_printf ("| |-> Elements = %ld\n", e_count);
- debug_printf ("| |-> Low bound = %ld\n", new_low);
- debug_printf ("| |-> High bound = %ld\n", new_high);
- debug_printf ("| |-> Byte stride = %ld\n", new_stride);
- debug_printf ("| |-> Last element = %ld\n", last_elem);
- debug_printf ("| |-> Remainder = %ld\n", remainder);
+ debug_printf ("| |-> Offset = %s\n", plongest (offset));
+ debug_printf ("| |-> Elements = %s\n", plongest (e_count));
+ debug_printf ("| |-> Low bound = %s\n", plongest (new_low));
+ debug_printf ("| |-> High bound = %s\n",
+ plongest (new_high));
+ debug_printf ("| |-> Byte stride = %s\n",
+ plongest (new_stride));
+ debug_printf ("| |-> Last element = %s\n",
+ plongest (last_elem));
+ debug_printf ("| |-> Remainder = %s\n",
+ plongest (remainder));
debug_printf ("| '-> Contiguous = %s\n",
(is_dim_contiguous ? "Yes" : "No"));
}
@@ -561,14 +565,16 @@ fortran_value_subarray (struct value *array, struct expression *exp,
std::string str = type_to_string (dim_type);
debug_printf ("| |-> Type: %s\n", str.c_str ());
debug_printf ("| |-> Array:\n");
- debug_printf ("| | |-> Low bound: %ld\n", lb);
- debug_printf ("| | |-> High bound: %ld\n", ub);
- debug_printf ("| | |-> Byte stride: %ld\n", sd);
- debug_printf ("| | |-> Type size: %ld\n", TYPE_LENGTH (dim_type));
- debug_printf ("| | '-> Target type size: %ld\n",
- TYPE_LENGTH (target_type));
+ debug_printf ("| | |-> Low bound: %s\n", plongest (lb));
+ debug_printf ("| | |-> High bound: %s\n", plongest (ub));
+ debug_printf ("| | |-> Byte stride: %s\n", plongest (sd));
+ debug_printf ("| | |-> Type size: %s\n",
+ pulongest (TYPE_LENGTH (dim_type)));
+ debug_printf ("| | '-> Target type size: %s\n",
+ pulongest (TYPE_LENGTH (target_type)));
debug_printf ("| '-> Accessing:\n");
- debug_printf ("| '-> Index: %ld\n", index);
+ debug_printf ("| '-> Index: %s\n",
+ plongest (index));
}
/* If the array has actual content then check the index is in
@@ -625,7 +631,8 @@ fortran_value_subarray (struct value *array, struct expression *exp,
debug_printf ("'-> Final result:\n");
debug_printf (" |-> Type: %s\n",
type_to_string (array_slice_type).c_str ());
- debug_printf (" |-> Total offset: %ld\n", total_offset);
+ debug_printf (" |-> Total offset: %s\n",
+ plongest (total_offset));
debug_printf (" |-> Base address: %s\n",
core_addr_to_string (value_address (array)));
debug_printf (" '-> Contiguous = %s\n",