This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, Fortran, OOP] PR 46313: OOP-ABI issue, ALLOCATE issue, CLASS renaming issue
- From: Tobias Burnus <burnus at net-b dot de>
- To: Tobias Schlüter <tobias dot schlueter at physik dot uni-muenchen dot de>
- Cc: Janus Weil <janus at gcc dot gnu dot org>, Dominique Dhumieres <dominiq at lps dot ens dot fr>, fortran <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>, tkoenig <tkoenig at netcologne dot de>
- Date: Sun, 07 Nov 2010 14:19:13 +0100
- Subject: Re: [Patch, Fortran, OOP] PR 46313: OOP-ABI issue, ALLOCATE issue, CLASS renaming issue
- Newsgroups: gmane.comp.gcc.fortran, gmane.comp.gcc.patches
- References: <20101106233415.7DA533BE18@mailhost.lps.ens.fr> <AANLkTingHZS-rPzupUTTdCA_iQto9NavuQ5RGAPPd57i@mail.gmail.com> <4CD65B85.8030903@net-b.de> <AANLkTin6U3h=TcoVfW4wVSELy5LrdBFNZahxeFVKZdrE@mail.gmail.com> <4CD6977B.6010002@physik.uni-muenchen.de>
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_<procedure_name> 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
- References:
- Re: [Patch, Fortran, OOP] PR 46313: OOP-ABI issue, ALLOCATE issue, CLASS renaming issue
- From: Dominique Dhumieres
- Re: [Patch, Fortran, OOP] PR 46313: OOP-ABI issue, ALLOCATE issue, CLASS renaming issue
- Re: [Patch, Fortran, OOP] PR 46313: OOP-ABI issue, ALLOCATE issue, CLASS renaming issue
- Re: [Patch, Fortran, OOP] PR 46313: OOP-ABI issue, ALLOCATE issue, CLASS renaming issue
- Re: [Patch, Fortran, OOP] PR 46313: OOP-ABI issue, ALLOCATE issue, CLASS renaming issue