This is the mail archive of the gcc-patches@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]

gengtype & plugins [#define emitted in wrong order]


Hello All,

A big thanks for the gengtype patches for plugin finalized by
Rafael Avila de Espindola  <espindola@google.com>

See also
http://gcc.gnu.org/ml/gcc-patches/2009-09/msg02104.html
http://gcc.gnu.org/ml/gcc-patches/2009-09/msg02057.html

The current gengtype of trunk 152325 is now able to run correctly for MELT. It does not crash, thanks to Rafael!


However, it seems to me that in plugin mode, the #define are emitted in the wrong order. To be specific, in plugin mode, the generated gt-melt-runtime.h with


 /usr/src/Lang/_Boot_Gcctrunk/gcc/build/gengtype -P gt-melt-runtime.h \
	      /usr/src/Lang/gcc-trunk-bstarynk/gcc our-gtyp-input.list \
	      melt-runtime.h melt-runtime.c

where /usr/src/Lang/_Boot_Gcctrunk is the GCC trunk build directory, and
/usr/src/Lang/gcc-trunk-bstarynk/ is the GCC trunk source directory

contains first at line 28 to 46

void
gt_ggc_mx_VEC_melt_ptr_t_gc (void *x_p)
{
  struct VEC_melt_ptr_t_gc * const x = (struct VEC_melt_ptr_t_gc *)x_p;
  if (ggc_test_and_set_mark (x))
    {
      {
        size_t i0;
        size_t l0 = (size_t)(((*x).base).num);
        for (i0 = 0; i0 != l0; i0++) {
          gt_ggc_m_7melt_un ((*x).base.vec[i0]);
        }
      }
    }
}

and only next at line 106 to 109
#define gt_ggc_m_7melt_un(X) do { \
  if (X != NULL) gt_ggc_mx_melt_un (X);\
  } while (0)
extern void gt_ggc_mx_melt_un (void *);


This is clearly incorrect. To make it short, in plugin mode, all the generated #define gt_ggc_*
should be output before the routine code.


If you want to reproduce the bug, follow instructions in
http://gcc.gnu.org/wiki/MELT%20tutorial section building and using MELT as a plugin of course taking the trunk's gengtype!



I will investigate later (perhaps in 2 days) the details. I suspect a simple change in gengtype.c should suffice, so I hope such a change is acceptable in stage 3, since it is really a bug fix.



Regards.


PS. I hope this does belong to gcc-patches@ since we are discussing recent patches & commits. I am sorry to not provide a correction here.

--
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mines, sont seulement les miennes} ***


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