From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 49414 invoked by alias); 17 Sep 2018 08:59:26 -0000 Mailing-List: contact fortran-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: fortran-owner@gcc.gnu.org Received: (qmail 49388 invoked by uid 89); 17 Sep 2018 08:59:26 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=CLASS, HTo:U*janus, teach, vtabs X-HELO: mail-oi0-f66.google.com Received: from mail-oi0-f66.google.com (HELO mail-oi0-f66.google.com) (209.85.218.66) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 17 Sep 2018 08:59:24 +0000 Received: by mail-oi0-f66.google.com with SMTP id 8-v6so18269253oip.0; Mon, 17 Sep 2018 01:59:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8sZi628iQnfb1FQY4//mCIGZ3/6W0CkckfwAcEFPLb8=; b=CHhsswao7c+BveCKlGoOApXt4w5xfXLaR5kzKyjkIqlP4fkyb8iaSUenq9e1et1SMv BYbBSf4Iv9Kqz34S6zv7XZEKTEjHORnbPMOgCayUwsYNE6P70jB7GZ8hxY6lHnhq3l27 tEhRzQE4DZ68CvydQaavtOIflFsGnUGOJzSFgi/jGcKkKOejXroGI1LW2Fp1Wujtekpz 12YvGusc8G54t5pbLX69A/W+BQ4cPQRcdjqtsQQ00rkNQEcRoGod8pXpzo8RO8nXmBxh P8ZUwM8kO9SHB3L7agYlhO+ljl8FcOGwTBW/fGCI7BwrMoLtowFhpjVBZxv+lRSx4Ggj 1NgQ== MIME-Version: 1.0 References: <4CD6D94A.408@net-b.de> <4CD7FAA5.3050108@net-b.de> In-Reply-To: From: Bernhard Reutner-Fischer Date: Mon, 17 Sep 2018 08:59:00 -0000 Message-ID: Subject: Re: [Patch, Fortran, OOP] PR 46313: OOP-ABI issue, ALLOCATE issue, CLASS renaming issue To: Janus Weil Cc: Tobias Burnus , gfortran , GCC Patches Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2018-09/txt/msg00108.txt.bz2 On Tue, 9 Nov 2010 at 11:41, Janus Weil wrote: > > >> Ok, so it seems to me that using two leading underscores is really the > >> best option, since it's safe against collisions with Fortran and C > >> user code, and also safe to use with -fdollar-ok. > >> > >> The attached patch adds double underscores for the vtabs, vtypes, > >> class containers and temporaries. > > > > OK. Thanks for the patch! > > Committed as r166480. > > Thanks for all the helpful comments, everyone! Index: gcc/fortran/module.c =================================================================== --- gcc/fortran/module.c (revision 166419) +++ gcc/fortran/module.c (working copy) @@ -4372,8 +4372,8 @@ read_module (void) p = name; /* Exception: Always import vtabs & vtypes. */ - if (p == NULL && (strncmp (name, "vtab$", 5) == 0 - || strncmp (name, "vtype$", 6) == 0)) + if (p == NULL && (strncmp (name, "__vtab_", 5) == 0 + || strncmp (name, "__vtype_", 6) == 0)) p = name; /* Skip symtree nodes not in an ONLY clause, unless there ---8<--- Sorry for the late follow-up but current trunk still has the code quoted above where we forgot to add 2 to the length parameter of both strncmp calls. I think it would be nice to teach the C and C++ frontends to warn about this even though it might trigger in quite some code in the wild. Looking at gcc/fortran alone there are gcc/fortran/interface.c: if (strncmp (mode, "unformatted", 9) == 0) // 11 ! gcc/fortran/module.c: && (strncmp (name, "__vtab_", 5) == 0 // 7 ! gcc/fortran/module.c: || strncmp (name, "__vtype_", 6) == 0)) // 8! gcc/fortran/module.c: || (strncmp (name, "__vtab_", 5) != 0 // 7! gcc/fortran/module.c: && strncmp (name, "__vtype_", 6) != 0)) // 8! so warning by default with -Wall or at least per default in -Wextra would make sense IMO. cheers,