http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55679



--- Comment #16 from Dominique d'Humieres <dominiq at lps dot ens.fr> 
2012-12-16 18:23:24 UTC ---

(In reply to comments #12 and #13)

With -O1, the invalid tests c-c++-common/asan/global-overflow-1.c and

c-c++-common/asan/stack-overflow-1.c are optimized to a valid "return 0" as

shown by the following differences between the outputs of -dump-tree-optimized

with and without -fno-tree-fre:



--- stack-overflow-1.c.164t.optimized    2012-12-16 17:26:13.000000000 +0100

+++ stack-overflow-1.c.164t_f.optimized    2012-12-16 17:25:13.000000000 +0100

@@ -3,18 +3,14 @@



 main ()

 {

-  int res;

   char x[10];

   int ten.1;

-  char _4;



   <bb 2>:

   __builtin_memset (&x, 0, 10);

   ten.1_3 ={v} ten;

-  _4 = x[ten.1_3];

-  res_5 = (int) _4;

   x ={v} {CLOBBER};

-  return res_5;

+  return 0;



 }



So the problem for these two tests has nothing to do with asan. Note that they

regress cleanly if I add '-fno-tree-fre -fno-tree-pre' to '-fno-builtin-memset'

in the dg-options. The optimization is also defeated If I add a line such as



  x[1] = 1;



Although I doubt this behavior is a bug, I'll open a new PR for it tomorrow

unless there is some objection.

Reply via email to