comp.lang.ada
 help / color / mirror / Atom feed
* Comparison with 0 distorts Long_Long_Integer
@ 1998-01-14  0:00 Dmitriy Anisimkov
  1998-01-14  0:00 ` Robert Dewar
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitriy Anisimkov @ 1998-01-14  0:00 UTC (permalink / raw)



I'm use GNAT-3-10 for Win32 and found the BUG :
--------------------------------
with Text_Io,Machine_Code;
procedure Rli is
   use Text_Io;    

   subtype IComp is Long_Long_Integer;
   package Comp_Io is new Integer_IO(IComp); use Comp_Io;

   C : constant Icomp := 16#1234_0000_0000#;
   Cb : Icomp;
begin
   Cb := C;
   if Cb=0 then 
-- Comparison with 0 distorts Long_Long_Integer
      null;
   end if;
   if C/=Cb then
-- it's wrong
      Put(" C ="); Put(C,0,16); New_Line;
      Put(" Cb="); Put(Cb,0,16); New_Line;
   end if;
end Rli;
-------------------------------
same function in C  :

/**************************/
#include <stdio.h>
int main(void){
  signed long long int c = 0x123400000000L;
  signed long long int cb;
  cb = c;
  if(cb==0L){
    printf("Comparison with 0 distorts signed long long int");
  }
  if (c!=cb){
    printf("%l %l",c,cb);
  }
  return 0;
}
/**************************/

from C code

  if(cb==0L){...

generates assembler code

/ GNU C version 2.7.2 (i586-pc-mingw32) compiled by GNU C version 2.7.2.
...
	movl -12(%ebp),%edx
	orl %edx,-16(%ebp) ; Corruption
	cmpl $0,-16(%ebp)
	jne L2 

I think, it must be 

	movl -12(%ebp),%edx
	orl -16(%ebp),%edx
	cmpl $0,%edx
	jne L2 


Does anybody know how to correct this ? May be it is possible to change any
EXE files ?





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1998-01-15  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-01-14  0:00 Comparison with 0 distorts Long_Long_Integer Dmitriy Anisimkov
1998-01-14  0:00 ` Robert Dewar
1998-01-15  0:00   ` Dmitriy Anisimkov
1998-01-15  0:00     ` Robert Dewar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox