delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/10/11/01:57:05

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT sourceware DOT cygnus DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT sourceware DOT cygnus DOT com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sourceware DOT cygnus DOT com>
List-Help: <mailto:cygwin-help AT sourceware DOT cygnus DOT com>, <http://sourceware.cygnus.com/ml/#faqs>
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Message-Id: <199910110556.HAA99802@ihfdfs.ihf.uni-stuttgart.de>
From: "Ulrich Jakobus" <jakobus AT ihf DOT uni-stuttgart DOT de>
To: "cygwin AT sourceware DOT cygnus DOT com" <cygwin AT sourceware DOT cygnus DOT com>
Cc: "feko AT emss DOT co DOT za" <feko AT emss DOT co DOT za>, "Isak Theron" <iptheron AT emss DOT co DOT za>
Date: Mon, 11 Oct 1999 07:56:05 +0200
Reply-To: "Ulrich Jakobus" <jakobus AT ihf DOT uni-stuttgart DOT de>
X-Mailer: PMMail 98 Standard (2.01.1600) For Windows 95 (4.0.1111)
MIME-Version: 1.0
Subject: Bug in GCC-2.95 in sscanf for long long?

Hello,

I am using gcc version "2.95 19990728 (release)" under the cygnus 
shell version (output of uname -a) "CYGWIN_95-4.0 IHFPCUJ 21.0 
(0.8/1/1) 1999-1-16 00:09:28 i586 unknown". 

I have problems with the sscanf function processing data of type 
long long, the following short code illustrates this:

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

int main()
{ 
  
  long long ll;

  /* this initialisation will result in a correct output: */
  /* ll = 0; */

  /* this initialisation will result in an incorrect output */
  ll = -9999999999;

  sscanf ("123456789", "%lld", &ll);
  printf ("%lld\n", ll);

  return (0);
}
---------------------------------------

The code as printed above gives the incorrect output
   -12761445099
to the screen. However, if the statement
   ll = -9999999999; 
is replaced by the initialisation
   ll = 0;
then the output is correct:
   123456789
When ll is not being initialised, then the output is unpredictable. 

Executing the same code on a LINUX system with either gcc-2.8.1 or
gcc-2.95.1 results in the correct output in all three cases. 

Ulrich




--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


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