This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/77432] New: warn about null check after pointer dereference
- From: "manu at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 31 Aug 2016 19:27:59 +0000
- Subject: [Bug c++/77432] New: warn about null check after pointer dereference
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77432
Bug ID: 77432
Summary: warn about null check after pointer dereference
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: manu at gcc dot gnu.org
Target Milestone: ---
Simple testcase:
int foo(int *a)
{
int b = *a;
if (a)
return b;
return 0;
}
The check is too late to catch anything.
Bug in GCC: PR77425
and from PR77421 : http://www.viva64.com/en/b/0425/
odr_type
get_odr_type (tree type, bool insert)
{
....
odr_types[val->id] = 0;
gcc_assert (val->derived_types.length() == 0);
if (odr_types_ptr)
val->id = odr_types.length ();
....
}