Return-Path: Delivered-To: apmail-stdcxx-issues-archive@locus.apache.org Received: (qmail 94372 invoked from network); 10 Apr 2008 01:34:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 10 Apr 2008 01:34:52 -0000 Received: (qmail 49004 invoked by uid 500); 10 Apr 2008 01:34:52 -0000 Delivered-To: apmail-stdcxx-issues-archive@stdcxx.apache.org Received: (qmail 48986 invoked by uid 500); 10 Apr 2008 01:34:52 -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 48977 invoked by uid 99); 10 Apr 2008 01:34:52 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Apr 2008 18:34:52 -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; Thu, 10 Apr 2008 01:34:19 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id E5615234C0C1 for ; Wed, 9 Apr 2008 18:32:04 -0700 (PDT) Message-ID: <1198735313.1207791124938.JavaMail.jira@brutus> Date: Wed, 9 Apr 2008 18:32:04 -0700 (PDT) From: "Travis Vitek (JIRA)" To: issues@stdcxx.apache.org Subject: [jira] Commented: (STDCXX-772) [HP aCC 6.16] warning #20035-D: variable is used before its value is set in functional In-Reply-To: <216876630.1205774184377.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-772?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12587454#action_12587454 ] Travis Vitek commented on STDCXX-772: ------------------------------------- Looks like another bogus warning, or at the very least a warning about something that we don't really have any control over. Here is a testcase. . {noformat} namespace bug { template struct unary_function { typedef _Arg argument_type; typedef _Result result_type; }; template struct binary_function { typedef _Arg1 first_argument_type; typedef _Arg2 second_argument_type; typedef _Result result_type; }; template struct minus : public binary_function<_TypeT, _TypeT, _TypeT> { typedef typename binary_function<_TypeT, _TypeT, _TypeT>::result_type result_type; typedef typename binary_function<_TypeT, _TypeT, _TypeT>::first_argument_type first_argument_type; typedef typename binary_function<_TypeT, _TypeT, _TypeT>::second_argument_type second_argument_type; result_type operator() (const first_argument_type& x, const second_argument_type& y) const { return x - y; } }; template struct binder1st : public unary_function { protected: _Operation op; typename _Operation::first_argument_type value; public: typedef typename _Operation::second_argument_type argument_type; typedef typename _Operation::result_type result_type; binder1st (const _Operation &oper, const typename _Operation::first_argument_type& x) : op (oper), value (x) { } result_type operator() (const argument_type& y) const { return op (value, y); } }; } // namespace bug int ff (int); int main () { bug::minus b; bug::binder1st< bug::minus > u (b, 1); const int uu = u (0); return ff (uu); } {noformat} Here is the output when compiled with {{+O1}} {noformat} $ aCC -c -mt -AA -O1 +w u.cpp "u.cpp", line 39: remark #4227-D: padding struct with 3 bytes to align member "value" typename _Operation::first_argument_type value; ^ detected during instantiation of class "bug::binder1st<_Operation> [with _Operation=bug::minus]" at line 63 "u.cpp", line 63: remark #2340-D: value copied to temporary, reference to temporary used bug::binder1st< bug::minus > u (b, 1); ^ "u.cpp", line 65: remark #2340-D: value copied to temporary, reference to temporary used const int uu = u (0); ^ {noformat} And here is the result when compiling with {{+O2}} {noformat} $ aCC -c -mt -AA +O2 +w u.cpp "u.cpp", line 39: remark #4227-D: padding struct with 3 bytes to align member "value" typename _Operation::first_argument_type value; ^ detected during instantiation of class "bug::binder1st<_Operation> [with _Operation=bug::minus]" at line 63 "u.cpp", line 63: remark #2340-D: value copied to temporary, reference to temporary used bug::binder1st< bug::minus > u (b, 1); ^ "u.cpp", line 65: remark #2340-D: value copied to temporary, reference to temporary used const int uu = u (0); ^ "u.cpp", line 48, procedure main: warning #20035-D: variable "b" is used before its value is set {noformat} If we fold {{b}} into the definition of {{u}} like {{bug::binder1st< bug::minus > u (bug::minus(), 1)}} the warning goes away. If we use a local variable for {{1}} the warning goes away... > [HP aCC 6.16] warning #20035-D: variable is used before its value is set in functional > -------------------------------------------------------------------------------------- > > Key: STDCXX-772 > URL: https://issues.apache.org/jira/browse/STDCXX-772 > Project: C++ Standard Library > Issue Type: Sub-task > Components: Tests > 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: Travis Vitek > Fix For: 4.2.1 > > Original Estimate: 2h > Remaining Estimate: 2h > > aCC -c -mt -I/amd/devco/scottz/stdcxx/4.2.x/include -I/build/scottz/12d/include -I/amd/devco/scottz/stdcxx/4.2.x/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 /amd/devco/scottz/stdcxx/4.2.x/tests/utilities/20.function.objects.cpp > "/amd/devco/scottz/stdcxx/4.2.x/include/functional", line 320, procedure test_binders: warning #20035-D: variable "obj_minus" is used before its value is set -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.