public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
* [PATCH, applied] Bug 29811 - Better categorize harmless unknown array size changes
@ 2023-01-01 17:33 Dodji Seketeli
  0 siblings, 0 replies; only message in thread
From: Dodji Seketeli @ 2023-01-01 17:33 UTC (permalink / raw)
  To: libabigail

Hello,

Let's compile the code snippet:

$ echo "unsigned int is_basic_table[];" | gcc -g -c -o test-v0.o -x c -

Let's see what abidw sees from it:

$ abidw test-v0.o | cat -n

     1	<abi-corpus version='2.1' path='test-v0.o' architecture='elf-amd-x86_64'>
     2	  <elf-variable-symbols>
     3	    <elf-symbol name='is_basic_table' size='4' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
     4	  </elf-variable-symbols>
     5	  <abi-instr address-size='64' path='&lt;stdin&gt;' comp-dir-path='/home/dodji/git/libabigail/PR29811/prtests' language='LANG_C11'>
     6	    <type-decl name='unsigned int' size-in-bits='32' id='type-id-1'/>
     7	    <array-type-def dimensions='1' type-id='type-id-1' size-in-bits='infinite' id='type-id-2'>
     8	      <subrange length='infinite' id='type-id-3'/>
     9	    </array-type-def>
    10	    <var-decl name='is_basic_table' type-id='type-id-2' mangled-name='is_basic_table' visibility='default' filepath='/home/dodji/git/libabigail/PR29811/prtests/&lt;stdin&gt;' line='1' column='1' elf-symbol-id='is_basic_table'/>
    11	  </abi-instr>
    12	</abi-corpus>

See how the at line 7, the array type of ID 'type-id-2' has an unknown
size.  This is the type of the 'is_basic_table' variable defined at
line 10.  Note however that the symbol size of the is_basic_table
symbol is 4 bytes (32 bits).

Now, let's compile a similar code where the is_basic_table variable is
now initialized:

$ echo "unsigned int is_basic_table[] = {0};" | gcc -g -c -o test-v1.o -x c -

$ $ abidw test-v1.o | cat -n

     1	<abi-corpus version='2.1' path='test-v1.o' architecture='elf-amd-x86_64'>
     2	  <elf-variable-symbols>
     3	    <elf-symbol name='is_basic_table' size='4' type='object-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
     4	  </elf-variable-symbols>
     5	  <abi-instr address-size='64' path='&lt;stdin&gt;' comp-dir-path='/home/dodji/git/libabigail/PR29811/prtests' language='LANG_C11'>
     6	    <type-decl name='unsigned int' size-in-bits='32' id='type-id-1'/>
     7	    <array-type-def dimensions='1' type-id='type-id-1' size-in-bits='32' id='type-id-2'>
     8	      <subrange length='1' type-id='type-id-3' id='type-id-4'/>
     9	    </array-type-def>
    10	    <type-decl name='unsigned long int' size-in-bits='64' id='type-id-3'/>
    11	    <var-decl name='is_basic_table' type-id='type-id-2' mangled-name='is_basic_table' visibility='default' filepath='/home/dodji/git/libabigail/PR29811/prtests/&lt;stdin&gt;' line='1' column='1' elf-symbol-id='is_basic_table'/>
    12	  </abi-instr>
    13	</abi-corpus>

Now, see like at line 7, the array type is now of 4 bytes (32 bits).
Note that the size of is_basic_table is still 32 bits.

Normally, abidiff-ing test-v0 and test-v1 should tell us that the two
versions of the is_basic_table variable are compatible because
fundamentally the structure and the size of the ELF symbol
is_basic_table hasn't changed, even if in the first case, it's an
array of unknown size.  It's ELF symbol size was already 32 bits.

Here is what abidiff says:

$ 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] 'unsigned int is_basic_table[]' was changed to 'unsigned int is_basic_table[1]' at <stdin>:1:1:
    type of variable changed:
      type name changed from 'unsigned int[]' to 'unsigned int[1]'
      array type size changed from infinity to 32
      array type subrange 1 changed length from infinity to 1

$

This is because the comparison engine doesn't recognize we are looking
at a type change that is harmless because the ELF size hasn't changed
and because this is an array of one dimension so fundamentally, the
"meaning" of the type of the array hasn't fundamentally changed for
ABI-related purposes.

