This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/29926] interface overloading assignment does not handle input types correctly
- From: "jeffrey dot armstrong at analexcleveland dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 21 Nov 2006 18:11:56 -0000
- Subject: [Bug fortran/29926] interface overloading assignment does not handle input types correctly
- References: <bug-29926-11177@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from jeffrey dot armstrong at analexcleveland dot com 2006-11-21 18:11 -------
Obviously what I included is strictly a simplified example. I'm trying to
emulate a 16-bit unsigned word in fortran, which should have a range from 0 to
65535. There are proprietary reasons for doing so in our code. To do this, i
am storing the bits in an integer(kind=2). Note that I am strictly storing the
bits, not an integer value. The easiest way to make an initial assignment is
to pass in an integer(kind=4) since it can handle the full range of unsigned
word values. When passed into the assignment statement, the routine
uword_assign_4 strips the first 16 bits from the integer(kind=4) for storage
into the uword's integer(kind=2) storage. Our module obviously has a
significant number of other unsigned word operations that are strictly
dependent on the bits stored in the integer(kind=2), not the actual integer
value.
The example is meant to demonstrate that when I pass integer(kind=4) through
the assignment, the routine uword_assign_4 should be called, which accepts an
integer(kind=4) and performs the necessary bit assignment operations on the
integer(kind=2), but never directly assigns the integer(kind=4) value to an
integer(kind=2). The compiler seems to be using uword_assign_2 when an
integer(kind=4) is used for assignment, which is erroneous.
I hope the above does clear up the example partially. The example really is
meant to be trivial. The code below compiles fine on Absoft Fortran versions 8
and 9 for Windows.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29926