libabigail/include
Giuliano Procida 2d5389f265 Fix size calculations for multidimensional arrays.
The code in abg-ir.cc that calculated the memory size of an array
summed, rather than multiplied, the dimensions. It also did duplicate
work for each dimension after the first.

Existing code in abg-reader.cc asserted that array size information
read from XML match freshly calculated values.

This patch corrects the calculation, eliminates the duplicate work and
updates the XML reader validation to just emit a warning if old bad
array size information is found.

	* include/abg-ir.h (array_type_def::append_subrange): Remove
	this function.
	* src/abg-ir.cc (array_type_def::set_element_type): Add a note
	about safe usage.
	(array_type_def::append_subrange): Inline this function into
	its only caller append_subranges and remove it.
	(array_type_def::append_subranges): Do correct multiplicative
	calculation of multidimensional array sizes.
	* src/abg-reader.cc (build_array_type_def): When checking
	calculated against read array sizes, warn once if value
	matches old behaviour rather than raising an assertion.
	Otherwise, before raising an assertion, emit an informative
	error message.
	* tests/data/test-annotate/test14-pr18893.so.abi: Correct
	array sizes.
	* tests/data/test-annotate/test17-pr19027.so.abi: Ditto.
	* tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi:
	Ditto.
	* tests/data/test-annotate/test7.so.abi: Ditto.
	* tests/data/test-diff-dwarf/test10-report.txt: Ditto.
	* tests/data/test-diff-dwarf/test11-report.txt: Ditto.
	* tests/data/test-read-write/test25.xml: Ditto.

Reviewed-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Giuliano Procida <gprocida@google.com>
2020-03-31 19:48:35 +02:00
..
abg-comp-filter.h Update copyright year to 2020 2020-02-21 17:05:01 +01:00
abg-comparison.h Update copyright year to 2020 2020-02-21 17:05:01 +01:00
abg-config.h Update copyright year to 2020 2020-02-21 17:05:01 +01:00
abg-corpus.h Update copyright year to 2020 2020-02-21 17:05:01 +01:00
abg-cxx-compat.h Update copyright year to 2020 2020-02-21 17:05:01 +01:00
abg-diff-utils.h Update copyright year to 2020 2020-02-21 17:05:01 +01:00
abg-dwarf-reader.h Update copyright year to 2020 2020-02-21 17:05:01 +01:00
abg-fwd.h abg-ir.cc: Improve types_have_similar_structure. 2020-03-26 11:45:03 +01:00
abg-hash.h Update copyright year to 2020 2020-02-21 17:05:01 +01:00
abg-ini.h Update copyright year to 2020 2020-02-21 17:05:01 +01:00
abg-interned-str.h Update copyright year to 2020 2020-02-21 17:05:01 +01:00
abg-ir.h Fix size calculations for multidimensional arrays. 2020-03-31 19:48:35 +02:00
abg-libxml-utils.h Update copyright year to 2020 2020-02-21 17:05:01 +01:00
abg-libzip-utils.h Update copyright year to 2020 2020-02-21 17:05:01 +01:00
abg-reader.h Update copyright year to 2020 2020-02-21 17:05:01 +01:00
abg-reporter.h Update copyright year to 2020 2020-02-21 17:05:01 +01:00
abg-sptr-utils.h Update copyright year to 2020 2020-02-21 17:05:01 +01:00
abg-suppression.h Update copyright year to 2020 2020-02-21 17:05:01 +01:00
abg-tools-utils.h Update copyright year to 2020 2020-02-21 17:05:01 +01:00
abg-traverse.h Update copyright year to 2020 2020-02-21 17:05:01 +01:00
abg-version.h.in Add (undocumented) support for version suffixes 2020-01-09 17:06:31 +00:00
abg-viz-common.h Update copyright year to 2020 2020-02-21 17:05:01 +01:00
abg-viz-dot.h Update copyright year to 2020 2020-02-21 17:05:01 +01:00
abg-viz-svg.h Update copyright year to 2020 2020-02-21 17:05:01 +01:00
abg-workers.h Update copyright year to 2020 2020-02-21 17:05:01 +01:00
abg-writer.h Update copyright year to 2020 2020-02-21 17:05:01 +01:00
Makefile.am Add compatibility layer for C++11 mode 2019-07-09 18:05:28 +02:00