[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug default/24731] abidiff: Incorrect ABI difference reporting for union changing order of members



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

dodji at redhat dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from dodji at redhat dot com ---
(In reply to Matthias Maennich from comment #0)
> Consider the following reproducer:
> 
> test1.c:
> 
>  union u { int a; char c; short s; };
> 
>  void test_func(union u var) {
>   (void) var;
>  }
> 
> test2.c:
>  
>  union u { int a; short s; char c; };
> 
>  void test_func(union u var) {
>   (void) var;
>  }
> 
> $ gcc -c -g test1.c test2.c && abidiff test1.o test2.o
> 
> Functions changes summary: 0 Removed, 1 Changed, 0 Added function
> Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
> 
> 1 function with some indirect sub-type change:
> 
>   [C]'function void short int(u)' at test2.c:3:1 has some indirect sub-type
> changes:
>     Please note that the exported symbol of this function is test_func
>     'function void short int(u) {test_func}' now becomes 'function void
> test_func(u) {test_func}'
>     parameter 1 of type 'union u' has sub-type changes:
>       type size hasn't changed
>       2 data member changes:
>        type of 'short int u::c' changed:
>          type name changed from 'short int' to 'test_func'
>          type size changed from 8 to 16 (in bits)
> 
>        type of 'short int u::s' changed:
>          type name changed from 'short int' to 'test_func'
>          type size changed from 8 to 16 (in bits)
> 
> 
> abigail incorrectly reports a difference.

With what we have in master[1], I couldn't reproduce the exact same output. 
Here is what I am seeing:

$ gcc -c -g test1.c test2.c && abidiff test1.o test2.o
Functions changes summary: 0 Removed, 1 Changed, 0 Added function
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable

1 function with some indirect sub-type change:

  [C]'function void test_func(u)' at test2.c:3:1 has some indirect sub-type
changes:
    parameter 1 of type 'union u' has sub-type changes:
      type size hasn't changed


So, abidiff is trying to show the (harmless) difference but for some reasons
(that I will elide for the sake of brevity) it falls flat trying to do so.  It
should rather show nothing, we do agree.

So to fix the issue I am seeing, I have committed
https://sourceware.org/git/gitweb.cgi?p=libabigail.git;a=commit;h=a11a0068ea333a5149aeed6bd92cb2c6b9523afa.

Now, abidiff should avoid showing any difference by default for that case.

[1]: the master commit I tried to reproduce with is:
bf100fc Fully account for anonymous-ness of scopes when comparing decl names.

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