This patch teaches the diff node categorizer to recognise that we are
in a case where the (one dimension) array of unknown size actually is
the type of an array which symbol size is 4 bytes.  In the second
case, the one dimension array has a size of 4 bytes, just as its ELF
symbol size.  The diff node categorizer then categorizes the diff node
into the existing category BENIGN_INFINITE_ARRAY_CHANGE_CATEGORY,
which is a harmless diff node category.  Everything then falls into
place to filter the change out.  Also, the patch adapts the diff
reporter to better describe this type of harmless array variable type
changes.

The output then becomes:

$ abidiff test-v0.o test-v1.o
Functions changes summary: 0 Removed, 0 Changed, 0 Added function
Variables changes summary: 0 Removed, 0 Changed (1 filtered out), 0 Added variable

$

The change is filtered out.

To have details about the change that has been filtered out, one has
to use "--harmless" option:

$ abidiff --harmless 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] 'unsigned int is_basic_table[]' was changed to 'unsigned int is_basic_table[1]' at <stdin>:1:1:
    size of variable symbol ( 32 (in bits)) hasn't changed
    but it does have a harmless type change
    type of variable changed:
      type name changed from 'unsigned int[]' to 'unsigned int[1]'
      array type size changed from 'unknown' to 32
      array type subrange 1 changed length from 'unknown' to 1

$

	* include/abg-comp-filter.h
	(is_var_1_dim_unknown_size_array_change): Declare new function.
	* src/abg-comp-filter.cc (is_var_1_dim_unknown_size_array_change):
	Define new function.
	(has_benign_array_of_unknown_size_change): Rename
	has_benign_infinite_array_change into this.  Make this call the
	new is_var_1_dim_unknown_size_array_change.
	(categorize_harmless_diff_node): Adjust the call to
	has_benign_infinite_array_change into the new
	has_benign_array_of_unknown_size_change.
	* include/abg-ir.h (var_equals_modulo_types): Declare new
	function.  Make it friend of class decl_base.
	* src/abg-default-reporter.cc (default_reporter::report): In the
	overload for var_diff, call the new
	maybe_report_diff_for_variable.
	* src/abg-ir.cc (var_equals_modulo_types): Factorize this out of
	the equals() function for var_decl.
	(equals): In the overload for var_decl, call the new
	var_equals_modulo_types.
	* src/abg-reporter-priv.h (maybe_report_diff_for_variable):
	Declare new function.
	* src/abg-reporter-priv.cc (maybe_report_diff_for_variable):
	Define new function.
	* tests/data/test-diff-filter/test-PR29811-0-report-0.txt: Add
	new reference test output.
	* tests/data/test-diff-filter/test-PR29811-0-report-1.txt:
	Likewise.
	* tests/data/test-diff-filter/test-PR29811-0-v{0,1}.o: Add new
	binary test inputs.
	* tests/data/test-diff-filter/test-PR29811-0-v{0,1}.c: Add source
	code of the binary test inputs.
	* tests/data/Makefile.am: Add new test input files above to source
	distribution.
	* tests/test-diff-filter.cc (in_out_specs): Add new tests to
	harness.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
---
 include/abg-comp-filter.h                     |   7 ++
 include/abg-ir.h                              |   6 +
 src/abg-comp-filter.cc                        | 106 ++++++++++++++----
 src/abg-default-reporter.cc                   |   2 +
 src/abg-ir.cc                                 |  73 ++++++++----
 src/abg-reporter-priv.cc                      |  43 +++++++
 src/abg-reporter-priv.h                       |   7 ++
 tests/data/Makefile.am                        |   6 +
 .../test-PR29811-0-report-0.txt               |   3 +
 .../test-PR29811-0-report-1.txt               |  13 +++
 .../data/test-diff-filter/test-PR29811-0-v0.c |   1 +
 .../data/test-diff-filter/test-PR29811-0-v0.o | Bin 0 -> 2640 bytes
 .../data/test-diff-filter/test-PR29811-0-v1.c |   1 +
 .../data/test-diff-filter/test-PR29811-0-v1.o | Bin 0 -> 2648 bytes
 tests/test-diff-filter.cc                     |  14 +++
 15 files changed, 237 insertions(+), 45 deletions(-)
 create mode 100644 tests/data/test-diff-filter/test-PR29811-0-report-0.txt
 create mode 100644 tests/data/test-diff-filter/test-PR29811-0-report-1.txt
 create mode 100644 tests/data/test-diff-filter/test-PR29811-0-v0.c
 create mode 100644 tests/data/test-diff-filter/test-PR29811-0-v0.o
 create mode 100644 tests/data/test-diff-filter/test-PR29811-0-v1.c
 create mode 100644 tests/data/test-diff-filter/test-PR29811-0-v1.o

