This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Porting software to Linux
- To: "'bug-gcc at gnu dot org'" <bug-gcc at gnu dot org>
- Subject: Porting software to Linux
- From: Marilyn Celestin <marilyn at CAE dot CA>
- Date: Tue, 21 Dec 1999 13:49:53 -0500
Good afternoon,
I am currently porting software from IBM to Linux. I noticed something
particular regarding hexadecimal constants. It seems that if I use the =
IBM
format for the hexadecimal constants ('FFFF'x) and compile with the
-fugly-logint option the constant is taken to be an integer*2. On the =
other
hand if I use the Linux format for hexadecimal constants (X'FFFF') and
compile with the -fugly-logint option the constant is interpreted as an
integer*4. This will give 2 different results.
We have written a little test program to verify this:
program try
implicit none
integer*2 k,h
k =3D -1
h =3D k
if (h .eq. x'ffff') write (6,*) 'h equals' !ffff treated as =
i*4
if (k .eq. 'ffff'x) write (6,*) 'k equals' !ffff treated as =
i*2
end =20
The code was compiled with f77 -fugly-logint -o try try.f
The result was:
K equals
Is this a compiler error? Shouldn't the -fugly-logint option give the =
same
result in both cases?
Thank you in advance.
Marilyn
PS: This is the output of g77 -v
g77 version 2.95.1 19990816 (release) (from FSF-g77 version 0.5.25 =
19990816
(release))
Driving: g77 -v -c -xf77-version /dev/null -xnone
Reading specs from =
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.1/specs
gcc version 2.95.1 19990816 (release)
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.1/cpp -lang-c -v =
-D__GNUC__=3D2
-D__GNUC_MINOR__=3D95 -D__ELF__ -D__unix__ -D__i386__ -D__linux__ =
-D__unix
-D__linux -Asystem(posix) -D_LANGUAGE_FORTRAN -traditional -Acpu(i386)
-Amachine(i386) -Di386 -D__i386 -D__i386__ -Di686 -Dpentiumpro -D__i686
-D__i686__ -D__pentiumpro -D__pentiumpro__ /dev/null /dev/null
GNU CPP version 2.95.1 19990816 (release) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
=20
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.1/../../../../i686-pc-linu=
x-gn
u/include
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.1/include
/usr/include
End of search list.
The following default directories have been omitted from the search =
path:
=
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.1/../../../../include/g++-=
3
End of omitted list.
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.1/f771 -fnull-version =
-quiet
-dumpbase g77-version.f -version -fversion -o /tmp/cc4qvA4t.s /dev/null
GNU F77 version 2.95.1 19990816 (release) (i686-pc-linux-gnu) compiled =
by
GNU C version 2.95.1 19990816 (release).
GNU Fortran Front End version 0.5.25 19990816 (release)
/usr/local/i686-pc-linux-gnu/bin/as -V -Qy -o /tmp/ccOeibcN.o
/tmp/cc4qvA4t.s
GNU assembler version 2.9.1 (i686-pc-linux-gnu), using BFD version
2.9.1.0.19
/usr/local/i686-pc-linux-gnu/bin/ld -m elf_i386 -dynamic-linker
/lib/ld-linux.so.2 -o /tmp/ccsLhS55 /tmp/ccOeibcN.o /usr/lib/crt1.o
/usr/lib/crti.o =
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.1/crtbegin.o
-L/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.1
-L/usr/local/i686-pc-linux-gnu/lib -L/usr/local/lib -lg2c -lm -lgcc -lc
-lgcc /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.1/crtend.o
/usr/lib/crtn.o
/tmp/ccsLhS55
__G77_LIBF77_VERSION__: 0.5.25 19990816 (release)
@(#)LIBF77 VERSION 19990503
__G77_LIBI77_VERSION__: 0.5.25 19990816 (release)
@(#) LIBI77 VERSION pjw,dmg-mods 19990503
__G77_LIBU77_VERSION__: 0.5.25 19990816 (release)
@(#) LIBU77 VERSION 19980709
*********************************************************
Marilyn C=E9lestin =20
Y2k Update =20
CAE Electronics Ltd. =20
Dept: Computer System Engineering (73) =20
Tel.: (514) 341-6780 (2348) =20
email: marilyn@cae.ca =20