[Bug,default/28225] New: abidiff: false-positive ABI change detected in enum

Message ID bug-28225-9487@http.sourceware.org/bugzilla/
State New
Headers
Series [Bug,default/28225] New: abidiff: false-positive ABI change detected in enum |

Commit Message

fche at redhat dot com Aug. 13, 2021, 10:46 a.m. UTC
  https://sourceware.org/bugzilla/show_bug.cgi?id=28225

            Bug ID: 28225
           Summary: abidiff: false-positive ABI change detected in enum
           Product: libabigail
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: default
          Assignee: dodji at redhat dot com
          Reporter: dor.askayo at gmail dot com
                CC: libabigail at sourceware dot org
  Target Milestone: ---

Created attachment 13616
  --> https://sourceware.org/bugzilla/attachment.cgi?id=13616&action=edit
Minimal reproducer

abidiff detects a change in the order of enum values whose value is explicitly
set as harmful, even though their values remain the same and no other enum
value is affected by this change.

As far as I know, both ABI and API remains identical in such a case:

$ diff -U5 test-v0/test.h test-v1/test.h 

A minimal reproducer is attached:

$ gcc -g -Wall -shared -Wl,--build-id=none -o libtest-v0.so test-v0/test.c
$ gcc -g -Wall -shared -Wl,--build-id=none -o libtest-v1.so test-v1/test.c
$ abidiff --headers-dir1 test-v0 --headers-dir2 test-v1 libtest-v0.so
libtest-v1.so 
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 int foo(values)' at test.c:3:1 has some indirect sub-type
changes:
    parameter 1 of type 'enum values' has sub-type changes:
      type size hasn't changed

The issue was originally identified here:
https://gitlab.com/freedesktop-sdk/freedesktop-sdk/-/merge_requests/5380#note_629314574
  

Patch

--- test-v0/test.h      2021-08-13 13:38:16.331805249 +0300
+++ test-v1/test.h      2021-08-13 13:06:09.380240513 +0300
@@ -1,4 +1,4 @@ 
 enum values {
-       ENUM_VALUE1 = 1,
        ENUM_VALUE2 = 2,
+       ENUM_VALUE1 = 1,
 };