Intel Fortan module symbol conflict

Intel Fortan module symbol conflict

Post by Joe Krah » Sat, 03 Jun 2006 04:39:09


I discovered that Intel Fortran uses module symbol names that conflict
with allowed procedure names. Module symbols are lower case module-name
plus procedure-name joined by "_mp_". They should have used an upper
case _MP_ (or something else) to make it distinct from external
procedure names. I reported this, and they replied that fixing this
error would cause too many problems due to being an incompatible binary
change.

My feeling is that recompiling all modules for a project is not seen as
a big problem by most Fortran developers, and that it is better to fix
the mistake now rather than propagate it further. On the other hand, the
odds of unintentionally having a conflicting name are quite small.

So, what do other people think? Is it better to fix an obscure bug, or
avoid binary compatibility changes?

In case my explanation was not clear, the following code will not work
in Intel Fortran:

subroutine x_mp_y()
end subroutine x_mp_y
module x
contains
subroutine y()
end subroutine y
end module x


Joe
 
 
 

Intel Fortan module symbol conflict

Post by nospa » Sat, 03 Jun 2006 04:52:10


I'm frankly surprised the bug even exists. I'd think this should have
been obvious. I also don't think it is that obscure a bug. I know that
most other compilers get this right because I've seen the internal names
and see how they avoid conflicts. I guess I had thought that all the
vendors knew what the problem was and how to avoid it. It is a direct
violation of the standard. There was even a somewhat related interp back
in f77. (Basically that was on symbol names for main programs, and the
answer was that the compiler had to "stay out of the way" of all valid
user names. I abbreviate and use my own wording, but that was the
essence.)

I'd say it should be fixed and that they are in danger of failing
someone's conformance testing suites without fixing it. But I doubt that
a "vote" in this forum is going to be the main decider as to whether or
not they fix it.

--
Richard Maine | Good judgment comes from experience;
email: my first.last at org.domain| experience comes from bad judgment.
org: nasa, domain: gov | -- Mark Twain

 
 
 

Intel Fortan module symbol conflict

Post by Joe Krah » Sat, 03 Jun 2006 05:03:54


I realized the problem when I saw the symbol names. I thought surely I
had missed something, and tried some test code.

I don't think votes here will carry a lot of weight, but it might
persuade them to actually ask some customers. There's also the problem
that it is (I think) an embarrassing bug, which they hope more people
won't notice. But, if it has been publicly discussed, avoiding
embarrassment is less of an influence.

Joe
 
 
 

Intel Fortan module symbol conflict

Post by robert.cor » Sat, 03 Jun 2006 11:41:41


The use of upper case to solve the problem has the drawback that most
compilers provide an option to make names case sensitive. You have
the right idea though. Some form of name translation should be used.
An obvious one would be to add an extra underscore to any sequence
of underscores that appears in a user name. Then, the sequence
"_mp_" could be shortened to simply "_".

I sympathize with Intel's position. Any change is going to break
existing
codes. Given that the problem is rare (if it were common they would
have
had to have fixed it by now), I understand not wanting to change. Were
it
my problem, I would add an option to give standard conforming behavior
and a long lead time with lots of warning before switching the default.

Bob Corbett
 
 
 

Intel Fortan module symbol conflict

Post by Jugoslav D » Sat, 03 Jun 2006 16:11:41


| I discovered that Intel Fortran uses module symbol names that conflict
| with allowed procedure names. Module symbols are lower case module-name
| plus procedure-name joined by "_mp_". They should have used an upper
| case _MP_ (or something else) to make it distinct from external
| procedure names. I reported this, and they replied that fixing this
| error would cause too many problems due to being an incompatible binary
| change.
|
| My feeling is that recompiling all modules for a project is not seen as
| a big problem by most Fortran developers, and that it is better to fix
| the mistake now rather than propagate it further. On the other hand, the
| odds of unintentionally having a conflicting name are quite small.
|
| So, what do other people think? Is it better to fix an obscure bug, or
| avoid binary compatibility changes?
|
| In case my explanation was not clear, the following code will not work
| in Intel Fortran:

Which version of Intel Fortran are we talking about? At least on Windows,
the default name translation is uppercase, so that in your example:

| subroutine x_mp_y()
| end subroutine x_mp_y
| module x
| contains
| subroutine y()
| end subroutine y
| end module x

the two routines will be mangled as _X_MP_Y and _X_mp_Y respectively,
causing no conflict. Now, if you switch the name representation to
lowercase by compiler option, I doubt they'll reverse the _mp_ into
_MP_. Which is an inconvenience indeed. If you switch name mangling
to case-sensitive (as-is), you will always be able to cheat the compiler.
(Well, they maybe could have used "?" or something as separator, but
the current method has the advantage that that the module procedures
are callable from C).


--
Jugoslav
___________
www.xeffort.com

Please reply to the newsgroup.
You can find my real e-mail on my home page above.
 
 
 

Intel Fortan module symbol conflict

Post by robert.cor » Sat, 03 Jun 2006 18:41:06


Sun f95 uses the full stop character as its separator. It is possible
to call Sun f95 module procedures from Sun C, but the C
programmer has to use a #pragma to do it. I think that is an
advantage. A programmer should have to work to reach into a
Fortran module from C.

Bob Corbett
 
 
 

Intel Fortan module symbol conflict

Post by Brooks Mos » Sun, 04 Jun 2006 10:18:36


It is worse, yes. The compiler ought to mangle the module subroutine
names into something that is not valid as an external subroutine name,
so that it is impossible to have a conflict. Prepending an underscore
does that, since Fortran doesn't allow names to begin with underscores.

- Brooks


--
The "bmoses-nospam" address is valid; no unmunging needed.
 
 
 

Intel Fortan module symbol conflict

Post by Joe Krah » Thu, 08 Jun 2006 05:04:56


I think that earlier Intel compilers joined names with "..", which
avoided the conflict, but which might cause other problems with allowed
symbol names.

Changing the rules should not break existing code, except the need to
recompile when a dependent module is recompiled, *IF* the module
interface is designed well. The compiler's module data (.mod file)
should specify the full symbol names, so that a module user does not
have to know the mangling rules. That way, a given module can define any
name merging/mangling rule and it only affects the module user if the
module is recompiled.

Actually, it might be a good idea for a compiler to have a mechanism for
letting the user specify the name mangling rules to avoid any other
unforeseen conflicts.

Joe