[review] Propagate endianity to subrange types

Message ID gerrit.1574880479000.I2998ab919dc28aeff097763c4242f9bfb90823a3@gnutoolchain-gerrit.osci.io
State New, archived
Headers

Commit Message

Simon Marchi (Code Review) Nov. 27, 2019, 6:48 p.m. UTC
  Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/730
......................................................................

Propagate endianity to subrange types

A subrange type should inherit its endianity from its base type.

gdb/ChangeLog
2019-11-27  Tom Tromey  <tromey@adacore.com>

	* gdbtypes.c (create_range_type): Inherit endianity
	from base type.

Change-Id: I2998ab919dc28aeff097763c4242f9bfb90823a3
---
M gdb/ChangeLog
M gdb/gdbtypes.c
2 files changed, 8 insertions(+), 0 deletions(-)
  

Comments

Simon Marchi (Code Review) Nov. 27, 2019, 10:09 p.m. UTC | #1
Simon Marchi has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/730
......................................................................


Patch Set 1:

Does this fix a theoretical problem, or does this fix a test failure?
  
Simon Marchi (Code Review) Dec. 4, 2019, 2:27 p.m. UTC | #2
Tom Tromey has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/730
......................................................................


Patch Set 1:

> Patch Set 1:
> 
> Does this fix a theoretical problem, or does this fix a test failure?

We had an internal test that needed this.  I should have added it to this
patch, sorry.  I've done that now.

I'm going to send an updated series momentarily.  It fixes all the review
comments, other than the couple I replied to where I think it doesn't make
sense to make a change.
  
Simon Marchi (Code Review) Dec. 4, 2019, 3:46 p.m. UTC | #3
Simon Marchi has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/730
......................................................................


Patch Set 2: Code-Review+2
  

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 58f7f46..590ad25 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@ 
 2019-11-27  Tom Tromey  <tromey@adacore.com>
 
+	* gdbtypes.c (create_range_type): Inherit endianity
+	from base type.
+
+2019-11-27  Tom Tromey  <tromey@adacore.com>
+
 	* ada-lang.c (decode_constrained_packed_array)
 	(ada_value_assign, value_assign_to_component): Update.
 	* dwarf2loc.c (rw_pieced_value, access_memory)
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 31bfa47..c4e49ef 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -945,6 +945,9 @@ 
   if (high_bound->kind == PROP_CONST && high_bound->data.const_val < 0)
     TYPE_UNSIGNED (result_type) = 0;
 
+  TYPE_ENDIANITY_NOT_DEFAULT (result_type)
+    = TYPE_ENDIANITY_NOT_DEFAULT (index_type);
+
   return result_type;
 }