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 fortran/45793] [4.6 Regressions] Numerous test-suite failures


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45793

--- Comment #4 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2010-09-26 03:33:09 UTC ---
This is the same location I was seeing the failure before. Now I have no
segfault, but valgind shows:

==17145== 48 (32 direct, 16 indirect) bytes in 2 blocks are definitely lost in
loss record 48 of 459
==17145==    at 0x4A0515D: malloc (vg_replace_malloc.c:195)
==17145==    by 0xCCBB27: xmalloc (xmalloc.c:147)
==17145==    by 0x4F4504: gfc_getmem (misc.c:37)
==17145==    by 0x4F6E0A: create_int_parameter_array.constprop.22
(module.c:5345)
==17145==    by 0x4F7629: use_iso_fortran_env_module (iso-fortran-env.def:91)
==17145==    by 0x4FBA2E: gfc_use_module (module.c:5541)
==17145==    by 0x4FFCF4: accept_statement (parse.c:1574)
==17145==    by 0x502A8A: parse_spec (parse.c:2588)
==17145==    by 0x504818: parse_progunit (parse.c:3922)
==17145==    by 0x50560B: gfc_parse_file (parse.c:4329)
==17145==    by 0x53CBF7: gfc_be_parse_file (f95-lang.c:242)
==17145==    by 0x83329F: toplev_main (toplev.c:955)
==17145== 

Look at the code. e is declared in the function as typr gfc_expr *
Unfortunately no pointer is ever allocated for it.  It is just luck that it is
not segfaulting!

static void
create_int_parameter_array (const char *name, int size, gfc_expr *value,
                const char *modname, intmod_id module, int id)
{
  gfc_symtree *tmp_symtree;
  gfc_symbol *sym;
  gfc_expr *e;

  tmp_symtree = gfc_find_symtree (gfc_current_ns->sym_root, name);
  if (tmp_symtree != NULL)
    {
      if (strcmp (modname, tmp_symtree->n.sym->module) == 0)
    return;
      else
    gfc_error ("Symbol '%s' already declared", name);
    }

  gfc_get_sym_tree (name, gfc_current_ns, &tmp_symtree, false);
  sym = tmp_symtree->n.sym;

  sym->module = gfc_get_string (modname);
  sym->attr.flavor = FL_PARAMETER;
  sym->ts.type = BT_INTEGER;
  sym->ts.kind = gfc_default_integer_kind;
  sym->attr.use_assoc = 1;
  sym->from_intmod = module;
  sym->intmod_sym_id = id;
  sym->attr.dimension = 1;
  sym->as = gfc_get_array_spec ();
  sym->as->rank = 1;
  sym->as->type = AS_EXPLICIT;
  sym->as->lower[0] = gfc_get_int_expr (gfc_default_integer_kind, NULL, 1);
  sym->as->upper[0] = gfc_get_int_expr (gfc_default_integer_kind, NULL, size); 

  sym->value = value;
  e->shape = gfc_get_shape (1);
  mpz_init_set_ui (e->shape[0], size);
}


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