From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4014 invoked by alias); 7 Nov 2010 13:19:24 -0000 Received: (qmail 3989 invoked by uid 22791); 7 Nov 2010 13:19:23 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mx01.qsc.de (HELO mx01.qsc.de) (213.148.129.14) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 07 Nov 2010 13:19:17 +0000 Received: from [192.168.178.22] (port-92-204-76-125.dynamic.qsc.de [92.204.76.125]) by mx01.qsc.de (Postfix) with ESMTP id BEAB83D79E; Sun, 7 Nov 2010 14:19:14 +0100 (CET) Message-ID: <4CD6A751.6090807@net-b.de> Date: Sun, 07 Nov 2010 13:19:00 -0000 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.12) Gecko/20101026 SUSE/3.1.6 Thunderbird/3.1.6 MIME-Version: 1.0 Newsgroups: gmane.comp.gcc.fortran,gmane.comp.gcc.patches To: =?ISO-8859-1?Q?Tobias_Schl=FCter?= CC: Janus Weil , Dominique Dhumieres , fortran , gcc-patches , tkoenig Subject: Re: [Patch, Fortran, OOP] PR 46313: OOP-ABI issue, ALLOCATE issue, CLASS renaming issue References: <20101106233415.7DA533BE18@mailhost.lps.ens.fr> <4CD65B85.8030903@net-b.de> <4CD6977B.6010002@physik.uni-muenchen.de> In-Reply-To: <4CD6977B.6010002@physik.uni-muenchen.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-IsSubscribed: yes 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 X-SW-Source: 2010-11/txt/msg00120.txt.bz2 Tobias Schlüter wrote: > On 2010-11-07 13:04, Janus Weil wrote: >>>> Yes, that is expected, because the patch changes the name of the vtab >>>> to "vtab$main$dt", so one needs to change the name of the subroutine >>>> in the test case in the same way in order to see the failure: > > Sorry I'm late, but gcc has the macro ASM_FORMAT_PRIVATE_NAME which does > the work of making a name collision-free. If you use it you can make the > rest of the name as readable as you want. I think that it won't work. One needs the same assembler name for in each translation unit as there is one, common, global vtable per base type. My understanding is that ASM_FORMAT_PRIVATE_NAME would generate several disjunct assembler names... >> The best option I can currently see is to use leading underscores (as >> in "_vtab_main_dt"). This is forbidden in Fortran (cf. F08:R303), but >> accepted by the assembler (cf. >> http://sourceware.org/binutils/docs-2.20/as/Symbol-Names.html#Symbol-Names). >> >> Attached is a patch which does this change. I also added a few macros >> in gfortran.h. Ok for trunk after successful regtest? +static void +get_unique_type_string (char *string, gfc_symbol *derived) +{ + if (derived->module) + sprintf (string, "%s_%s", derived->module, derived->name); + else + sprintf (string, "%s_%s", derived->ns->proc_name->name, derived->name); +} I wonder whether that works for cases like: * module name == procedure name * internal procedures == procedure name / module name. * Nested submodules (when implemented) I assume defining the same-named (and disjunct) DT in a module and separately in a subroutine is weird; with internal procedures and submodules it will start to get crazy. But shouldn't one do something like _proc_ for procedures? A {module/procedure name}_internal-proc-name? Alternatively, one can defer it until a real-world bug report comes (which I think is very unlikely). (And, at some point, the name becomes too long and one could think of using a hash name as in GCC's C++ compiler.) Tobias