Return-Path: Delivered-To: apmail-stdcxx-dev-archive@www.apache.org Received: (qmail 59166 invoked from network); 3 Apr 2008 23:15:57 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Apr 2008 23:15:57 -0000 Received: (qmail 16992 invoked by uid 500); 3 Apr 2008 23:15:57 -0000 Delivered-To: apmail-stdcxx-dev-archive@stdcxx.apache.org Received: (qmail 16928 invoked by uid 500); 3 Apr 2008 23:15:57 -0000 Mailing-List: contact dev-help@stdcxx.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@stdcxx.apache.org Delivered-To: mailing list dev@stdcxx.apache.org Received: (qmail 16919 invoked by uid 99); 3 Apr 2008 23:15:57 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Apr 2008 16:15:57 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [208.30.140.160] (HELO moroha.roguewave.com) (208.30.140.160) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Apr 2008 23:15:15 +0000 Received: from nebula.bco.roguewave.com ([10.70.3.27]) by moroha.roguewave.com (8.13.6/8.13.6) with ESMTP id m33NFP92010752 for ; Thu, 3 Apr 2008 23:15:26 GMT Message-ID: <47F5650E.9000401@roguewave.com> Date: Thu, 03 Apr 2008 17:15:26 -0600 From: Martin Sebor Organization: Rogue Wave Software, Inc. User-Agent: Thunderbird 2.0.0.12 (X11/20080226) MIME-Version: 1.0 To: dev@stdcxx.apache.org Subject: Re: [jira] Commented: (STDCXX-761) [HP aCC 6.16] Out of bound access in new.cpp References: <1804206317.1207257804910.JavaMail.jira@brutus> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Eric Lemings wrote: > > Travis, > > If you could, give the following patch a whirl (or quick review > at least). Is there an easier way to silence the warning than by adding all these loops? E.g., by assigning the address of the first member to a local pointer? (Or is the compiler too smart for that?) Also, there is no need to use the _RWSTD_SIZE_T macro in .cpp files. The macro is useful in library and test suite headers to reduce namespace pollution (so we don't have to #include . Last thing: the code formatting convention calls for a space before each open parenthesis. It might take some getting used to but once you do, you'll never go back -- just ask Travis ;-) Martin > > ----- > $ svn diff > Index: tests/src/new.cpp > =================================================================== > --- tests/src/new.cpp (revision 644444) > +++ tests/src/new.cpp (working copy) > @@ -604,6 +604,17 @@ > return ret; > } > > +static void > +rwt_checkpoint_compare (_RWSTD_SIZE_T* diffs, _RWSTD_SIZE_T n, > + const _RWSTD_SIZE_T* st0, const _RWSTD_SIZE_T* > st1, > + bool& diff_0) > +{ > + for (_RWSTD_SIZE_T i = 0; i != n; ++i) { > + diffs [i] = st1 [i] - st0 [i]; > + if (diffs [i]) > + diff_0 = false; > + } > +} > > _TEST_EXPORT rwt_free_store* > rwt_checkpoint (const rwt_free_store *st0, const rwt_free_store *st1) > @@ -616,21 +627,24 @@ > // of the free_store specified by the arguments > > static rwt_free_store diff; > - > memset (&diff, 0, sizeof diff); > > - size_t* diffs = diff.new_calls_; > - const size_t* st0_args = st0->new_calls_; > - const size_t* st1_args = st1->new_calls_; > - > bool diff_0 = true; // difference of 0 (i.e., none) > > - for (size_t i = 0; i != 16; ++i) { > - diffs [i] = st1_args [i] - st0_args [i]; > - if (diffs [i]) > - diff_0 = false; > - } > +#define EXTENT(array) (sizeof (array) / sizeof(*array)) > +#define COMPARE(member) \ > + rwt_checkpoint_compare (diff.member, EXTENT(diff.member),\ > + st0->member, st1->member, diff_0) > > + COMPARE(new_calls_); > + COMPARE(delete_calls_); > + COMPARE(delete_0_calls_); > + COMPARE(blocks_); > + COMPARE(bytes_); > + COMPARE(max_blocks_); > + COMPARE(max_bytes_); > + COMPARE(max_block_size_); > + > if (diff_0) > return 0; > ----- > > The 0.new test seems to be okay with it. > > Thanks, > Brad. > >> -----Original Message----- >> From: Travis Vitek (JIRA) [mailto:jira@apache.org] >> Sent: Thursday, April 03, 2008 3:23 PM >> To: Eric Lemings >> Subject: [jira] Commented: (STDCXX-761) [HP aCC 6.16] Out of >> bound access in new.cpp >> >> >> [ >> https://issues.apache.org/jira/browse/STDCXX-761?page=com.atla >> ssian.jira.plugin.system.issuetabpanels:comment-tabpanel&focus >> edCommentId=12585290#action_12585290 ] >> >> Travis Vitek commented on STDCXX-761: >> ------------------------------------- >> >> It looks like someone is being tricky. They are assuming that >> every member in {{rwt_free_store}} is contiguous [i.e. no >> padding], and they are actually comparing each of >> {{new_calls_}}, {{delete_calls_}}, {{blocks_}}, {{bytes_}}, >> {{max_blocks_}}, {{max_bytes_}} and {{max_block_size_}} with >> that one loop. If you decide to fix this, you'll end up >> probably end up writing eight loops of two iterations each. >> >> Also, I'd prefer that the 2 isn't hardcoded and that you use >> something like {{sizeof (array) / sizeof (*array)}}, or a >> size macro instead. >> >>> [HP aCC 6.16] Out of bound access in new.cpp >>> -------------------------------------------- >>> >>> Key: STDCXX-761 >>> URL: >> https://issues.apache.org/jira/browse/STDCXX-761 >>> Project: C++ Standard Library >>> Issue Type: Sub-task >>> Components: Test Driver >>> Affects Versions: 4.2.0 >>> Environment: $ uname -sr && aCC -V >>> HP-UX B.11.31 >>> aCC: HP C/aC++ B3910B A.06.16 [Nov 26 2007] >>> Reporter: Scott (Yu) Zhong >>> Assignee: Eric Lemings >>> Fix For: 4.2.1 >>> >>> Original Estimate: 2h >>> Remaining Estimate: 2h >>> >>> When compiled with HP aCC 6.16 +w +O, the test driver >> source file >> [new.cpp|http://svn.apache.org/repos/asf/stdcxx/trunk/tests/sr >> c/new.cpp] produces the warnings below: >>> {noformat} >>> aCC -c -I$(TOPDIR)/include -I$(BUILDDIR)/include >> -I$(TOPDIR)/tests/include -AA +O2 +DD64 +w \ >>> +W392 +W655 +W684 +W818 +W819 +W849 +W2193 +W2236 >> +W2261 +W2340 +W2401 +W2487 +W4227 \ >>> +W4229 +W4231 +W4235 +W4237 +W4249 +W4255 +W4272 +W4284 >> +W4285 +W4286 +W4296 +W4297 +W3348 \ >>> $(TOPDIR)/tests/src/new.cpp >>> "$(TOPDIR)/tests/src/new.cpp", line 629, procedure >> rwt_checkpoint: warning #20206-D: Out of bound access (In >> expression "(unsigned long long*)(&diff)->new_calls_+i", >> (&diff)->new_calls_ (type: unsigned long long [2]) has byte >> range [0 .. 15], writing byte range [0 .. 127].) >>> {noformat} >> -- >> This message is automatically generated by JIRA. >> - >> You can reply to this email to add a comment to the issue online. >> >>