------- Comment #7 from pault at gcc dot gnu dot org  2009-04-25 18:06 -------
(In reply to comment #6)

With the pointer initialization, the assignment   u%model = u%design
is translated to:

  {
    struct tao_lattice_struct D.1667;

    D.1667 = *u->design;
    tao_lat_equal_tao_lat (u->model, &D.1667);
    if (D.1667.bunch_params.data != 0B)
      {
        __builtin_free (D.1667.bunch_params.data);
      }
    D.1667.bunch_params.data = 0B;
    if (D.1667.bunch_params2.data != 0B)
      {
        __builtin_free (D.1667.bunch_params2.data);
      }
    D.1667.bunch_params2.data = 0B;
  }

Thus the data pointers are doubly freed because they are not nullified in
u->design

Once the initialization is gone, the assignment becomes

  tao_lat_equal_tao_lat (u->model, u->design);

and the cause of the problem has vanaished.

Paul


-- 


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

Reply via email to