Bug 29057 - [gcc-5 - gcc-8] FAIL: gdb.ada/dynamic-iface.exp: print local as interface
Summary: [gcc-5 - gcc-8] FAIL: gdb.ada/dynamic-iface.exp: print local as interface
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: ada (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: 13.1
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-04-13 05:59 UTC by Tom de Vries
Modified: 2022-05-23 13:47 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom de Vries 2022-04-13 05:59:16 UTC
On openSUSE Leap 15.3 I run into:
...
FAIL: gdb.ada/dynamic-iface.exp: print local as interface
FAIL: gdb.ada/dynamic-iface.exp: print local2 as interface
...

First in more detail:
...
(gdb) print obj^M
$1 = ()^M
(gdb) FAIL: gdb.ada/dynamic-iface.exp: print local as interface
...

This is using gcc 7.5.0.

Fails up until gcc 11, starts passing at gcc 12.
Comment 1 Tom de Vries 2022-04-13 06:00:20 UTC
Related question and xfail patch: https://sourceware.org/pipermail/gdb-patches/2022-March/187148.html
Comment 2 Tom de Vries 2022-05-13 05:55:39 UTC
Did bisect, starts passing at commit:
...
commit d0567dc0dbf92258aaea727b7b93a7d8bc954e33
Author: Pierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Date:   Thu Nov 9 10:24:45 2017 +0000

    [multiple changes]
    
    2017-11-09  Jerome Lambourg  <lambourg@adacore.com>
    
            * sigtramp-qnx.c: Fix obvious typo.
    
    2017-11-09  Doug Rupp  <rupp@adacore.com>
    
            * libgnarl/s-taprop__linux.adb (Monotonic_Clock): Minor reformatting.
    
    2017-11-09  Ed Schonberg  <schonberg@adacore.com>
    
            * sem_res.adb (Resolve): If expression is an entity whose type has
            implicit dereference, generate reference to it, because no reference is
            generated for an overloaded entity during analysis, given that its
            identity may not be known.
    
    2017-11-09  Javier Miranda  <miranda@adacore.com>
    
            * exp_disp.adb (Expand_Interface_Thunk): Replace substraction of
            offset-to-top field by addition.
            (Make_Secondary_DT): Initialize the offset-to-top field with a negative
            offset.
            * exp_ch3.adb (Build_Offset_To_Top_Function): Build functions that
            return a negative offset-to-top value.
            (Initialize_Tag): Invoke runtime services Set_Dynamic_Offset_To_Top and
            Set_Static_Offset_To_Top passing a negative offet-to-top value;
            initialize also the offset-to-top field with a negative offset.
            * libgnat/a-tags.adb (Base_Address): Displace the pointer by means of
            an addition since the offset-to-top field is now a negative value.
            (Displace): Displace the pointer to the object means of a substraction
            since it is now a negative value.
            (Set_Dynamic_Offset_to_top): Displace the pointer to the object by
            means of a substraction since it is now a negative value.
    
    2017-11-09  Eric Botcazou  <ebotcazou@adacore.com>
    
            * gnat1drv.adb (Gnat1drv): Call Errout.Finalize (Last_Call => True)
            before Errout.Output_Messages also in the case of compilation errors.
    
    2017-11-09  Javier Miranda  <miranda@adacore.com>
    
            * doc/gnat_ugn/the_gnat_compilation_model.rst (Interfacing with C++ at
            the Class Level): Fix error interfacing with C strings.
            * gnat_ugn.texi: Regenerate.
    
    2017-11-09  Jerome Lambourg  <lambourg@adacore.com>
    
            * system-qnx-aarch64.ads: Fix the priority constants.
            * s-osinte__qnx.ads: Fix constants for handling the locking protocols
            and scheduling.
            * s-osinte__qnx.adb: New file , prevents the use of priority 0 that
            corresponds to an idle priority on QNX.
    
    2017-11-09  Piotr Trojanek  <trojanek@adacore.com>
    
            * sem_prag.adb, sem_util.adb, sem_elab.adb: Fix minor typos in
            comments.
    
    From-SVN: r254566

 gcc/ada/ChangeLog                                  |  57 +++++++++++
 .../doc/gnat_ugn/the_gnat_compilation_model.rst    |   2 +-
 gcc/ada/exp_ch3.adb                                |  92 ++++++++---------
 gcc/ada/exp_disp.adb                               |  25 ++---
 gcc/ada/gnat1drv.adb                               |   2 +-
 gcc/ada/gnat_ugn.texi                              |   4 +-
 gcc/ada/libgnarl/s-osinte__qnx.adb                 | 109 +++++++++++++++++++++
 gcc/ada/libgnarl/s-osinte__qnx.ads                 |   9 +-
 gcc/ada/libgnarl/s-taprop__linux.adb               |   6 +-
 gcc/ada/libgnarl/s-taprop__posix.adb               |   6 +-
 gcc/ada/libgnat/a-tags.adb                         |   8 +-
 gcc/ada/libgnat/system-qnx-aarch64.ads             |  14 ++-
 gcc/ada/sem_elab.adb                               |   2 +-
 gcc/ada/sem_prag.adb                               |   6 +-
 gcc/ada/sem_res.adb                                |   9 +-
 gcc/ada/sem_util.adb                               |   2 +-
 gcc/ada/sigtramp-qnx.c                             |   6 +-
 17 files changed, 266 insertions(+), 93 deletions(-)
 create mode 100644 gcc/ada/libgnarl/s-osinte__qnx.adb
...
Comment 3 Tom de Vries 2022-05-13 06:08:39 UTC
(In reply to Tom de Vries from comment #0)
> This is using gcc 7.5.0.
> 
> Fails up until gcc 11, starts passing at gcc 12.

Looks like this was an arfefact of not having all the required packages installed and silently falling back to gcc 7.

The commit is present starting gcc-8, and I've confirmed using gcc's from (now all properly installed) installed packages.
Comment 4 Tom de Vries 2022-05-13 07:31:15 UTC
This fixes it:
...
$ git diff
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 8333671c48b..8833a19b4dc 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -6492,7 +6492,7 @@ ada_tag_value_at_base_address (struct value *obj)
       tem = value_cast (ptr_type, tem);
       offset_to_top = value_as_long (value_ind (tem));
     }
-  else if (offset_to_top > 0)
+  if (offset_to_top > 0)
     {
       /* OFFSET_TO_TOP used to be a positive value to be subtracted
         from the base address.  This was however incompatible with
...
Comment 5 Tom de Vries 2022-05-13 08:36:55 UTC
Poste patch: https://sourceware.org/pipermail/gdb-patches/2022-May/189023.html