From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31075 invoked by alias); 30 Sep 2009 21:21:51 -0000 Received: (qmail 31060 invoked by uid 22791); 30 Sep 2009 21:21:49 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from smtp-103-wednesday.nerim.net (HELO kraid.nerim.net) (62.4.16.103) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 30 Sep 2009 21:21:45 +0000 Received: from hector.lesours (ours.starynkevitch.net [213.41.244.95]) by kraid.nerim.net (Postfix) with ESMTP id 087DFCF257 for ; Wed, 30 Sep 2009 23:21:42 +0200 (CEST) Received: from glinka.lesours ([192.168.0.1]) by hector.lesours with esmtp (Exim 4.69) (envelope-from ) id 1Mt6cO-0002Jz-Ho for gcc-patches@gcc.gnu.org; Wed, 30 Sep 2009 23:21:48 +0200 Message-ID: <4AC3CBF5.9030008@starynkevitch.net> Date: Wed, 30 Sep 2009 21:39:00 -0000 From: Basile STARYNKEVITCH User-Agent: Mozilla-Thunderbird 2.0.0.22 (X11/20090701) MIME-Version: 1.0 To: gcc-patches Subject: gengtype & plugins [#define emitted in wrong order] Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2009-09/txt/msg02277.txt.bz2 Hello All, A big thanks for the gengtype patches for plugin finalized by Rafael Avila de Espindola 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: basilestarynkevitchnet mobile: +33 6 8501 2359 8, rue de la Faiencerie, 92340 Bourg La Reine, France *** opinions {are only mines, sont seulement les miennes} ***