[applied] Bug 27985 - abidiff: bad array types in report
Commit Message
Hello,
Reporting the change in array type exhibits a glitch in the type name.
As the bug report says:
The resulting abidiff output contains:
type of 'int numbers[2]' changed:
type name changed from 'void[2]' to 'void[3]'
array type size changed from 64 to 96
array type subrange 1 changed length from 2 to 3
instead of
type of 'int numbers[2]' changed:
type name changed from 'int[2]' to 'int[3]'
array type size changed from 64 to 96
array type subrange 1 changed length from 2 to 3
The problem comes from array_type_def::get_qualified_name() where we
fail to generate a "new" qualified name once the type of the array is
canonicalized.
Fixed thus.
* src/abg-ir.cc (array_type_def::get_qualified_name): Use the
cache for temporary qualified names when the type is not yet
canonicalized. That way, the cache for (non-temporary) qualified
names is used only for canonicalized types.
* tests/data/test-abidiff/test-PR27985-report.txt: Reference
output for the new test.
* tests/data/test-abidiff/test-PR27985-v{0,1}.c: Source code for
the new test binary inputs.
* tests/data/test-abidiff/test-PR27985-v{0,1}.o: New test binary inputs.
* tests/data/test-abidiff/test-PR27985-v{0,1}.o.abi: New test
abixml input.
* tests/data/Makefile.am: Add the new test materials above to
source distribution.
* tests/test-abidiff.cc (specs): Add the tests above to the harness.
* tests/data/test-diff-pkg/nss-3.23.0-1.0.fc23.x86_64-report-0.txt:
Adjust.
* tests/data/test-abidiff-exit/qualifier-typedef-array-report-1.txt:
Adjust.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Applied to master.
---
src/abg-ir.cc | 7 +++--
tests/data/Makefile.am | 7 +++++
.../qualifier-typedef-array-report-1.txt | 16 ++++++----
.../data/test-abidiff/test-PR27985-report.txt | 19 ++++++++++++
tests/data/test-abidiff/test-PR27985-v0.c | 11 +++++++
tests/data/test-abidiff/test-PR27985-v0.o | Bin 0 -> 3152 bytes
tests/data/test-abidiff/test-PR27985-v0.o.abi | 29 ++++++++++++++++++
tests/data/test-abidiff/test-PR27985-v1.c | 11 +++++++
tests/data/test-abidiff/test-PR27985-v1.o | Bin 0 -> 3152 bytes
tests/data/test-abidiff/test-PR27985-v1.o.abi | 29 ++++++++++++++++++
.../nss-3.23.0-1.0.fc23.x86_64-report-0.txt | 2 +-
tests/test-abidiff.cc | 6 ++++
12 files changed, 127 insertions(+), 10 deletions(-)
create mode 100644 tests/data/test-abidiff/test-PR27985-report.txt
create mode 100644 tests/data/test-abidiff/test-PR27985-v0.c
create mode 100644 tests/data/test-abidiff/test-PR27985-v0.o
create mode 100644 tests/data/test-abidiff/test-PR27985-v0.o.abi
create mode 100644 tests/data/test-abidiff/test-PR27985-v1.c
create mode 100644 tests/data/test-abidiff/test-PR27985-v1.o
create mode 100644 tests/data/test-abidiff/test-PR27985-v1.o.abi
@@ -16880,9 +16880,10 @@ array_type_def::get_qualified_name(bool internal) const
}
else
{
- set_qualified_name(env->intern(get_type_representation
- (*this, /*internal=*/false)));
- return decl_base::peek_qualified_name();
+ set_temporary_qualified_name(env->intern(get_type_representation
+ (*this,
+ /*internal=*/false)));
+ return decl_base::peek_temporary_qualified_name();
}
}
}
@@ -91,6 +91,13 @@ test-abidiff/test-crc-0.xml \
test-abidiff/test-crc-1.xml \
test-abidiff/test-crc-2.xml \
test-abidiff/test-crc-report.txt \
+test-abidiff/test-PR27985-report.txt \
+test-abidiff/test-PR27985-v0.c \
+test-abidiff/test-PR27985-v0.o \
+test-abidiff/test-PR27985-v0.o.abi \
+test-abidiff/test-PR27985-v1.c \
+test-abidiff/test-PR27985-v1.o \
+test-abidiff/test-PR27985-v1.o.abi \
\
test-abidiff-exit/test1-voffset-change-report0.txt \
test-abidiff-exit/test1-voffset-change-report1.txt \
@@ -13,12 +13,14 @@ Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
array element type 'void*' changed:
entity changed from 'void*' to 'void* const'
type size hasn't changed
+ type name changed from 'void*[7]' to 'void* const[7]'
type size hasn't changed
type of 'A v_a' changed:
entity changed from 'typedef A' to compatible type 'void* volatile[7]'
array element type 'void*' changed:
entity changed from 'void*' to 'void* volatile'
type size hasn't changed
+ type name changed from 'void*[7]' to 'void* volatile[7]'
type size hasn't changed
type of 'A r_a' changed:
entity changed from 'typedef A' to compatible type 'void*[7]'
@@ -29,6 +31,7 @@ Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
array element type 'void*' changed:
entity changed from 'void*' to 'void* const'
type size hasn't changed
+ type name changed from 'void*[7]' to 'void* const[7]'
type size hasn't changed
type of 'B v_b' changed:
typedef name changed from B to A at qualifier-typedef-array-v1.c:1:1
@@ -37,6 +40,7 @@ Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
array element type 'void*' changed:
entity changed from 'void*' to 'void* volatile'
type size hasn't changed
+ type name changed from 'void*[7]' to 'void* volatile[7]'
type size hasn't changed
type of 'B r_b' changed:
typedef name changed from B to A at qualifier-typedef-array-v1.c:1:1
@@ -46,36 +50,36 @@ Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
entity changed from 'typedef C' to compatible type 'const volatile void* const[7]'
array element type 'void* const' changed:
'void* const' changed to 'const volatile void* const'
- type name changed from 'void*[7]' to 'volatile void* const[7]'
+ type name changed from 'void* const[7]' to 'volatile void* const[7]'
type size hasn't changed
type of 'C r_c' changed:
entity changed from 'typedef C' to compatible type 'restrict void* const[7]'
array element type 'void* const' changed:
'void* const' changed to 'restrict const void* const'
- type name changed from 'void*[7]' to 'restrict void* const[7]'
+ type name changed from 'void* const[7]' to 'restrict void* const[7]'
type size hasn't changed
type of 'D v_d' changed:
entity changed from 'typedef D' to compatible type 'const volatile void* const[7]'
array element type 'void* const' changed:
'void* const' changed to 'const volatile void* const'
- type name changed from 'void*[7]' to 'volatile void* const[7]'
+ type name changed from 'void* const[7]' to 'volatile void* const[7]'
type size hasn't changed
type of 'D r_d' changed:
entity changed from 'typedef D' to compatible type 'restrict void* const[7]'
array element type 'void* const' changed:
'void* const' changed to 'restrict const void* const'
- type name changed from 'void*[7]' to 'restrict void* const[7]'
+ type name changed from 'void* const[7]' to 'restrict void* const[7]'
type size hasn't changed
type of 'E r_e' changed:
entity changed from 'typedef E' to compatible type 'restrict const volatile void* const[7]'
array element type 'const volatile void* const' changed:
'const volatile void* const' changed to 'restrict const volatile volatile void* const'
- type name changed from 'volatile void* const[7]' to 'restrict volatile void* const[7]'
+ type name changed from 'volatile void* const[7]' to 'restrict const volatile void* const[7]'
type size hasn't changed
type of 'F r_f' changed:
entity changed from 'typedef F' to compatible type 'restrict const volatile void* const[7]'
array element type 'const volatile void* const' changed:
'const volatile void* const' changed to 'restrict const volatile volatile void* const'
- type name changed from 'volatile void* const[7]' to 'restrict volatile void* const[7]'
+ type name changed from 'volatile void* const[7]' to 'restrict const volatile void* const[7]'
type size hasn't changed
new file mode 100644
@@ -0,0 +1,19 @@
+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 foo(node*)' has some indirect sub-type changes:
+ parameter 1 of type 'node*' has sub-type changes:
+ in pointed to type 'struct node':
+ type size hasn't changed
+ 1 data member change:
+ type of 'leaf* ptr' changed:
+ in pointed to type 'struct leaf':
+ type size changed from 64 to 96 (in bits)
+ 1 data member change:
+ type of 'int numbers[2]' changed:
+ type name changed from 'int[2]' to 'int[3]'
+ array type size changed from 64 to 96
+ array type subrange 1 changed length from 2 to 3
+
new file mode 100644
@@ -0,0 +1,11 @@
+struct leaf
+{
+ int numbers[2];
+};
+
+struct node
+{
+ struct leaf* ptr;
+};
+
+void foo(struct node *n) { (void) n; }
new file mode 100644
GIT binary patch
literal 3152
zcmbVO&2Jl35P#1be<a&DPF!fyfU-e_wg|631dWp_#SoD?fT}7|5ge+pwx8_<d)Hd8
zBe#G+91szgA~<m1zyTpHh)Nu|a6m%pxhKRwz#qU32??0leY0LaITCavznS^X{NBvI
zujKugUfoM@&PX`B$|fG6jOEf3yB3%=_6R%8Zq|=~uOGkn=iOVsd=GGv@eD>a93ICZ
zE_%!fits%^<`Cst8f}>277VY!FNFhV=}b^LGncd-KWr`aE=1-Bz6Zr}Xfu{DVOVIp
zF5`MCKwzM9{L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YY6-;`XekFT*>e*hTHNqvGD$a#5L;c1-`
zs!#eIh|c1FCix#su_xb3{7+8c=jDN<ca)|f9_h~|pW>unR1dTa5RdY{1_SqH>TLqQ
zF8S)Z(E1VoCophMl|PpJDkVy-@_z(;*8Y{`gFxpT_b&%O;uAirHkP_4>;Hxh2>hEE
ja8*8@iCIhaF*XIV6sl-c*KZjjv-ow{|NV#=8Y=%^XX)$~
literal 0
HcmV?d00001
new file mode 100644
@@ -0,0 +1,29 @@
+<abi-corpus version='2.0' path='test-v0.o' architecture='elf-amd-x86_64'>
+ <elf-function-symbols>
+ <elf-symbol name='foo' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+ </elf-function-symbols>
+ <abi-instr address-size='64' path='test-v0.c' comp-dir-path='/home/dodji/git/libabigail/fixes/prtests/PR27985' language='LANG_C11'>
+ <type-decl name='int' size-in-bits='32' id='type-id-1'/>
+ <array-type-def dimensions='1' type-id='type-id-1' size-in-bits='64' id='type-id-2'>
+ <subrange length='2' type-id='type-id-3' id='type-id-4'/>
+ </array-type-def>
+ <type-decl name='unsigned long int' size-in-bits='64' id='type-id-3'/>
+ <type-decl name='void' id='type-id-5'/>
+ <class-decl name='leaf' size-in-bits='64' is-struct='yes' visibility='default' filepath='/home/dodji/git/libabigail/fixes/prtests/PR27985/test-v0.c' line='1' column='1' id='type-id-6'>
+ <data-member access='public' layout-offset-in-bits='0'>
+ <var-decl name='numbers' type-id='type-id-2' visibility='default' filepath='/home/dodji/git/libabigail/fixes/prtests/PR27985/test-v0.c' line='3' column='1'/>
+ </data-member>
+ </class-decl>
+ <class-decl name='node' size-in-bits='64' is-struct='yes' visibility='default' filepath='/home/dodji/git/libabigail/fixes/prtests/PR27985/test-v0.c' line='6' column='1' id='type-id-7'>
+ <data-member access='public' layout-offset-in-bits='0'>
+ <var-decl name='ptr' type-id='type-id-8' visibility='default' filepath='/home/dodji/git/libabigail/fixes/prtests/PR27985/test-v0.c' line='8' column='1'/>
+ </data-member>
+ </class-decl>
+ <pointer-type-def type-id='type-id-6' size-in-bits='64' id='type-id-8'/>
+ <pointer-type-def type-id='type-id-7' size-in-bits='64' id='type-id-9'/>
+ <function-decl name='foo' mangled-name='foo' filepath='/home/dodji/git/libabigail/fixes/prtests/PR27985/test-v0.c' line='11' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='foo'>
+ <parameter type-id='type-id-9' name='n' filepath='/home/dodji/git/libabigail/fixes/prtests/PR27985/test-v0.c' line='11' column='1'/>
+ <return type-id='type-id-5'/>
+ </function-decl>
+ </abi-instr>
+</abi-corpus>
new file mode 100644
@@ -0,0 +1,11 @@
+struct leaf
+{
+ int numbers[3];
+};
+
+struct node
+{
+ struct leaf* ptr;
+};
+
+void foo(struct node *n) { (void) n; }
new file mode 100644
GIT binary patch
literal 3152
zcmbVO&2Jk;6rb_Nv6D?4Cl0h}Kv^S7TZGrK1&y03#mJ&@0993_3WQX`+8)~r_S#yn
zBe#eTaX?hP6sZRe95^8L2pmu^9FUMWbEE%2{{U`C9N@k2JnwqsNYIgX-h03Ie)HaZ
z+MmAu*3}s2j2dTGSZEQ-SUM5vWvQ0gQ*52xsNQ*8z4P&3_iq0BBfxRSljt?DdltKB
zGb4sfvc&fRnnRcy3DjYT_n><lzIp6oERmF{lXG#`3&yo2=RX10LO<{!T^e-=w4qyU
z_Iiw)^AdrM67p}pN6Q1>Db!+LwOLGH6wh!YWtzKLe%ZW~P4WylSD2Yi9)M=7^0TRo
zX>4t7t@5=*`V`c<%#75o3Bl$;rUc{1IX}oCZ9dBmGI>A}&ok4!Vj3yNl1ha&SpZ@(
zN?f%0s~ZHJ+rR|n)3-NpC^H_3jh%)vU&5lXUM81UYS_^PCxBAk02zna7eR8)|4uEV
zz%_>tlr6dZF}@XB84oLY@iS~;Vj7D){=(-m1H$*O-LNW!9jj2Vi*~^(ZWjyNJH?W9
z{!lcmsuL(ju5iK1b%UWN_FBRdzFP;=@$2oqQR!mt;>%X9#k^iaFmKqc34g#k!fCQj
z&udvjZ{W5(7!CJ05Q89hT(Ijb-|lrqzR_!Z;O1LykngxPr{=aCx07$WBQePLeGDGt
zuOAk7E|p&S|Aa7CsImP@W!E|nv%c^jrYu)Zo?#2rID9~a&Emhvb3Jy$vX5=K?trZm
ze*2K|QJQZqC6f2R`3&IrVUwHtS}OfTtg<|R6#~Za%pS*`V}JfL%L!XJ3x-P?tuPER
z*yI9*AZP|#n6k+*PB?}JTcVJO#5t`+>X{tiaQX2LPmcK_#7C=KRwE%Et#U1bN1iJ7
zw1y)O+nKSDl}wI2V0dA$VI1xywY*X&?>oxg)$r@eepkb9D!ZxSZz}t)lDJdRdT5TA
zS3asLE`37$a|*|JT!+ib#s>r&;hnL`3Q7`wtZd@x^;pV}HAd@X_TW}GaB3g}e=OUi
z1!5F1yWs>5vulF^vwhKV?1rcfTSu<f?14|}POavP<0-e}J6=mnQ#!6Ehyp1{MfgbC
z^<K9t;2p8OULb6^jk!VK)IU^q%NyE#zt<Oja7*P9?W3mebmb3%n%|R(O(5c$(Z10*
zWu;8cyR!A0nFSoN=w4$eofFifP3NBjC%zL;%E$AdkBRvx|4(Q{njVYi4DV|>5`*g3
z>Jldv0q-k9^rqpD9JW39^f9GFfe)k+c6uz{KOMv92MXK{sZ!Hpah|j4|5iN)#K-#a
ze(Ci$0Mo|=i2b3!YiLB89(x47S^0lg`QKMu%#W|Jp1%(mj!AWbD%)9gS>b7&YLuVk
zN8p{szpwb8O|iqd694WA{B?C8=^dqEh)43i;*+0bML*EWK|G544iwy%skaI2s^aVG
zLhDETpFzPfb^b{4OBAT2&VLB_to_?o4+5QY+`lw@#3y`KZcO!q%Kr!rXz(vla&<nQ
giCIhaB^Cv3Wh^GWzJ9CVnZ>WF`hS}+$BNGX7YMHFFaQ7m
literal 0
HcmV?d00001
new file mode 100644
@@ -0,0 +1,29 @@
+<abi-corpus version='2.0' path='test-v1.o' architecture='elf-amd-x86_64'>
+ <elf-function-symbols>
+ <elf-symbol name='foo' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+ </elf-function-symbols>
+ <abi-instr address-size='64' path='test-v1.c' comp-dir-path='/home/dodji/git/libabigail/fixes/prtests/PR27985' language='LANG_C11'>
+ <type-decl name='int' size-in-bits='32' id='type-id-1'/>
+ <array-type-def dimensions='1' type-id='type-id-1' size-in-bits='96' id='type-id-2'>
+ <subrange length='3' type-id='type-id-3' id='type-id-4'/>
+ </array-type-def>
+ <type-decl name='unsigned long int' size-in-bits='64' id='type-id-3'/>
+ <type-decl name='void' id='type-id-5'/>
+ <class-decl name='leaf' size-in-bits='96' is-struct='yes' visibility='default' filepath='/home/dodji/git/libabigail/fixes/prtests/PR27985/test-v1.c' line='1' column='1' id='type-id-6'>
+ <data-member access='public' layout-offset-in-bits='0'>
+ <var-decl name='numbers' type-id='type-id-2' visibility='default' filepath='/home/dodji/git/libabigail/fixes/prtests/PR27985/test-v1.c' line='3' column='1'/>
+ </data-member>
+ </class-decl>
+ <class-decl name='node' size-in-bits='64' is-struct='yes' visibility='default' filepath='/home/dodji/git/libabigail/fixes/prtests/PR27985/test-v1.c' line='6' column='1' id='type-id-7'>
+ <data-member access='public' layout-offset-in-bits='0'>
+ <var-decl name='ptr' type-id='type-id-8' visibility='default' filepath='/home/dodji/git/libabigail/fixes/prtests/PR27985/test-v1.c' line='8' column='1'/>
+ </data-member>
+ </class-decl>
+ <pointer-type-def type-id='type-id-6' size-in-bits='64' id='type-id-8'/>
+ <pointer-type-def type-id='type-id-7' size-in-bits='64' id='type-id-9'/>
+ <function-decl name='foo' mangled-name='foo' filepath='/home/dodji/git/libabigail/fixes/prtests/PR27985/test-v1.c' line='11' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='foo'>
+ <parameter type-id='type-id-9' name='n' filepath='/home/dodji/git/libabigail/fixes/prtests/PR27985/test-v1.c' line='11' column='1'/>
+ <return type-id='type-id-5'/>
+ </function-decl>
+ </abi-instr>
+</abi-corpus>
@@ -61,7 +61,7 @@
[C] 'const PRUint16 SSL_ImplementedCiphers[74]' was changed to 'const PRUint16 SSL_ImplementedCiphers[69]' at sslenum.c:51:1:
size of symbol changed from 148 to 138
type of variable changed:
- type name changed from 'PRUint16[74]' to 'const PRUint16[69]'
+ type name changed from 'const PRUint16[74]' to 'const PRUint16[69]'
array type size changed from 1184 to 1104
array type subrange 1 changed length from 74 to 69
@@ -140,6 +140,12 @@ static InOutSpec specs[] =
"data/test-abidiff/empty-report.txt",
"output/test-abidiff/empty-report.txt"
},
+ {
+ "data/test-abidiff/test-PR27985-v0.o.abi",
+ "data/test-abidiff/test-PR27985-v1.o.abi",
+ "data/test-abidiff/test-PR27985-report.txt",
+ "output/test-abidiff/test-PR27985-report.txt"
+ },
// This should be the last entry.
{0, 0, 0, 0}
};