This is the mail archive of the 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 tree-optimization/25962] New: Pointer (null) check after the use

In file gcc/cgraphunit.c, function verify_cgraph_node(struct cgraph_node
*node), the input argument 'node' has been dereferenced before doing any
checking till on line 717 with following codition,
717 if (!node)
718    {
719      error ("node not found in DECL_ASSEMBLER_NAME hash");
720      error_found = true;
721    }

Shouldn't this code be moved at the begining of this function? before
de-referencing it?

Also, on line 789-793, if there is any error, we call dump_cgraph_node(), which
dumps the cgraph node. Shouldn't we do a check for non-null 'node', either here
before calling or in function dump_cgraph_node() itself? This has been,
reported as a possible error by 'coverity prevent tool'.

Any thoughts?

           Summary: Pointer (null) check after the use
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: uttamp at us dot ibm dot com

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