Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Aditya Kamath1 <Aditya.Kamath1@ibm.com>
To: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>,
	"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Cc: Sangamesh Mallayya <sangamesh.swamy@in.ibm.com>
Subject: Re: [PATCH]-Change gdb.base/examine-backwards.exp testcase for AIX
Date: Mon, 6 Nov 2023 12:08:03 +0000	[thread overview]
Message-ID: <CH2PR15MB3544C728EF8A2C9DB67F49EFD6AAA@CH2PR15MB3544.namprd15.prod.outlook.com> (raw)
In-Reply-To: <a611599a0ebc4ab6625258f554bcdf833ea34f0e.camel@de.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 3653 bytes --]

Hi Ulrich and community members,

>I assume the existing dummy assignment
 > int dummy = Barrier[0] + TestStrings[0] + TestStringsH[0] + TestStringsW[0];
> is optimized out on AIX for some reason?

> Does it work if you move "dummy" to be global variable,
> and/or make the Barrier and TestStrings* variable non-const?

Yes Ulrich. It works if we make variables non-const. Kindly see the output below.

gmake check RUNTESTFLAGS='gdb.base/examine-backward.exp CC_FOR_TARGET="/opt/freeware/bin/gcc" CXX_FOR_TARGET="/opt/freeware/bin/g++" CXXFLAGS_FOR_TARGET="-O0 -w -g -gdwarf -maix64" CFLAGS_FOR_TARGET="-O0 -w -g -gdwarf -maix64"'
gmake check-single……….
(gdb) set charset ASCII
(gdb) set print elements 20
(gdb) x/6s &TestStrings
0x110000158 <TestStrings>:      "ABCDEFGHIJKLMNOPQRST"...
0x11000016c <TestStrings+20>:   "UVWXYZ"
0x110000173 <TestStrings+27>:   ""
0x110000174 <TestStrings+28>:   ""
0x110000175 <TestStrings+29>:   "\343\201\273\343\201\222\343\201\273\343\201\222"
0x110000182 <TestStrings+42>:   "01234567890123456789"...
(gdb) x/-1xb…………………
                === gdb Summary ===

# of expected passes            70
# of unsupported tests          1

So shall we remove this const and create the git patch?

Please see the diff pasted below.

Thanks and regards,
Aditya.

diff --git a/gdb/testsuite/gdb.base/examine-backward.c b/gdb/testsuite/gdb.base/examine-backward.c
index 995dc6a0b78..354c2e2f323 100644
--- a/gdb/testsuite/gdb.base/examine-backward.c
+++ b/gdb/testsuite/gdb.base/examine-backward.c
@@ -36,11 +36,11 @@ literals.  The content of each array is the same as followings:
    TestStrings, to avoid showing garbage when we look for strings
    backwards from TestStrings.  */
-const unsigned char Barrier[] = {
+unsigned char Barrier[] = {
   0x00,
};
-const unsigned char TestStrings[] = {
+unsigned char TestStrings[] = {
   0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
   0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50,
   0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
@@ -54,7 +54,7 @@ const unsigned char TestStrings[] = {
   0x00
};
-const short TestStringsH[] = {
+short TestStringsH[] = {
   0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048,
   0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050,
   0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058,
@@ -67,7 +67,7 @@ const short TestStringsH[] = {
   0x0000
};
-const int TestStringsW[] = {
+int TestStringsW[] = {
   0x00000041, 0x00000042, 0x00000043, 0x00000044,
   0x00000045, 0x00000046, 0x00000047, 0x00000048,
   0x00000049, 0x0000004a, 0x0000004b, 0x0000004c,
From: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
Date: Monday, 6 November 2023 at 5:26 PM
To: gdb-patches@sourceware.org <gdb-patches@sourceware.org>, Aditya Kamath1 <Aditya.Kamath1@ibm.com>
Cc: Sangamesh Mallayya <sangamesh.swamy@in.ibm.com>
Subject: Re: [PATCH]-Change gdb.base/examine-backwards.exp testcase for AIX
Aditya Kamath1 <Aditya.Kamath1@ibm.com> wrote:

>Kindly let me know what you think. I know that we have some dummy variables
>that is used to negate a similar problem using clang with lto. But if we
>can produce something that works for both AIX GCC and other targets Clang
>with LTO it will be great, and we can create a patch.

I assume the existing dummy assignment
  int dummy = Barrier[0] + TestStrings[0] + TestStringsH[0] + TestStringsW[0];
is optimized out on AIX for some reason?

Does it work if you move "dummy" to be global variable,
and/or make the Barrier and TestStrings* variable non-const?

Bye,
Ulrich

[-- Attachment #2: Type: text/html, Size: 11573 bytes --]

  reply	other threads:[~2023-11-06 12:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-06 11:02 Aditya Kamath1
2023-11-06 11:56 ` Ulrich Weigand
2023-11-06 12:08   ` Aditya Kamath1 [this message]
2023-11-06 13:07     ` Ulrich Weigand
2023-11-06 13:28       ` Aditya Kamath1
2023-11-06 14:03         ` Ulrich Weigand
2023-11-06 14:18           ` Aditya Kamath1

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CH2PR15MB3544C728EF8A2C9DB67F49EFD6AAA@CH2PR15MB3544.namprd15.prod.outlook.com \
    --to=aditya.kamath1@ibm.com \
    --cc=Ulrich.Weigand@de.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=sangamesh.swamy@in.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox