On Fri, Nov 14, 2014 at 05:05:57PM +0000, Zamyatin, Igor wrote:
> > > --- /dev/null
> > > +++ b/gcc/testsuite/gcc.target/i386/pr63845.c
> > > @@ -0,0 +1,20 @@
> > > +/* PR sanitizer/63845 */
> > > +/* { dg-do compile } */
> > > +/* { dg-require-effective-target ia32 } */
> > > +/* { dg-require-effective-target fpic } */
> > > +/* { dg-skip-if "No Windows PIC" { *-*-mingw* *-*-cygwin } { "*" } {
> > > +"" } } */
> > > +/* { dg-options "-fPIC" } */
> > > +
> > > +int __attribute__ ((noinline, noclone)) foo (void *p) {
> > > +  return *(int*)p;
> > > +}
> > > +
> > > +int main ()
> > > +{
> > > +  char a = 0;
> > > +  foo (&a);
> > > +  return 0;
> > > +}
> > > +
> > >
> > 
> > Will this test fail on Linux without your fix? Doesn't testcase need -
> > fsanitize=address to fail?
> 
> Sure, you're right, will add it

It is not that easy, -fsanitize=address is not supported everywhere.
Better if you stick it into testsuite/gcc.dg/asan/
No point adding effective-target ia32/fpic, there is nothing i?86 specific,
not even ix86/x86_64 specific, nor pic specific in the test, just use
/* { dg-additional-options "-fPIC" { target fpic } } */

        Jakub

Reply via email to