This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [ubsan] Add testsuite
- From: Marek Polacek <polacek at redhat dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 16 Jul 2013 01:33:19 +0200
- Subject: Re: [ubsan] Add testsuite
- References: <20130715174859 dot GL3697 at redhat dot com> <20130715232700 dot GW2475 at laptop dot redhat dot com>
On Tue, Jul 16, 2013 at 01:27:00AM +0200, Jakub Jelinek wrote:
> 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.
Thanks, commited to ubsan branch.
> > 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.
Ok, will add something like that.
Marek