delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1992/05/05/23:07:16

Date: Wed, 6 May 92 12:50 +1000
From: Bill Metzenthen <APM233M AT vaxc DOT cc DOT monash DOT edu DOT au>
Subject: cc1.exe and as.exe incompatibility
To: djgpp AT sun DOT soe DOT clarkson DOT edu, dj AT ctron DOT com
Status: O

There is a serious incompatibility between cc1.exe and as.exe for the
80386. The following tiny program demonstrates the problem:

    #include <stdio.h>
    main()
    {
    unsigned u = (unsigned)-1;
    printf("%u is %f\n", u, (double)u);
    }

Compiled with the djgpp gcc, this program produces the remarkable result:

        4294967295 is -1.0000000

The problem lies in the
	fildll (%esp)
assembler instruction which is emitted by cc1.exe. This appears to be treated
by as.exe as if it were
	fildl (%esp)
If the intermediate .s file is edited to change the line to
	fildq (%esp)
then the correct code is produced by as.exe and the result of the little
program is

        4294967295 is 4294967295.0000000

The solution should be fairly simple, but probably requires a policy
decision - which is the correct mnemonic to use?
The work-around is as above: compile to a .s file, globally edit all
"fildll" to "fildq" and continue compiling.


--Bill

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019