diff --git a/include/abg-comp-filter.h b/include/abg-comp-filter.h
index 92c34c6f..cd12b314 100644
--- a/include/abg-comp-filter.h
+++ b/include/abg-comp-filter.h
@@ -91,6 +91,13 @@ has_anonymous_data_member_change(const diff_sptr &d);
 bool
 has_data_member_replaced_by_anon_dm(const diff* diff);
 
+bool
+is_var_1_dim_unknown_size_array_change(const diff*);
+
+bool
+is_var_1_dim_unknown_size_array_change(const var_decl_sptr& var1,
+				       const var_decl_sptr& var2);
+
 struct filter_base;
 /// Convenience typedef for a shared pointer to filter_base
 typedef shared_ptr<filter_base> filter_base_sptr;
diff --git a/include/abg-ir.h b/include/abg-ir.h
index 93959e92..6f83cfb0 100644
--- a/include/abg-ir.h
+++ b/include/abg-ir.h
@@ -1694,6 +1694,9 @@ public:
   friend bool
   equals(const var_decl&, const var_decl&, change_kind*);
 
+  friend bool
+  var_equals_modulo_types(const var_decl&, const var_decl&, change_kind*);
+
   friend bool
   maybe_compare_as_member_decls(const decl_base& l,
 				const decl_base& r,
@@ -2874,6 +2877,9 @@ public:
 bool
 equals(const var_decl&, const var_decl&, change_kind*);
 
+bool
+var_equals_modulo_types(const var_decl&, const var_decl&, change_kind*);
+
 bool
 equals_modulo_cv_qualifier(const array_type_def*, const array_type_def*);
 
diff --git a/src/abg-comp-filter.cc b/src/abg-comp-filter.cc
index 67d8e719..83c406cf 100644
--- a/src/abg-comp-filter.cc
+++ b/src/abg-comp-filter.cc
@@ -633,6 +633,85 @@ has_data_member_replaced_by_anon_dm(const diff* diff)
   return !c->data_members_replaced_by_adms().empty();
 }
 
+/// Test if we are looking at two variables which types are both one
+/// dimension array, with one of them being of unknow size and the two
+/// variables having the same symbol size.
+///
+/// This can happen in the case of these two declarations, for instance:
+///
+///     unsigned int array[];
+///
+/// and:
+///
+///     unsigned int array[] ={0};
+///
+/// In both cases, the size of the ELF symbol of the variable 'array'
+/// is 32 bits, but, at least in the first case
+bool
+is_var_1_dim_unknown_size_array_change(const var_decl_sptr& var1,
+				       const var_decl_sptr& var2)
+{
+  type_base_sptr /*first type*/ft =
+    peel_qualified_or_typedef_type(var1->get_type());
+  type_base_sptr /*second type*/st =
+    peel_qualified_or_typedef_type(var2->get_type());
+
+  array_type_def_sptr /*first array type*/fat = is_array_type(ft);
+  array_type_def_sptr /*second array type*/sat = is_array_type(st);
+
+  // The types of the variables must be arrays.
+  if (!fat || !sat)
+    return false;
+
+  // The arrays must have one dimension and at least one of them must
+  // be of unknown size.
+  if (fat->get_subranges().size() != 1
+      || sat->get_subranges().size() != 1
+      || (!fat->is_infinite() && !sat->is_infinite()))
+    return false;
+
+  // The variables must be equal modulo their type.
+  if (!var_equals_modulo_types(*var1, *var2, nullptr))
+    return false;
+
+  // The symbols of the variables must be defined and of the same
+  // non-zero size.
+  if (!var1->get_symbol()
+      || !var2->get_symbol()
+      || var1->get_symbol()->get_size() != var2->get_symbol()->get_size())
+    return false;
+
+  return true;
+}
+
+/// Test if we are looking at a diff that carries a change of
+/// variables which types are both one dimension array, with one of
+/// them being of unknow size and the two variables having the same
+/// symbol size.
+///
+/// This can happen in the case of these two declarations, for instance:
+///
+///     unsigned int array[];
+///
+/// and:
+///
+///     unsigned int array[] ={0};
+///
+/// In both cases, the size of the ELF symbol of the variable 'array'
+/// is 32 bits, but, at least in the first case
+bool
+is_var_1_dim_unknown_size_array_change(const diff* diff)
+{
+  const var_diff* d = is_var_diff(diff);
+
+  if (!d)
+    return false;
+
+  var_decl_sptr f = d->first_var(), s = d->second_var();
+
+  return is_var_1_dim_unknown_size_array_change(f, s);
+}
+
 /// Test if a class_diff node has static members added or removed.
 ///
 /// @param diff the diff node to consider.
