mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-15 22:44:41 +00:00
Fix off-by one comparison bug in comparing function parameters
* src/abg-comparison.cc (function_decl_diff::ensure_lookup_tables_populated): Function parameters that are diff'ed start at the first non-implicit parameter, not at the first parameter. Oops. * tests/data/test-diff-dwarf/test3-v0.o: New test input binary. * tests/data/test-diff-dwarf/test3-v0.cc: Source code for the binary above. * tests/data/test-diff-dwarf/test3-v1.o: New test input binary. * tests/data/test-diff-dwarf/test3-v1.cc: Source code for the binary above. * tests/data/test-diff-dwarf/test3-report.txt: Reference report for the diff of the new test inputs. * tests/test-diff-dwarf.cc: Use the test inputs above to run new tests. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
parent
712320ab4c
commit
6a57f61497
@ -4353,7 +4353,8 @@ function_decl_diff::ensure_lookup_tables_populated()
|
||||
i != priv_->parm_changes_.deletions().end();
|
||||
++i)
|
||||
{
|
||||
parm = deleted_parameter_at(i->index());
|
||||
parm = *(first_function_decl()->get_first_non_implicit_parm()
|
||||
+ i->index());
|
||||
parm_name = parm->get_name_id();
|
||||
// If for a reason the type name is empty we want to know and
|
||||
// fix that.
|
||||
@ -4372,7 +4373,7 @@ function_decl_diff::ensure_lookup_tables_populated()
|
||||
j != i->inserted_indexes().end();
|
||||
++j)
|
||||
{
|
||||
parm = inserted_parameter_at(*j);
|
||||
parm = *(second_function_decl()->get_first_non_implicit_parm() + *j);
|
||||
parm_name = parm->get_name_id();
|
||||
// If for a reason the type name is empty we want to know and
|
||||
// fix that.
|
||||
|
13
tests/data/test-diff-dwarf/test3-report.txt
Normal file
13
tests/data/test-diff-dwarf/test3-report.txt
Normal file
@ -0,0 +1,13 @@
|
||||
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]'method void C1::foo(C0&)' has some indirect sub-type changes:
|
||||
parameter 1 of type 'C0&' has sub-type changes:
|
||||
in referenced type 'struct C0':
|
||||
size changed from 32 to 64 bits
|
||||
1 data member insertion:
|
||||
'char C0::m1', at offset 32 (in bits)
|
||||
|
||||
|
19
tests/data/test-diff-dwarf/test3-v0.cc
Normal file
19
tests/data/test-diff-dwarf/test3-v0.cc
Normal file
@ -0,0 +1,19 @@
|
||||
struct C0
|
||||
{
|
||||
typedef int Int;
|
||||
Int m0;
|
||||
|
||||
C0()
|
||||
:m0(0)
|
||||
{}
|
||||
};
|
||||
|
||||
struct C1
|
||||
{
|
||||
void
|
||||
foo(C0&);
|
||||
};
|
||||
|
||||
void
|
||||
C1::foo(C0&)
|
||||
{}
|
BIN
tests/data/test-diff-dwarf/test3-v0.o
Normal file
BIN
tests/data/test-diff-dwarf/test3-v0.o
Normal file
Binary file not shown.
21
tests/data/test-diff-dwarf/test3-v1.cc
Normal file
21
tests/data/test-diff-dwarf/test3-v1.cc
Normal file
@ -0,0 +1,21 @@
|
||||
struct C0
|
||||
{
|
||||
typedef int Int;
|
||||
Int m0;
|
||||
char m1;
|
||||
|
||||
C0()
|
||||
:m0(0),
|
||||
m1(0)
|
||||
{}
|
||||
};
|
||||
|
||||
struct C1
|
||||
{
|
||||
void
|
||||
foo(C0&);
|
||||
};
|
||||
|
||||
void
|
||||
C1::foo(C0&)
|
||||
{}
|
BIN
tests/data/test-diff-dwarf/test3-v1.o
Normal file
BIN
tests/data/test-diff-dwarf/test3-v1.o
Normal file
Binary file not shown.
@ -74,6 +74,12 @@ InOutSpec in_out_specs[] =
|
||||
"data/test-diff-dwarf/test2-report.txt",
|
||||
"output/test-diff-dwarf/test2-report.txt"
|
||||
},
|
||||
{
|
||||
"data/test-diff-dwarf/test3-v0.o",
|
||||
"data/test-diff-dwarf/test3-v1.o",
|
||||
"data/test-diff-dwarf/test3-report.txt",
|
||||
"output/test-diff-dwarf/test3-report.txt"
|
||||
},
|
||||
// This should be the last entry
|
||||
{NULL, NULL, NULL, NULL}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user