public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "tuliom at ascii dot art.br" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/30457] New: Unexpected sign extension during conversions
Date: Wed, 17 May 2023 14:49:48 +0000	[thread overview]
Message-ID: <bug-30457-4717@http.sourceware.org/bugzilla/> (raw)

https://sourceware.org/bugzilla/show_bug.cgi?id=30457

            Bug ID: 30457
           Summary: Unexpected sign extension during conversions
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: tuliom at ascii dot art.br
  Target Milestone: ---

Reproducer:

$ cat test-gdb-print.c 
#include <stdio.h>

int
main()
{
  unsigned long foo = 0x00007fffffffe8f8;
  unsigned long * bar = &foo;

  printf("*bar = 0x%lx\n", *bar);

  return 0;
}
$ gcc -g test-gdb-print.c
$ gdb a.out
>>> b test-gdb-print.c:9
Breakpoint 1 at 0x401144: file test-gdb-print.c, line 9.
>>> r
>>> p /x *bar
$1 = 0x7fffffffe8f8         <--- OK, this is what we expect.
>>> p /x bar
$2 = 0x7fffffffda40
>>> p /x (unsigned long) *0x7fffffffda40
$3 = 0xffffffffffffe8f8     <--- The value got sign extended.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

             reply	other threads:[~2023-05-17 14:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-17 14:49 tuliom at ascii dot art.br [this message]
2023-05-17 15:42 ` [Bug gdb/30457] " tromey at sourceware dot org
2023-05-17 16:24 ` schwab@linux-m68k.org

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=bug-30457-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).