stdcxx-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Sebor (JIRA)" <j...@apache.org>
Subject [jira] Created: (STDCXX-793) [HP aCC 6.16] bogus warning #20200 on safe code with new expression
Date Mon, 24 Mar 2008 21:09:24 GMT
[HP aCC 6.16] bogus warning #20200 on safe code with new expression
-------------------------------------------------------------------

                 Key: STDCXX-793
                 URL: https://issues.apache.org/jira/browse/STDCXX-793
             Project: C++ Standard Library
          Issue Type: Bug
          Components: External
         Environment: HP aCC 6.16
            Reporter: Martin Sebor


When compiled with HP aCC 6.16 with +w +O the program below produces a bogus cadvise warning
#20200. There is no potential for a null pointer dereference since operator new throws on
error and when {{(n == 0)}} holds the loop in {{bar()}} is not entered.

{noformat}
$ cat t.cpp && aCC -V -c +O2 +w t.cpp
struct A {
    char *s;
    A (unsigned n) {
        if (n) s = new char [n]; 
        else s = 0;
    }
};

char* bar (unsigned n) {
    A a (n);
    for (unsigned i = 0; i != n; ++i)
        a.s [i] = '\0';
    return a.s;
}
aCC: HP C/aC++ B3910B A.06.16 [Nov 26 2007]
"t.cpp", line 12, procedure bar: warning #20200-D: Potential null pointer
          dereference through a is detected (null definition:t.cpp, line 5)
{noformat}

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


Mime
View raw message