public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
From: "dodji at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: libabigail@sourceware.org
Subject: [Bug default/21843] libabigail not correctly keeping track of nested scopes for typedefs
Date: Sun, 01 Jan 2017 00:00:00 -0000	[thread overview]
Message-ID: <bug-21843-9487-VXOJNgYrcs@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-21843-9487@http.sourceware.org/bugzilla/>

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

dodji at redhat dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED

--- Comment #4 from dodji at redhat dot com ---
> 1 Changed variable:
> 
>   [C]'std::vector<int, std::allocator<int> > var' was changed at test4.C:3:1:
>     type of variable changed:
>      type size hasn't changed
>      1 base class change:
>        'struct std::_Vector_base<int, std::allocator<int> >' at
> stl_vector.h:74:1 changed:
>          type size hasn't changed
>          1 data member change:
>           type of 'std::_Vector_base<int, std::allocator<int>
> >::_Vector_impl std::_Vector_base<int, std::allocator<int> >::_M_impl'
> changed:
>             type size hasn't changed
>             3 data member changes:
>              type of 'std::_Vector_base<int, std::allocator<int> >::pointer
> std::_Vector_base<int, std::allocator<int> >::_Vector_impl::_M_start'
> changed:
>                underlying type 'typedef
> __gnu_cxx::__alloc_traits<std::allocator<int> >::pointer' at
> alloc_traits.h:120:1 changed:
>                  underlying type 'typedef
> std::allocator_traits<std::allocator<int> >::pointer' at allocator.h:113:1
> changed:

[...]
           typedef name changed from
> std::allocator_traits<std::allocator<int> >::pointer to
> std::allocator<int>::pointer at allocator.h:113:1
> 

[...]

> To me this looks like:
> 1) libabigail is confused and is mistaking one type for another

Hmmh, I think it's just that libabigail is not going further enough in the
analysis.

I think there is a typedef name change, but it doesn't change the leaf
underlying type of the typedef.  In both cases, the typedef is for an 'int'. 
And that is what libabigail isn't taking into account.

So let's look at the DWARF of clang:

First, the typedef  __gnu_cxx::__alloc_traits<std::allocator<int> >::pointer is 
is represented by this DWARF:

[   8f0]        typedef
                 type                 (ref4) [   793]
                 name                 (strp) "pointer"

So the underlying type of  __gnu_cxx::__alloc_traits<std::allocator<int>
>::pointer is the type represented by the DIE 0x793.  And that DIE 0x793 is
actually std::allocator<int>::pointer, as we can see here at:

 [   74c]      class_type
               name                 (strp) "allocator<int>"
               byte_size            (data1) 1
               decl_file            (data1) 4
               decl_line            (data1) 108
[...]
 [   793]        typedef
                 type                 (ref4) [   b04]
                 name                 (strp) "pointer"

In GCC though, the typedef  __gnu_cxx::__alloc_traits<std::allocator<int>
>::pointer is is represented by this DWARF:

 [  1353]      structure_type
               name                 (strp) "__alloc_traits<std::allocator<int>
>"
               byte_size            (data1) 1
               decl_file            (data1) 16
               decl_line            (data1) 50
               sibling              (ref4) [  1454]
[...]

 [  138a]        typedef
                 name                 (strp) "pointer"
                 decl_file            (data1) 16
                 decl_line            (data1) 59
                 type                 (ref4) [   43a]


 [   410]      structure_type
               name                 (strp)
"allocator_traits<std::allocator<int> >"
               byte_size            (data1) 1
               decl_file            (data1) 4
               decl_line            (data2) 384
               sibling              (ref4) [   50b]
[...]
 [   43a]        typedef
                 name                 (strp) "pointer"
                 decl_file            (data1) 4  
                 decl_line            (data2) 392
                 type                 (ref4) [  16c6]

So in GCC, the underlying type of the typedef
__gnu_cxx::__alloc_traits<std::allocator<int> >::pointer is
"allocator_traits<std::allocator<int> >::pointer".

Note the difference in *typedef name* with clang.  With clang, the underlying
type of __gnu_cxx::__alloc_traits<std::allocator<int> >::pointer is
std::allocator<int>::pointer.

So libabigail is saying that "allocator_traits<std::allocator<int> >::pointer"
is a different typedef *name*, compared to "std::allocator<int>::pointer".

What it's failing to see is that both typedefs end up being just "int".

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

  parent reply	other threads:[~2017-07-27  9:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-01  0:00 [Bug default/21843] New: libabigail getting confused or possibly bad dwarf woodard at redhat dot com
2017-01-01  0:00 ` [Bug default/21843] " woodard at redhat dot com
2017-01-01  0:00 ` [Bug default/21843] libabigail not correctly keeping track of nested scopes for typedefs woodard at redhat dot com
2017-01-01  0:00 ` [Bug default/21843] libabigail getting confused or possibly bad dwarf woodard at redhat dot com
2017-01-01  0:00 ` [Bug default/21843] libabigail not correctly keeping track of nested scopes for typedefs woodard at redhat dot com
2017-01-01  0:00 ` woodard at redhat dot com
2017-01-01  0:00 ` woodard at redhat dot com
2017-01-01  0:00 ` woodard at redhat dot com
2017-01-01  0:00 ` woodard at redhat dot com
2017-01-01  0:00 ` woodard at redhat dot com
2017-01-01  0:00 ` dodji at redhat dot com [this message]
2017-01-01  0:00 ` woodard at redhat dot com
2021-12-01 23:29 ` woodard at redhat dot com

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-21843-9487-VXOJNgYrcs@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=libabigail@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).