@@ -1652,30 +1731,9 @@ has_void_ptr_to_ptr_change(const diff* dif)
 ///
 /// @return true iff @p dif contains the benign array type size change.
 static bool
-has_benign_infinite_array_change(const diff* dif)
+has_benign_array_of_unknown_size_change(const diff* dif)
 {
-  if (const var_diff* var_dif = is_var_diff(dif))
-    {
-      if (!var_dif->first_var()->get_symbol()
-	  || var_dif->second_var()->get_symbol())
-	return false;
-
-      if (var_dif->first_var()->get_symbol()->get_size()
-	  != var_dif->second_var()->get_symbol()->get_size())
-	return false;
-
-      const diff *d = var_dif->type_diff().get();
-      if (!d)
-	return false;
-      d = peel_qualified_diff(d);
-      if (const array_diff *a = is_array_diff(d))
-	{
-	  array_type_def_sptr f = a->first_array(), s = a->second_array();
-	  if (f->is_infinite() != s->is_infinite())
-	    return true;
-	}
-    }
-  return false;
+  return is_var_1_dim_unknown_size_array_change(dif);
 }
 
 /// Test if a union diff node does have changes that don't impact its
@@ -1769,7 +1827,7 @@ categorize_harmless_diff_node(diff *d, bool pre)
       if (has_void_ptr_to_ptr_change(d))
 	category |= VOID_PTR_TO_PTR_CHANGE_CATEGORY;
 
-      if (has_benign_infinite_array_change(d))
+      if (has_benign_array_of_unknown_size_change(d))
 	category |= BENIGN_INFINITE_ARRAY_CHANGE_CATEGORY;
 
       if (category)
