You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by "Martin Sebor (JIRA)" <ji...@apache.org> on 2007/07/18 01:06:04 UTC

[jira] Created: (STDCXX-487) [Intel C++/Linux] bogus/inconsistent warning #279 on !"..."

[Intel C++/Linux] bogus/inconsistent warning #279 on !"..."
-----------------------------------------------------------

                 Key: STDCXX-487
                 URL: https://issues.apache.org/jira/browse/STDCXX-487
             Project: C++ Standard Library
          Issue Type: Bug
          Components: External
         Environment: Intel C++ 9 and 10/Linux
            Reporter: Martin Sebor


>From https://premier.intel.com/premier/IssueDetail.aspx?IssueID=431380:

The warning below is not justified and should not be issued. It produces noise for the common idiom: assert(!"...") used, for example, in case and switch statements to indicate unhandled cases. (I believe more recent versions of the EDG front end than the one used by icc 9 do not issue the warning anymore.)

$ cat t.cpp && icc -V t.cpp
int main (int argc, char**)
{
(!1 == argc) ? (void)0 : (void)0;
(!"" == argc) ? (void)0 : (void)0;
}
Intel(R) C Compiler for Intel(R) EM64T-based applications, Version 9.1 Build 20070320 Package ID: l_cc_c_9.1.049
Copyright (C) 1985-2007 Intel Corporation. All rights reserved.

Edison Design Group C/C++ Front End, version 3.6 (Mar 22 2007 02:18:08)
Copyright 1988-2005 Edison Design Group, Inc.

t.cpp(4): warning #279: controlling expression is constant
(!"" == argc) ? (void)0 : (void)0;
^

GNU ld version 2.15.92.0.2 20040927

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (STDCXX-487) [Intel C++/Linux] bogus/inconsistent warning #279 on !"..."

Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/STDCXX-487?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12513391 ] 

Martin Sebor commented on STDCXX-487:
-------------------------------------

Here's an enhanced test case showing that some warnings can be silenced by casting the expression to bool: 

$ cat t.cpp && icc -V t.cpp
int main ()
{
    ("") ? (void)0 : (void)1;
    ((bool)"") ? (void)0 : (void)1;
    (bool ("")) ? (void)0 : (void)1;
    (static_cast<bool>("")) ? (void)0 : (void)1;
}
Intel(R) C Compiler for applications running on Intel(R) 64, Version 10.0    Build 20070613 Package ID: l_cc_c_10.0.025
Copyright (C) 1985-2007 Intel Corporation.  All rights reserved.

Edison Design Group C/C++ Front End, version 3.8 (Jun 13 2007 18:48:37)
Copyright 1988-2006 Edison Design Group, Inc.

t.cpp(3): warning #279: controlling expression is constant
      ("") ? (void)0 : (void)1;
      ^

GNU ld version 2.15.92.0.2 20040927


> [Intel C++/Linux] bogus/inconsistent warning #279 on !"..."
> -----------------------------------------------------------
>
>                 Key: STDCXX-487
>                 URL: https://issues.apache.org/jira/browse/STDCXX-487
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: External
>         Environment: Intel C++ 9 and 10/Linux
>            Reporter: Martin Sebor
>
> From https://premier.intel.com/premier/IssueDetail.aspx?IssueID=431380:
> The warning below is not justified and should not be issued. It produces noise for the common idiom: assert(!"...") used, for example, in case and switch statements to indicate unhandled cases. (I believe more recent versions of the EDG front end than the one used by icc 9 do not issue the warning anymore.)
> $ cat t.cpp && icc -V t.cpp
> int main (int argc, char**)
> {
> (!1 == argc) ? (void)0 : (void)0;
> (!"" == argc) ? (void)0 : (void)0;
> }
> Intel(R) C Compiler for Intel(R) EM64T-based applications, Version 9.1 Build 20070320 Package ID: l_cc_c_9.1.049
> Copyright (C) 1985-2007 Intel Corporation. All rights reserved.
> Edison Design Group C/C++ Front End, version 3.6 (Mar 22 2007 02:18:08)
> Copyright 1988-2005 Edison Design Group, Inc.
> t.cpp(4): warning #279: controlling expression is constant
> (!"" == argc) ? (void)0 : (void)0;
> ^
> GNU ld version 2.15.92.0.2 20040927

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.