public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug cli/7285] printing expression gives different result to executing equivalent statement
[not found] <bug-7285-4717@http.sourceware.org/bugzilla/>
@ 2024-01-09 18:50 ` ssbssa at sourceware dot org
0 siblings, 0 replies; only message in thread
From: ssbssa at sourceware dot org @ 2024-01-09 18:50 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=7285
Hannes Domani <ssbssa at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ssbssa at sourceware dot org
--- Comment #2 from Hannes Domani <ssbssa at sourceware dot org> ---
(In reply to dcoutts from comment #0)
> 6 lx = -(1 << 63);
> (gdb) n
> (gdb) p lx
> $2 = -2147483648
Isn't that undefined behavior?
gcc has this warning:
```
gdb_bug.c: In function 'main':
gdb_bug.c:6:12: warning: left shift count >= width of type
[-Wshift-count-overflow]
lx = -(1 << 63);
^~
```
And gdb also shows a warning nowadays:
```
(gdb) p (long) -(1 << 63)
warning: left shift count >= width of type
$1 = 0
```
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-01-09 18:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-7285-4717@http.sourceware.org/bugzilla/>
2024-01-09 18:50 ` [Bug cli/7285] printing expression gives different result to executing equivalent statement ssbssa at sourceware dot org
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).