Bug 27598 - abidiff mishandles union member functions
Summary: abidiff mishandles union member functions
Status: RESOLVED FIXED
Alias: None
Product: libabigail
Classification: Unclassified
Component: default (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Dodji Seketeli
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-17 21:59 UTC by Giuliano Procida
Modified: 2021-04-06 10:51 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed: 2021-03-30 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Giuliano Procida 2021-03-17 21:59:00 UTC
I was originally investigating "harmless union" changes when I managed to crash abidiff when adding member functions to unions.

SEGV #1

$ head ?.cc
==> 1.cc <==
union S {
  void bar() const { }
  int needed;
};
void fun(S s) { s.bar(); }

==> 2.cc <==
union S {
  void bar() const { }
};
void fun(S s) { s.bar(); }
$ for x in ?.cc; do g++ -Wall -Wextra -g -c $x; done
$ abidiff ?.o
Functions changes summary: 0 Removed, 2 Changed, 0 Added functions
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable

2 functions with some indirect sub-type change:

  [C] 'method void S::bar() const' at 2.cc:2:1 has some indirect sub-type changes:
Segmentation fault

SEGV #2

$ head ?.cc
==> 1.cc <==
union S {
  void bar() const { }
  int needed;
};
void fun(S s) { s.bar(); }

==> 2.cc <==
struct S {
  void bar() const { }
};
void fun(S s) { s.bar(); }
$ for x in ?.cc; do g++ -Wall -Wextra -g -c $x; done
$ abidiff ?.o
Functions changes summary: 0 Removed, 2 Changed, 0 Added functions
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable

2 functions with some indirect sub-type change:

  [C] 'method void S::bar() const' at 2.cc:2:1 has some indirect sub-type changes:
Segmentation fault
Comment 1 Dodji Seketeli 2021-04-06 10:51:42 UTC
A fix for this has been applied to master at https://sourceware.org/git/?p=libabigail.git;a=commit;h=2f8e1db0e7a163eda943001703d9fa0ecfad2806.

It should be available in libabigail 2.0.

Thanks for filling this problem report.