delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1992/08/11/19:03:10

Date: Mon, 10 Aug 92 18:36:33 PRT
From: "Jose M. Cerqueira Esteves" <FESTEVES%PTEARN AT clvm DOT clarkson DOT edu>
Subject: Yet another bug with long long ints...
To: djgpp AT sun DOT soe DOT clarkson DOT edu

Greetings


When the following program is compiled without optimization, no errors
are reported (and the resulting program runs well); but, if one of the
options "-O" or "-O2" is used, GCC (cc1, in fact) crashes, saying

    Exception 117 at eip=b2565

This does not happen when the instruction "dd &= 0x7FFFFFFFFFFFFFFFLL"
is removed.

Is it possible that this is a DJGPP-specific error, or should I report
this to the mailing list concerned with GCC bugs?

---------------------------------------------------------------------
#include <stdio.h>

long long int aa,bb,dd;
long int i,j;

void
main ()
{
  scanf ("%li %li", &i, &j);
  aa = (long long int) i;
  bb = (long long int) j;
  dd = aa*bb;
  dd &= 0x7FFFFFFFFFFFFFFFLL;  /* <--- This reveals a bug with -O */
  i = *(long int *) &dd;
  j = *(((long int *) &dd)+1);
  printf ("%li %li\n", i, j);

}
---------------------------------------------------------------------

I am using DJGPP 1.07 on a 486, under MS-DOS 5.00.


                                       Jos\'e Esteves
Acknowledge-To: <FESTEVES AT PTEARN>

- Raw text -


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