This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/77432] New: warn about null check after pointer dereference


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 ();
  ....
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]