Return-Path: Delivered-To: apmail-incubator-stdcxx-dev-archive@www.apache.org Received: (qmail 96859 invoked from network); 26 May 2006 17:53:14 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 26 May 2006 17:53:14 -0000 Received: (qmail 12831 invoked by uid 500); 26 May 2006 17:53:14 -0000 Delivered-To: apmail-incubator-stdcxx-dev-archive@incubator.apache.org Received: (qmail 12816 invoked by uid 500); 26 May 2006 17:53:14 -0000 Mailing-List: contact stdcxx-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: stdcxx-dev@incubator.apache.org Delivered-To: mailing list stdcxx-dev@incubator.apache.org Received: (qmail 12805 invoked by uid 99); 26 May 2006 17:53:14 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 May 2006 10:53:14 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [209.237.227.198] (HELO brutus.apache.org) (209.237.227.198) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 May 2006 10:53:13 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 1A5B17142EB for ; Fri, 26 May 2006 17:52:30 +0000 (GMT) Message-ID: <1578209.1148665950105.JavaMail.jira@brutus> Date: Fri, 26 May 2006 17:52:30 +0000 (GMT+00:00) From: "Martin Sebor (JIRA)" To: stdcxx-dev@incubator.apache.org Subject: [jira] Created: (STDCXX-190) [MSVC] bogus performance warning C4800: forcing value to bool MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [MSVC] bogus performance warning C4800: forcing value to bool ------------------------------------------------------------- Key: STDCXX-190 URL: http://issues.apache.org/jira/browse/STDCXX-190 Project: C++ Standard Library Type: Bug Components: External Versions: 4.1.3 Environment: MSVC all versions up to and including 8.0 Reporter: Martin Sebor Priority: Trivial Copied from http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=96a52a80-a701-4402-864a-abd03917538c: Bug ID: FDBK50482 Problem Type: Bug Status: New Microsoft Status: Not Reviewed Opened Date: 2006-05-26 10:42:12 Opened By: Martin Sebor Product/Technology: Visual C++ Version: Visual Studio 2005 Product Language: English Category: Language/Compiler OS: Windows 2000 Server OS Language: US English Submission Language: English Description: Opened by Martin Sebor on 2006-05-26 at 10:42:12 The warnings in the program below are bogus since the generated code is identical in all three cases. Steps to Reproduce: $ cat -n t.cpp && cl -c -W3 -O2 -nologo -Fa t.cpp 1 bool f1 (int i) 2 { 3 return i & 2; 4 } 5 6 bool f2 (int i) 7 { 8 const bool b = i & 2; 9 return b; 10 } 11 12 bool f3 (int i) 13 { 14 const bool b = 0 != (i & 2); 15 return b; 16 } t.cpp t.cpp(3) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) t.cpp(8) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) Actual Results: $ cat t.asm ; Listing generated by Microsoft (R) Optimizing Compiler Version 14.00.50727.42 TITLE C:\contrib\cygwin\tmp\t.cpp .686P .XMM include listing.inc .model flat INCLUDELIB LIBCMT INCLUDELIB OLDNAMES PUBLIC ?f1@@YA_NH@Z ; f1 ; Function compile flags: /Ogtpy ; COMDAT ?f1@@YA_NH@Z _TEXT SEGMENT _i$ = 8 ; size = 4 ?f1@@YA_NH@Z PROC ; f1, COMDAT ; File c:\contrib\cygwin\tmp\t.cpp ; Line 3 mov eax, DWORD PTR _i$[esp-4] shr eax, 1 and al, 1 ; Line 4 ret 0 ?f1@@YA_NH@Z ENDP ; f1 _TEXT ENDS PUBLIC ?f2@@YA_NH@Z ; f2 ; Function compile flags: /Ogtpy ; COMDAT ?f2@@YA_NH@Z _TEXT SEGMENT _i$ = 8 ; size = 4 ?f2@@YA_NH@Z PROC ; f2, COMDAT ; Line 8 mov eax, DWORD PTR _i$[esp-4] shr eax, 1 and al, 1 ; Line 10 ret 0 ?f2@@YA_NH@Z ENDP ; f2 _TEXT ENDS PUBLIC ?f3@@YA_NH@Z ; f3 ; Function compile flags: /Ogtpy ; COMDAT ?f3@@YA_NH@Z _TEXT SEGMENT _i$ = 8 ; size = 4 ?f3@@YA_NH@Z PROC ; f3, COMDAT ; Line 14 mov eax, DWORD PTR _i$[esp-4] shr eax, 1 and al, 1 ; Line 16 ret 0 ?f3@@YA_NH@Z ENDP ; f3 _TEXT ENDS END Expected Results: No warnings. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira