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]

Re: [ubsan] Add testsuite


On Mon, Jul 15, 2013 at 07:48:59PM +0200, Marek Polacek wrote:
> Ubsan testsuite is something we've been missing for some time now, so
> this patch adds it.  Fortunately the dejagnu part was
> quite simple, since ubsan doesn't need similar tweaks as asan does.
> But I had to tweak gcc.c to include -lubsan.

Looks good to me.

> The tests are testing pretty basic stuff, however, in LLVM testsuite they
> don't check much more.  Maybe we should test also stuff like ++a << (v * x)
> etc.?

Yeah, more tests would be helpful.  Also, I'd add to the tests where you use
explicit constants in the operation (where we can always (and probably do)
warn at compile time already) tests where it clearly can't be a compile time
decided whether to warn or not and needs to be deferred to runtime.
So say
volatile int shiftcount = 152;
... 1 << shiftcount;
and stuff like that compared to
... 1 << 152;
Side-effects in the expressions also won't hurt, different types too
(so that you check the different value encoding).  E.g. int will be passed
by value on both -m32 and -m64, while long long will be passed by reference
for -m32.

Anyway, this can be done incrementally.

	Jakub


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