This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RFC: Generated structure layout tests for gcc.dg/compat


Hi!

For ABI compatibility testing current coverage of gcc.dg/compat and
g++.dg/compat looks insufficient to me.  So, I have started playing with
generated tests.
Attached is a structure layout test generator and related infrastructure.
The generator doesn't handle bitfields yet, but other than that should
handle layout checking for structures/unions containing
integer/floating/enum/vector/complex types, typedefs, arrays, nested
structures and unions, everything with various attributes attached to it
at various places.  The generator attempts to put together tests containing
complex ints/floats, as another group tests containing vector types, etc.,
so that on arches where one of these is broken at least other things can be
checked.
The generator outputs tests one per line, which then should be divided
into groups of like 100 tests and stored into struct_layout_1_N_test.h
(plus struct_layout_1_1_{main,x,y}.c sed(1)ed s/1_1_/1_N_/ into
struct_layout_1_N_{main,x,y}.c), then run as part of gcc.dg/compat
testsuite.  For debugging, -DDBG can be used and when it is known
which particular test fails, the _test.h can be trimmed just into that
single test for easier debugging.
For each structure the test checks if field addresses/sizes/alignments
(with the exception of bitfields) are the same, size/alignment of the
whole structure or union too and for integer/floating/complex/enum type
fields and bitfields value passing both to variadic and non-variadic
function are tested.

Would something like this be acceptable?
If yes, how many tests should we put into the testsuite (ATM the generator
creates around 30000 tests, but that can be easily tweaked)?
Anyone has ideas how to improve the generator so that it more likely
generates interesting structures/unions where the likelyhood of ABI problems
is higher?

	Jakub

Attachment: gcc.dg-compat-struct_layout_1.tar.bz2
Description: BZip2 compressed data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]