Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
-
HP aCC 6.16
-
Compiler Warning
Description
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.
$ 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)
Attachments
Issue Links
- is depended upon by
-
STDCXX-748 [HP aCC 6.16] Potential null pointer dereference in <valarray>
- Resolved