Return-Path: Delivered-To: apmail-stdcxx-issues-archive@locus.apache.org Received: (qmail 74481 invoked from network); 6 May 2008 04:32:25 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 May 2008 04:32:25 -0000 Received: (qmail 30623 invoked by uid 500); 6 May 2008 04:32:22 -0000 Delivered-To: apmail-stdcxx-issues-archive@stdcxx.apache.org Received: (qmail 30604 invoked by uid 500); 6 May 2008 04:32:22 -0000 Mailing-List: contact issues-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 issues@stdcxx.apache.org Received: (qmail 30277 invoked by uid 99); 6 May 2008 04:32:22 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 May 2008 21:32:21 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 May 2008 04:31:35 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 9F1CF234C100 for ; Mon, 5 May 2008 21:31:55 -0700 (PDT) Message-ID: <1098279329.1210048315637.JavaMail.jira@brutus> Date: Mon, 5 May 2008 21:31:55 -0700 (PDT) From: "Martin Sebor (JIRA)" To: issues@stdcxx.apache.org Subject: [jira] Commented: (STDCXX-904) [HP aCC 6.16] bogus cadvise warning #20206 in optimized code In-Reply-To: <750714617.1209599095622.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/STDCXX-904?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12594460#action_12594460 ] Martin Sebor commented on STDCXX-904: ------------------------------------- Reduced test case I sent to HP: {noformat} $ cat u.cpp && aCC -V +O2 +w -c t.cpp void foo (const char*); int main () { struct B { char x [4]; void bar (unsigned n) { for (unsigned i = 3; i != n - 1; --i) x [i] = x [i - n]; } } x; for (unsigned i = 0; i != 1; ++i) { x.bar (i % 4); foo (x.x); } } aCC: HP C/aC++ B3910B A.06.16 [Nov 26 2007] "t.cpp", line 13, procedure main: warning #20206-D: Out of bound access (In expression "memmove(&(&x)->x[2]+1 - (long long)(3 - n),&(&x)->x[(int)(2 - n)]+1 - (long long)(3 - n),3 - n)", &(&x)->x[2]+1 - (long long)(3 - n) (type: char [4]) (defined by (&x)->x) has byte range [0 .. 3], writing byte range [0 .. 4].) {noformat} > [HP aCC 6.16] bogus cadvise warning #20206 in optimized code > ------------------------------------------------------------ > > Key: STDCXX-904 > URL: https://issues.apache.org/jira/browse/STDCXX-904 > Project: C++ Standard Library > Issue Type: Bug > Components: External > Affects Versions: 4.2.1 > Environment: $ uname -sr && aCC -V > HP-UX B.11.31 > aCC: HP C/aC++ B3910B A.06.16 [Nov 26 2007] > Reporter: Travis Vitek > > This is a simplified version of 23.bitset.cpp that shows a bogus out of bound access cadvise warning. > {noformat} > void __rw_bitset (unsigned*, unsigned, const char*, unsigned, unsigned, unsigned); > template > class bitset > { > unsigned bits_ [1]; > public: > bitset (const char *__str, unsigned __pos, unsigned __n) { > __rw_bitset (bits_, _Size, __str, 0, __pos, __n); > } > }; > template > struct test_set > { > char bits_ [_Size + 1]; // includes a null terminator > test_set () { > for (unsigned i = 0; i != _Size; ++i) > bits_ [i] = '0'; > bits_ [_Size] = '\0'; > } > test_set& operator>>= (unsigned n) { > for (unsigned i = _Size - 1; i != n - 1; --i) > bits_ [i] = bits_ [i - n]; > for (unsigned j = n; j != 0; ) > bits_ [--j] = '0'; > return *this; > } > }; > template > void run_test () > { > test_set<_Size> ts0; > const unsigned M = _Size + 1; > for (unsigned i = 0; i != 1; ++i) { > const unsigned n = i % M; > > const test_set<_Size> ts1 = (ts0 >>= n); > (void)&ts1; > const bitset<_Size> bs0 (ts0.bits_, 0, _Size); > } > } > int main (int argc, char *argv[]) > { > run_test<31>(); > return 0; > } > {noformat} > The result of compiling this code with -O2 is... > {noformat} > aCC -c -mt \ > -I/amd/devco/vitek/stdcxx/4.2.x/include \ > -I/amd/devco/vitek/stdcxx/4.2.x/build/include \ > -I/amd/devco/vitek/stdcxx/4.2.x/tests/include \ > -AA +O2 +DD64 +w \ > +W392,655,684,818,819,849 \ > +W2193,2236,2261,2340,2401,2487 \ > +W4227,4229,4231,4235,4237,4249 \ > +W4255,4272,4284,4285,4286,4296,4297 \ > +W3348 u.cpp > "u.cpp", line 29, procedure main: warning #20206-D: Out of bound access \ > (In expression "memmove(&(&ts0)->bits_[30]+1 - (31 - n),&(&ts0)->bits_[(30 - n)]+1 - (31 - n),31 - n)", &(&ts0)->bits_[30]+1 - (31 - n) \ > (type: char [32]) (defined by (&ts0)->bits_) has byte range [0 .. 31], writing byte range [0 .. 60].) > {noformat} > The code compiles without warning if the optimization level is reduced to -O1. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.