public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/19423] __int128  conversion towards "const __int128 &" should be allowed
       [not found] <bug-19423-4717@http.sourceware.org/bugzilla/>
@ 2023-03-01 21:51 ` tromey at sourceware dot org
  2023-12-30 16:10 ` ssbssa at sourceware dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 4+ messages in thread
From: tromey at sourceware dot org @ 2023-03-01 21:51 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |20991
                 CC|                            |tromey at sourceware dot org


Referenced Bugs:

https://sourceware.org/bugzilla/show_bug.cgi?id=20991
[Bug 20991] __int128 type support
-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug gdb/19423] __int128  conversion towards "const __int128 &" should be allowed
       [not found] <bug-19423-4717@http.sourceware.org/bugzilla/>
  2023-03-01 21:51 ` [Bug gdb/19423] __int128 conversion towards "const __int128 &" should be allowed tromey at sourceware dot org
@ 2023-12-30 16:10 ` ssbssa at sourceware dot org
  2024-03-20 17:25 ` cvs-commit at gcc dot gnu.org
  2024-03-20 17:26 ` ssbssa at sourceware dot org
  3 siblings, 0 replies; 4+ messages in thread
From: ssbssa at sourceware dot org @ 2023-12-30 16:10 UTC (permalink / raw)
  To: gdb-prs

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

Hannes Domani <ssbssa at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ssbssa at sourceware dot org

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug gdb/19423] __int128  conversion towards "const __int128 &" should be allowed
       [not found] <bug-19423-4717@http.sourceware.org/bugzilla/>
  2023-03-01 21:51 ` [Bug gdb/19423] __int128 conversion towards "const __int128 &" should be allowed tromey at sourceware dot org
  2023-12-30 16:10 ` ssbssa at sourceware dot org
@ 2024-03-20 17:25 ` cvs-commit at gcc dot gnu.org
  2024-03-20 17:26 ` ssbssa at sourceware dot org
  3 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-03-20 17:25 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Hannes Domani <ssbssa@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d391f3721e20d160909a3afae7fee647ea5575a2

commit d391f3721e20d160909a3afae7fee647ea5575a2
Author: Hannes Domani <ssbssa@yahoo.de>
Date:   Wed Mar 20 18:23:40 2024 +0100

    Fix casting in-memory values of primitive types to const reference

    It's currently not possible to cast an in-memory value of a primitive
    type to const reference:
    ```
    (gdb) p Q.id
    $1 = 42
    (gdb) p (int&)Q.id
    $2 = (int &) @0x22fd0c: 42
    (gdb) p (const int&)Q.id
    Attempt to take address of value not located in memory.
    ```

    And if in a function call an argument needs the same kind of casting,
    it also doesn't work:
    ```
    (gdb) l f3
    39      int f3(const int &i)
    40      {
    41        return i;
    42      }
    (gdb) p f3(Q.id)
    Attempt to take address of value not located in memory.
    ```

    It's because when the constness of the type changes in a call to
    value_cast, a new not_lval value is allocated, which doesn't exist
    in the target memory.

    Fixed by ignoring const/volatile/restrict qualifications in
    value_cast when comparing cast type to original type, so the new
    value will point to the same location as the original value:
    ```
    (gdb) p (int&)i
    $2 = (int &) @0x39f72c: 1
    (gdb) p (const int&)i
    $3 = (const int &) @0x39f72c: 1
    (gdb) p f3(Q.id)
    $4 = 42
    ```

    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=19423
    Approved-By: Tom Tromey <tom@tromey.com>

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug gdb/19423] __int128  conversion towards "const __int128 &" should be allowed
       [not found] <bug-19423-4717@http.sourceware.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2024-03-20 17:25 ` cvs-commit at gcc dot gnu.org
@ 2024-03-20 17:26 ` ssbssa at sourceware dot org
  3 siblings, 0 replies; 4+ messages in thread
From: ssbssa at sourceware dot org @ 2024-03-20 17:26 UTC (permalink / raw)
  To: gdb-prs

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

Hannes Domani <ssbssa at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED
   Target Milestone|---                         |15.1

--- Comment #2 from Hannes Domani <ssbssa at sourceware dot org> ---
Fixed.

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-03-20 17:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-19423-4717@http.sourceware.org/bugzilla/>
2023-03-01 21:51 ` [Bug gdb/19423] __int128 conversion towards "const __int128 &" should be allowed tromey at sourceware dot org
2023-12-30 16:10 ` ssbssa at sourceware dot org
2024-03-20 17:25 ` cvs-commit at gcc dot gnu.org
2024-03-20 17:26 ` 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).