[Bug 210828] lang/gcc6: gcc-6.1.0/gcc/fortran/decl.c has code producing a false positive for uninitialized status

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Mon Jul 4 21:17:04 UTC 2016


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=210828

            Bug ID: 210828
           Summary: lang/gcc6: gcc-6.1.0/gcc/fortran/decl.c has code
                    producing a false positive for uninitialized status
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: gerald at FreeBSD.org
          Reporter: markmi at dsl-only.net
             Flags: maintainer-feedback?(gerald at FreeBSD.org)
          Assignee: gerald at FreeBSD.org

gcc-6.1.0/gcc/fortran/decl.c has code has code of the structure:

static bool
add_hidden_procptr_result (gfc_symbol *sym)
{
  bool case1,case2;

  if (gfc_notification_std (GFC_STD_F2003) == ERROR)
    return false;

  /* First usage case: PROCEDURE and EXTERNAL statements.  */
  case1 = gfc_current_state () == COMP_FUNCTION && gfc_current_block ()
          && strcmp (gfc_current_block ()->name, sym->name) == 0
          && sym->attr.external;
  /* Second usage case: INTERFACE statements.  */
  case2 = gfc_current_state () == COMP_INTERFACE && gfc_state_stack->previous
          && gfc_state_stack->previous->state == COMP_FUNCTION
          && strcmp (gfc_state_stack->previous->sym->name, sym->name) == 0;

  if (case1 || case2)
    {
      gfc_symtree *stree;
      if (case1)
        gfc_get_sym_tree ("ppr@", gfc_current_ns, &stree, false);
      else if (case2)
        {
          gfc_symtree *st2;
          gfc_get_sym_tree ("ppr@", gfc_current_ns->parent, &stree, false);
          st2 = gfc_new_symtree (&gfc_current_ns->sym_root, "ppr@");
          st2->n.sym = stree->n.sym;
        }

The compiler used to compile lang/gcc6 complained about stree not being
initialized (when both parts of the if. . .else if. . . were not executed.

The code would be less likely to produce the false positive if the "if (case2)"
was not code: just use an else instead, possibly with a case2 comment.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-ports-bugs mailing list