Thanks for the suggestions. The attached patch changes all "."-something
symbol names, which I found.
Build and regtested on x86-64-gnu-linux.
OK for the trunk and 4.7? (".saved_dovar" also occurs in 4.6; we could
also backport that part to 4.6, but I am not sure whether it is needed.)
We probably should also bump the .mod version (and timely also commit
the patch http://gcc.gnu.org/ml/fortran/2012-04/msg00033.html). Comments?
Tobias
Am 04.10.2012 01:07, schrieb David Edelsohn:
For C and C++, identifiers beginning with underscore and upper case
letter or with two underscores are reserve to the implementation. C++
uses _Z for mangling.
Maybe Fortran could prepend "_F". Something beginning with an
underscore seems like a much better choice, given the rules about
reserved identifiers.
Thanks, David
On Wed, Oct 3, 2012 at 5:00 PM, Tobias Burnus <bur...@net-b.de> wrote:
David,
David Edelsohn wrote:
I am not sure why you chose a period and how best to correct this.
Well, in principle any name which the user cannot enter would do. (Not
enter: At least not as valid Fortran identifier.)
The reason for choosing "." is that <dot><var_name> is used elsewhere in
gfortran for such identifier for the string-length variable belonging to
<var_name>, e.g. "._result" in trans-decl.c. I assume the reason that it
didn't pop up with those is that those are local variables, but I wouldn't
be surprised if it would break elsewhere.
I wonder whether "@" would work, otherwise, one could also use "_". The only
other problem is that it will break the ABI. On the other hand, it's a
rather new feature and if we bump the .mod version number, the chance that
one effectively forces the user to re-compile is rather high. So far we
always bumped the .mod version number as something changed. There are also
some other patches pending which effectively lead to a bump in the .mod
version.
(The .mod version won't affect code which doesn't use modules such as
BLAS/LAPACK or any Fortran 66/77 code, but those won't be affected by the
ABI change anyway as there the name doesn't propagate as it does with
modules..)
Thanks for investigating the test-suite failure.
Tobias
2012-10-04 Tobias Burnus <bur...@net-b.de>
* trans-decl.c (gfc_create_string_length, create_function_arglist):
Don't create a symbol which contains a dot.
* trans-stmt.c (gfc_trans_simple_do, gfc_trans_do): Ditto.
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 910b150..f41fc8b 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -1097,9 +1097,9 @@ gfc_create_string_length (gfc_symbol * sym)
/* Also prefix the mangled name. */
if (sym->module)
- name = gfc_get_string (".__%s_MOD_%s", sym->module, sym->name);
+ name = gfc_get_string ("_F_%s_MOD_%s", sym->module, sym->name);
else
- name = gfc_get_string (".%s", sym->name);
+ name = gfc_get_string ("_F%s", sym->name);
length = build_decl (input_location,
VAR_DECL, get_identifier (name),
@@ -1984,7 +1984,7 @@ create_function_arglist (gfc_symbol * sym)
length = build_decl (input_location,
PARM_DECL,
- get_identifier (".__result"),
+ get_identifier ("_Flen__result"),
len_type);
if (!sym->ts.u.cl->length)
{
@@ -2007,7 +2007,7 @@ create_function_arglist (gfc_symbol * sym)
{
tree len = build_decl (input_location,
VAR_DECL,
- get_identifier ("..__result"),
+ get_identifier ("_Flen2__result"),
gfc_charlen_type_node);
DECL_ARTIFICIAL (len) = 1;
TREE_USED (len) = 1;
diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c
index 204f069..37fc6ee 100644
--- a/gcc/fortran/trans-stmt.c
+++ b/gcc/fortran/trans-stmt.c
@@ -1376,7 +1376,7 @@ gfc_trans_simple_do (gfc_code * code, stmtblock_t *pblock, tree dovar,
/* Save value for do-tinkering checking. */
if (gfc_option.rtcheck & GFC_RTCHECK_DO)
{
- saved_dovar = gfc_create_var (type, ".saved_dovar");
+ saved_dovar = gfc_create_var (type, "_F_saved_dovar");
gfc_add_modify_loc (loc, pblock, saved_dovar, dovar);
}
@@ -1581,7 +1581,7 @@ gfc_trans_do (gfc_code * code, tree exit_cond)
/* Save value for do-tinkering checking. */
if (gfc_option.rtcheck & GFC_RTCHECK_DO)
{
- saved_dovar = gfc_create_var (type, ".saved_dovar");
+ saved_dovar = gfc_create_var (type, "_F_saved_dovar");
gfc_add_modify_loc (loc, &block, saved_dovar, dovar);
}