[Bug default/32902] New: make abidiff recognize harmless size increase of union data members
dodji at seketeli dot org
sourceware-bugzilla@sourceware.org
Thu Apr 24 11:34:45 GMT 2025
https://sourceware.org/bugzilla/show_bug.cgi?id=32902
Bug ID: 32902
Summary: make abidiff recognize harmless size increase of union
data members
Product: libabigail
Version: unspecified
Status: NEW
Severity: enhancement
Priority: P2
Component: default
Assignee: unassigned at sourceware dot org
Reporter: dodji at seketeli dot org
CC: libabigail at sourceware dot org
Target Milestone: ---
Consider this test case:
$ cat test-v0.c
#include <stdint.h>
struct s1
{
uint64_t m0;
union
{
struct
{
uint32_t e0;
uint32_t e1;
};
char pad[32];
} m1;
};
struct s1 global_var;
$
$ cat test-v1.c
#include <stdint.h>
struct s1
{
uint64_t m0;
union
{
struct
{
uint32_t e0;
uint32_t e1;
uint64_t added_e2;
uint32_t added_e3;
};
char pad[32];
} m1;
};
struct s1 global_var;
dodji@ablode:glibc-changed-test$ diff -u test-v0.c test-v1.c
--- test-v0.c 2025-04-24 12:12:59.710185175 +0200
+++ test-v1.c 2025-04-24 12:12:52.182163451 +0200
@@ -9,6 +9,8 @@
{
uint32_t e0;
uint32_t e1;
+ uint64_t added_e2;
+ uint32_t added_e3;
};
char pad[32];
} m1;
$
$ abidiff test-v0.o test-v1.o
Functions changes summary: 0 Removed, 0 Changed, 0 Added function
Variables changes summary: 0 Removed, 1 Changed, 0 Added variable
1 Changed variable:
[C] 's1 global_var' was changed at test-v1.c:19:1:
type of variable changed:
type size hasn't changed
1 data member change:
type of 'union {struct {uint32_t e0; uint32_t e1;}; char pad[32];}
m1' changed:
type size hasn't changed
1 data member change:
anonymous data member at offset 0 (in bits) changed from:
struct {uint32_t e0; uint32_t e1;}
to:
struct {uint32_t e0; uint32_t e1; uint64_t added_e2; uint32_t
added_e3;}
and size changed from 64 to 192 (in bits) (by +128 bits)
$
In this example, we see that adding two data member at the end of the anonymous
struct member of the union doesn't change the layout of the union and thus,
doesn't change the layout of the struct s1. So this change should be
categorized as harmless by abidiff.
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Libabigail
mailing list