a8767b3
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
f637971
From: Sergio Durigan Junior <sergiodj@redhat.com>
f637971
Date: Thu, 7 Dec 2017 16:20:31 -0500
f637971
Subject: gdb-vla-intel-fix-print-char-array.patch
f637971
f637971
;; Revert upstream commit 469412dd9ccc4de5874fd3299b105833f36b34cd
f637971
f637971
Revert commit (only the part touching gdb/f-valprint.c):
f637971
f637971
  commit 469412dd9ccc4de5874fd3299b105833f36b34cd
f637971
  Author: Christoph Weinmann <christoph.t.weinmann@intel.com>
f637971
  Date:   Fri Sep 8 15:11:47 2017 +0200
f637971
f637971
      Remove C/C++ relevant code in Fortran specific file.
f637971
f637971
      Remove code relevant for printing C/C++ Integer values in a
f637971
      Fortran specific file to unify printing of Fortran values.
f637971
      This does not change the output.
f637971
f637971
And adjust its testcase.
f637971
f637971
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
f637971
--- a/gdb/f-valprint.c
f637971
+++ b/gdb/f-valprint.c
a5d2c85
@@ -319,8 +319,22 @@ f_val_print (struct type *type, int embedded_offset,
f637971
 				      original_value, &opts, 0, stream);
f637971
 	}
f637971
       else
f637971
-	val_print_scalar_formatted (type, embedded_offset,
f637971
-				    original_value, options, 0, stream);
f637971
+	{
f637971
+	  val_print_scalar_formatted (type, embedded_offset,
f637971
+				      original_value, options, 0, stream);
f637971
+	  /* C and C++ has no single byte int type, char is used instead.
f637971
+	     Since we don't know whether the value is really intended to
f637971
+	     be used as an integer or a character, print the character
f637971
+	     equivalent as well.  */
f637971
+	  if (TYPE_LENGTH (type) == 1)
f637971
+	    {
f637971
+	      LONGEST c;
f637971
+
f637971
+	      fputs_filtered (" ", stream);
f637971
+	      c = unpack_long (type, valaddr + embedded_offset);
f637971
+	      LA_PRINT_CHAR ((unsigned char) c, type, stream);
f637971
+	    }
f637971
+	}
f637971
       break;
f637971
 
f637971
     case TYPE_CODE_STRUCT:
f637971
diff --git a/gdb/testsuite/gdb.fortran/printing-types.exp b/gdb/testsuite/gdb.fortran/printing-types.exp
f637971
--- a/gdb/testsuite/gdb.fortran/printing-types.exp
f637971
+++ b/gdb/testsuite/gdb.fortran/printing-types.exp
f637971
@@ -29,7 +29,7 @@ if {![runto MAIN__]} then {
f637971
 gdb_breakpoint [gdb_get_line_number "write"]
f637971
 gdb_continue_to_breakpoint "write"
f637971
 
f637971
-gdb_test "print oneByte"	" = 1"
f637971
+gdb_test "print oneByte"	" = 1 \'\\\\001\'"
f637971
 gdb_test "print twobytes"	" = 2"
f637971
 gdb_test "print chvalue"	" = \'a\'"
f637971
 gdb_test "print logvalue"	" = \.TRUE\."