You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@stdcxx.apache.org by "Martin Sebor (JIRA)" <ji...@apache.org> on 2008/03/24 22:09:24 UTC
[jira] Created: (STDCXX-793) [HP aCC 6.16] bogus warning #20200 on
safe code with new expression
[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.