]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Add a comment about marking static memory as defined.
authorNicholas Nethercote <njn@valgrind.org>
Thu, 21 Sep 2006 15:59:30 +0000 (15:59 +0000)
committerNicholas Nethercote <njn@valgrind.org>
Thu, 21 Sep 2006 15:59:30 +0000 (15:59 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6083

memcheck/mc_main.c

index 026356b670bf52b445c980f5bc3a89950d0459bf..98052484dc57f8d6332e4a91097f59e04be092de 100644 (file)
@@ -2161,6 +2161,16 @@ static
 void mc_new_mem_startup( Addr a, SizeT len, Bool rr, Bool ww, Bool xx )
 {
    /* Ignore the permissions, just make it defined.  Seems to work... */
+   // Because code is defined, initialised variables get put in the data
+   // segment and are defined, and uninitialised variables get put in the
+   // bss segment and are auto-zeroed (and so defined).  
+   //
+   // It's possible that there will be padding between global variables.
+   // This will also be auto-zeroed, and marked as defined by Memcheck.  If
+   // a program uses it, Memcheck will not complain.  This is arguably a
+   // false negative, but it's a grey area -- the behaviour is defined (the
+   // padding is zeroed) but it's probably not what the user intended.  And
+   // we can't avoid it.
    DEBUG("mc_new_mem_startup(%p, %llu, rr=%u, ww=%u, xx=%u)\n",
          a, (ULong)len, rr, ww, xx);
    MC_(make_mem_defined)(a, len);