]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - gdb/testsuite/ChangeLog
gdb/testsuite: Fix pretty-print.exp on big-endian platforms
authorAndreas Arnez <arnez@linux.ibm.com>
Tue, 1 Oct 2019 17:20:29 +0000 (19:20 +0200)
committerAndreas Arnez <arnez@linux.ibm.com>
Tue, 1 Oct 2019 17:20:29 +0000 (19:20 +0200)
commit53d666ecfbb18f836cd4cb9f1de7013e3d03f4df
treeae21c076815689fb97ed05c7d6db2b69e2a97fad
parentcd7c32c36ae53c00e9b0731c58de37dc28b88fb6
gdb/testsuite: Fix pretty-print.exp on big-endian platforms

The pretty-print test case fails on s390/s390x because it relies on a
little-endian representation of bit fields.  Little-endian architectures
typically allocate bit fields from least to most significant bit, but
big-endian architectures typically use the reverse order, allocating the
most significant bit first.  Thus the two bit fields in each of the test
case's unions overlap either in their lower or in their higher bits,
depending on the target's endianness:

    union {
      int three : 3;
      int four : 4;
    };

Now, when initializing 'three' with 3, 'four' will become 3 on little
endian targets, but 6 on big-endian targets, making it FAIL there.

Fix this by initializing the longer bit field instead and using an
all-ones bit pattern.  In this way the result does not depend on
endianness.  Use 'unsigned' instead of int for one of the bit fields in
each of the unions, to increase the variety of resulting values.

gdb/testsuite/ChangeLog:

* gdb.base/pretty-print.c (struct s1_t): Change fields 'three' and
'six' to unsigned.
(s1): Initialize fields 'four' and 'six' instead of 'three' and
'five'.  Use an all-ones bit pattern for each.
* gdb.base/pretty-print.exp: Adjust expected output of "print s1"
to its changed values.
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/pretty-print.c
gdb/testsuite/gdb.base/pretty-print.exp