diff --git a/src/abg-default-reporter.cc b/src/abg-default-reporter.cc
index deac0e93..b28f2301 100644
--- a/src/abg-default-reporter.cc
+++ b/src/abg-default-reporter.cc
@@ -1658,6 +1658,8 @@ default_reporter::report(const var_diff& d, ostream& out,
 
   maybe_report_diff_for_member(first, second, d.context(), out, indent);
 
+  maybe_report_diff_for_variable(first, second, d.context(), out, indent);
+
   if (diff_sptr dif = d.type_diff())
     {
       if (dif->to_be_reported())
diff --git a/src/abg-ir.cc b/src/abg-ir.cc
index 33bd3a0e..4a598bde 100644
--- a/src/abg-ir.cc
+++ b/src/abg-ir.cc
@@ -19052,10 +19052,12 @@ var_decl::set_scope(scope_decl* scope)
     get_context_rel()->set_scope(scope);
 }
 
-/// Compares two instances of @ref var_decl.
+/// Compares two instances of @ref var_decl without taking their type
+/// into account.
 ///
-/// If the two intances are different, set a bitfield to give some
-/// insight about the kind of differences there are.
+/// If the two intances are different modulo their type, set a
+/// bitfield to give some insight about the kind of differences there
+/// are.
 ///
 /// @param l the first artifact of the comparison.
 ///
@@ -19072,27 +19074,10 @@ var_decl::set_scope(scope_decl* scope)
 ///
 /// @return true if @p l equals @p r, false otherwise.
 bool
-equals(const var_decl& l, const var_decl& r, change_kind* k)
+var_equals_modulo_types(const var_decl& l, const var_decl& r, change_kind* k)
 {
   bool result = true;
 
-  // First test types of variables.  This should be fast because in
-  // the general case, most types should be canonicalized.
-  if (*l.get_naked_type() != *r.get_naked_type())
-    {
-      result = false;
-      if (k)
-	{
-	  if (!types_have_similar_structure(l.get_naked_type(),
-					    r.get_naked_type()))
-	    *k |= (LOCAL_TYPE_CHANGE_KIND);
-	  else
-	    *k |= SUBTYPE_CHANGE_KIND;
-	}
-      else
-	ABG_RETURN_FALSE;
-    }
-
   // If there are underlying elf symbols for these variables,
   // compare them.  And then compare the other parts.
   const elf_symbol_sptr &s0 = l.get_symbol(), &s1 = r.get_symbol();
@@ -19164,6 +19149,52 @@ equals(const var_decl& l, const var_decl& r, change_kind* k)
   ABG_RETURN(result);
 }
 
+/// Compares two instances of @ref var_decl.
+///
+/// If the two intances are different, set a bitfield to give some
+/// insight about the kind of differences there are.
+///
+/// @param l the first artifact of the comparison.
+///
+/// @param r the second artifact of the comparison.
+///
+/// @param k a pointer to a bitfield that gives information about the
+/// kind of changes there are between @p l and @p r.  This one is set
+/// iff @p k is non-null and the function returns false.
+///
+/// Please note that setting k to a non-null value does have a
+/// negative performance impact because even if @p l and @p r are not
+/// equal, the function keeps up the comparison in order to determine
+/// the different kinds of ways in which they are different.
+///
+/// @return true if @p l equals @p r, false otherwise.
+bool
+equals(const var_decl& l, const var_decl& r, change_kind* k)
+{
+  bool result = true;
+
+  // First test types of variables.  This should be fast because in
+  // the general case, most types should be canonicalized.
+  if (*l.get_naked_type() != *r.get_naked_type())
+    {
+      result = false;
+      if (k)
+	{
+	  if (!types_have_similar_structure(l.get_naked_type(),
+					    r.get_naked_type()))
+	    *k |= (LOCAL_TYPE_CHANGE_KIND);
+	  else
+	    *k |= SUBTYPE_CHANGE_KIND;
+	}
+      else
+	ABG_RETURN_FALSE;
+    }
+
+  result &= var_equals_modulo_types(l, r, k);
+
+  ABG_RETURN(result);
+}
+
 /// Comparison operator of @ref var_decl.
 ///
 /// @param o the instance of @ref var_decl to compare against.
diff --git a/src/abg-reporter-priv.cc b/src/abg-reporter-priv.cc
index 075d089f..a9fed571 100644
--- a/src/abg-reporter-priv.cc
+++ b/src/abg-reporter-priv.cc
@@ -1070,6 +1070,49 @@ maybe_report_diff_for_member(const decl_base_sptr&	decl1,
   return reported;
 }
 
+/// Report the differences between two generic variables.
+///
+/// @param decl1 the first version of the variable.
+///
+/// @param decl2 the second version of the variable.
+///
+/// @param ctxt the context of the diff.
+///
+/// @param out the output stream to emit the change report to.
+///
+/// @param indent the indentation prefix to emit.
+///
+/// @return true if any text has been emitted to the output stream.
+bool
+maybe_report_diff_for_variable(const decl_base_sptr&	decl1,
+			       const decl_base_sptr&	decl2,
+			       const diff_context_sptr& ctxt,
+			       ostream&		out,
+			       const string&		indent)
+{
+  bool reported = false;
+
+  var_decl_sptr var1 = is_var_decl(decl1);
+  var_decl_sptr var2 = is_var_decl(decl2);
+
+  if (!var1 || !var2)
+    return reported;
+
+  if (filtering::is_var_1_dim_unknown_size_array_change(var1, var2))
+    {
+      uint64_t var_size_in_bits = var1->get_symbol()->get_size() * 8;
+
+      out << indent;
+      show_offset_or_size("size of variable symbol (",
+			  var_size_in_bits, *ctxt, out);
+      out << ") hasn't changed\n"
+	  << indent << "but it does have a harmless type change\n";
+      reported = true;
+    }
+
+  return reported;
+}
+
 /// Report the difference between two ELF symbols, if there is any.
 ///
 /// @param symbol1 the first symbol to consider.
diff --git a/src/abg-reporter-priv.h b/src/abg-reporter-priv.h
index 0cac883b..884477d0 100644
--- a/src/abg-reporter-priv.h
+++ b/src/abg-reporter-priv.h
@@ -206,6 +206,13 @@ maybe_report_diff_for_member(const decl_base_sptr&	decl1,
 			     ostream&			out,
 			     const string&		indent);
 
+bool
+maybe_report_diff_for_variable(const decl_base_sptr&	decl1,
+			       const decl_base_sptr&	decl2,
+			       const diff_context_sptr& ctxt,
+			       ostream&		out,
+			       const string&		indent);
+
 void
 maybe_report_diff_for_symbol(const elf_symbol_sptr&	symbol1,
 			     const elf_symbol_sptr&	symbol2,
diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am
index c995930f..a7c4502c 100644
--- a/tests/data/Makefile.am
+++ b/tests/data/Makefile.am
@@ -1135,6 +1135,12 @@ test-diff-filter/test-PR29811-unknown-size-array-dwarf-ctf-CTF.o \
 test-diff-filter/test-PR29811-unknown-size-array-dwarf-ctf-DWARF.o \
 test-diff-filter/test-PR29811-unknown-size-array-dwarf-ctf-report.txt \
 test-diff-filter/test-PR29811-unknown-size-array-dwarf-ctf.c \
+test-diff-filter/test-PR29811-0-report-0.txt \
+test-diff-filter/test-PR29811-0-report-1.txt \
+test-diff-filter/test-PR29811-0-v0.o \
+test-diff-filter/test-PR29811-0-v1.o \
+test-diff-filter/test-PR29811-0-v0.c \
+test-diff-filter/test-PR29811-0-v1.c \
 \
 test-diff-suppr/test0-type-suppr-v0.cc	\
 test-diff-suppr/test0-type-suppr-v1.cc	\
diff --git a/tests/data/test-diff-filter/test-PR29811-0-report-0.txt b/tests/data/test-diff-filter/test-PR29811-0-report-0.txt
new file mode 100644
index 00000000..fa4b7506
--- /dev/null
+++ b/tests/data/test-diff-filter/test-PR29811-0-report-0.txt
@@ -0,0 +1,3 @@
+Functions changes summary: 0 Removed, 0 Changed, 0 Added function
+Variables changes summary: 0 Removed, 0 Changed (1 filtered out), 0 Added variable
+
diff --git a/tests/data/test-diff-filter/test-PR29811-0-report-1.txt b/tests/data/test-diff-filter/test-PR29811-0-report-1.txt
new file mode 100644
index 00000000..26eddf3f
--- /dev/null
+++ b/tests/data/test-diff-filter/test-PR29811-0-report-1.txt
@@ -0,0 +1,13 @@
+Functions changes summary: 0 Removed, 0 Changed, 0 Added function
+Variables changes summary: 0 Removed, 1 Changed, 0 Added variable
+
+1 Changed variable:
+
+  [C] 'unsigned int is_basic_table[]' was changed to 'unsigned int is_basic_table[1]' at test-PR29811-0-v1.c:1:1:
+    size of variable symbol ( 32 (in bits)) hasn't changed
+    but it does have a harmless type change
+    type of variable changed:
+      type name changed from 'unsigned int[]' to 'unsigned int[1]'
+      array type size changed from 'unknown' to 32
+      array type subrange 1 changed length from 'unknown' to 1
+
diff --git a/tests/data/test-diff-filter/test-PR29811-0-v0.c b/tests/data/test-diff-filter/test-PR29811-0-v0.c
new file mode 100644
index 00000000..99a1aa40
--- /dev/null
+++ b/tests/data/test-diff-filter/test-PR29811-0-v0.c
@@ -0,0 +1 @@
+unsigned int is_basic_table[];
diff --git a/tests/data/test-diff-filter/test-PR29811-0-v0.o b/tests/data/test-diff-filter/test-PR29811-0-v0.o
new file mode 100644
index 0000000000000000000000000000000000000000..2da979dbbd6567d8a4eeb8dde81d53ca0c03b374
GIT binary patch
literal 2640
zcmcIl%}*0S6o1pDB33HU_=(D5FoL?<ZbJ|-Kog=sB*tJ&yfxc)SXSFD*<DD92jk5|
z55#!z=)w3eXgqQCKj2^R=-Gq5w>wjoVM&aMFPZo8dmr<5=1u$Z-s=4fV<3saJRDdO
z1=!6V=#@yVKmmqe8TBl%lLTdmT_Gk(n?Q|L53n8rqbiK$ucF?k5keHF0~>=}Zho{^
z%VVuUc0FInX(PiU1LpxW##RcffQ3deK066oel~YEH<Mc_EL_Z7K<qNEr~!z2LF+J;
z(afUnCQ8QGuY5lV`czz~j6`3ZVI!F{ahWK6%L`n`;|<;QLRfnEL|?S-=vLV*o0eWK
zmCKe@w)F8e3|O{9;V>pAbfXn+d3?^{9{1fknzmoxnCnbW8B>$G;eZ=dYj)t)tD#+M
za%i?aM?bVzaiiVh#YVgF%q==@SZumAyXHE!+blj>E6+?@Rx#v37!(_JXh*8iaM#z3
zb+;LEAIN8jK%-=Am&`i+hmvXAz|!L4tUiv1HSrfG6`e9NnhqTo4G5;<RkFQkV$ddH
z!j5h!hEh5Cd*J8qG^ZBra@3>2iK8GQ8uT55=Z?WoAHmNeGKiHVb-yX?=#;6T968LV
zP(P>w&@T!SPG=_Vp#)A}wIJ+s3NB2zl)$^aA$BW)C!Ri(6#S{M=Y*v5?-e?UC85hc
z9bwB8Cp_`q;94S{Vjc_owt~MCwx!^og$-t~)56DvGW27)A+?ZqLNMv!fLRLyFn!*%
z%?7V+IaSwNZ=)~L?OM&}+lSn?Z+i|uoYHhXE>my|sS;d`?0UP^;`sYvdhL*#INe4N
z+V$tccDyZf({FEbKirYc|GON<RJsFszOqt9DvDI!(<u50OU@dlREVXJntuahXl9Sg
zPtF*XQ*F9WwI;<?h#{@UqRZ7-niHy7=|;rLN72x}zz0xLoP1yO7eYjHtkxv_EioiH
z=dpD(_7OVL^1q7&T_y^t#y&tit^bZVDA_0VPw!0azk!%q6CwCP3~4GBU9QGf(UZ3S
zuGoKBWYYfh>!|L(i5S%^;Yw2c_X?nnxZGdL7nqcm|3L(NOBNNe1j+n2LRa@+%TN?R
zF&14e^Q3%_9;tVOP<bWtlNjl0>?g$NUexf{0#N&s=SQ`OsGgcj_*Vh$k%2UbEA9U2
ePSm$Y@f`t<k&z&^f2y07zc23pOCpz4HUAGJK;L)(

literal 0
HcmV?d00001

diff --git a/tests/data/test-diff-filter/test-PR29811-0-v1.c b/tests/data/test-diff-filter/test-PR29811-0-v1.c
new file mode 100644
index 00000000..d4ef9871
--- /dev/null
+++ b/tests/data/test-diff-filter/test-PR29811-0-v1.c
@@ -0,0 +1 @@
+unsigned int is_basic_table[] = {0};
diff --git a/tests/data/test-diff-filter/test-PR29811-0-v1.o b/tests/data/test-diff-filter/test-PR29811-0-v1.o
new file mode 100644
index 0000000000000000000000000000000000000000..e059251653101dfb426aea6009140a8498e14f24
GIT binary patch
literal 2648
zcmbtVOK;Oa5T1=&3IqZrykBuq5d~qpj-v8XA*h13;-LaULgEnF$<{R_PGvh)D-QGw
z7eE}iA|b>-K;qQjz=<P&0j?Zi#@<cctt%lIY3K3HW5>I*$@3exZx$E>Ner&Sx+PJ7
zcZ2JCJyGjWhJA1c^+90U2`UgfK}?cXL(RlBKnz428z4O?$XMwl>N_+-5@MrJEM6TM
z(n?rxn4K<_i(2JaW$z&Xjj`D>D`T}0m@QjHtWg84bh&t?c&RvBzILQ=7)u<-m2?70
zQ)$%<ucAJPzH=xUW4}tfNzgarLZy;?et}gAd(tvVZZC*@FW@cR4`P_U`%s^<FX(pF
zteUo79j{hxyK3uW_c36`iG{<coz;y_+za@m#{(YvO*EabxiGnWal)9W>4pb>)Nq~1
zZ#H7bZF6XM15e+uSInc>n7d!SbkVkrabw9gn_w+;JKSn@TTgt;^JA;+yN>I7j^DOK
zq(y0w)pBAdQH_>AKX1(Y?U;xEo1WKE9tP7>Q<wEIJgl>SaZ<@C<JF?nanW>OCf+1l
zOU4ClA|~wQl2Ry_lYany{LXV~$u65c8f@DPBBH^LEpQyc9MWLdCiDOz!&pgD|C{no
zP8kZyk+ZxL_4O(MyG235>CB|PFN0^l>Y#$}7xvK%-tP^u@eEG&Jz-BMxG>?0f<F@W
zjF5CMLqaDZd!zm{&katA7{V#$fw0dj_#0u{3jR^pU`8t)d|N2vFqI2Zi}`X4CcP0b
z-6#Sx<ZZ`naku9+{9wL|zC?FiH{?qj+)n5O9^aVK_5&_ca0{st+(_(Zx6|SH^I-<v
zn437=Mie{Er^5Dvp1Bxy7kL=3$maiD9>Y{RYk9u1Qe7&FRNvDG`U%U<8l}{U<&c_x
z24iSux604X7?o3Px=*zx#np)+-AhHEtFbgERI}cXNR>~bp>G1;i<08x`=WmkqDfq8
zO~PLjL%N=dK38Ms(4%4${8eP=LQ0{=-a<!S|EuDlWS`VOy(hK*7Gi2mgy1JJB>8?*
zYjbP^9eMk|6Z^~eO#9QXqq_ehVzmD_t}Km-rqmIay-N8Elk)Q4i-0fLq9T?cng3Gg
z>i&-l6a`?VqR(ZXlyA`^^?nd4FGPM8BVCRCfEeA28vaTEYG3mFs1^~`Q*#Ml6W|&d
lNW-}D?w{^NeR~wYD!@@PGNkrTb@TGSi~Ika$t6|I{{utv;J5$)

literal 0
HcmV?d00001

diff --git a/tests/test-diff-filter.cc b/tests/test-diff-filter.cc
index ac7855da..563423cf 100644
--- a/tests/test-diff-filter.cc
+++ b/tests/test-diff-filter.cc
@@ -822,6 +822,20 @@ InOutSpec in_out_specs[] =
    "data/test-diff-filter/test-PR29387-report.txt",
    "output/test-diff-filter/test-PR29387-report.txt",
   },
+  {
+    "data/test-diff-filter/test-PR29811-0-v0.o",
+    "data/test-diff-filter/test-PR29811-0-v1.o",
+    "--no-default-suppression",
+    "data/test-diff-filter/test-PR29811-0-report-0.txt",
+    "output/test-diff-filter/test-PR29811-0-report-0.txt",
+  },
+  {
+    "data/test-diff-filter/test-PR29811-0-v0.o",
+    "data/test-diff-filter/test-PR29811-0-v1.o",
+    "--harmless --no-default-suppression",
+    "data/test-diff-filter/test-PR29811-0-report-1.txt",
+    "output/test-diff-filter/test-PR29811-0-report-1.txt",
+  },
 #ifdef WITH_CTF
   {
    "data/test-diff-filter/test-PR29811-unknown-size-array-dwarf-ctf-DWARF.o",
-- 
2.39.0


-- 
		Dodji

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-01-01 17:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-01 17:33 [PATCH, applied] Bug 29811 - Better categorize harmless unknown array size changes Dodji Seketeli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).