This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
H8300: converting unsigned int to float
- To: egcs-bugs at egcs dot cygnus dot com
- Subject: H8300: converting unsigned int to float
- From: Manfred Metzger <ManfredMetzger at gmx dot de>
- Date: Mon, 09 Aug 1999 20:27:26 +0200
Hi!
I am using GCC 2.95 for the Hitachi H8/300 on a Linux system
with glibc-2.1.
Compiling the following program does not work:
unsigned int uc;
float f1;
int main ()
{
f1 = uc;
return 0;
}
It fails with
pc1:/root # h8300-hms-gcc -v -save-temps test.c
Reading specs from /usr/lib/gcc-lib/h8300-hms/2.95/specs
gcc version 2.95 19990728 (release)
(...)
/usr/h8300-hms/bin/as -o test.o test.s
test.s: Assembler messages:
test.s:10: Error: cannot create floating-point number
The generated assembler-code looks like:
; GCC For the Hitachi H8/300
; By Hitachi America Ltd and Cygnus Support
; release F-1
.file "test.c"
.section .rodata
.align 1
.LC0:
.float 1.18305218616677471097e-269 <-- Here is the problem!
.section .text
.align 1
.global _main
_main:
push r6
mov.w r7,r6
push r4
push r5
mov.w @_uc,r1
bld #7,r1h
subx r0l,r0l
subx r0h,r0h
mov.w r1,r3
mov.w r0,r2
mov.w r2,r0
mov.w r3,r1
jsr @___floatsisf
mov.w r1,r5
mov.w r0,r4
mov.w @_uc,r2
mov.w r2,r2
bge .L3
mov.w @.LC0,r2
mov.w @.LC0+2,r3
mov.w r3,@-r7
mov.w r2,@-r7
mov.w r4,r0
mov.w r5,r1
jsr @___addsf3
adds #2,r7
adds #2,r7
mov.w r1,r3
mov.w r0,r2
mov.w r3,r5
mov.w r2,r4
.L3:
mov.w r4,r2
mov.w r5,r3
mov.w r2,@_f1
mov.w r3,@_f1+2
sub.w r0,r0
bra .L2
.L2:
pop r5
pop r4
pop r6
rts
.comm _uc,2
.comm _f1,4
.end
I also tried to compile this program with egcs-2.91.60
and with this version it worked.
It generates the line
.float 0.00000000000000000000e0
instead.
Regards,
Manni