Problem with scanf and float under Cygwin on Windows ME Operating System

Michael Wirta michaelwirta@satx.rr.com
Thu Feb 7 11:51:00 GMT 2002


I have been having a problem with scanf and floating point numbers in Cygwin
on a WindowsME machine.  I have run this same program under Linux and have
had no problems with it. As soon as the float number is entered the program
terminates abnormally.  The error message says there is a "Segmentation
Fault : Probably a corrupted stack." The program I used is below, followed
by the core dump file produced when the program is run. Note: I have not had
any problems with scanf using strings or integers, only floating point
numbers.  I saw others mention this problem in the Cygwin mailing list
archive, and someone reported that this bug had been fixed. However, I have
the latest version of Cygwin installed, with the gcc that is included with
the installation.  Anyone have any suggestions?

#include <stdio.h>

int main(void)
{
float a = 1;

printf("number a is %f \n",a);
scanf("===>%f",a);
printf("new number is %f \n",a);
exit(0);
}





Exception: STATUS_ACCESS_VIOLATION at eip=61092796
eax=00000000 ebx=0000000A ecx=00000001 edx=0073FD0C esi=0073FA7D
edi=00000300
ebp=0073FCDC esp=0073FA04 program=C:\CYGWIN\BIN\MWIRTA\A.EXE
cs=0197 ds=019F es=019F fs=4CE7 gs=0000 ss=019F
Stack trace:
Frame     Function  Args
0073FCDC  61092796  (610A0020, 610A0204, 00401053, 0073FD0C)
0073FCFC  6108CC2E  (00401053, 00000000, 3FF00000, 00401077)
0073FD2C  004010AD  (00000001, 615637C0, 00970278, 00000000)
0073FD88  61003F8E  (00000000, 00000000, 00000000, 00000002)
0073FDB8  61004282  (0040106C, 00000000, 8163AA40, 00000000)
0073FDD8  610042C1  (00000000, 00000000, FFFFFFFF, 81652720)
0073FE08  00401127  (0040106C, 0073FC8C, BFFBB490, 0073FF68)
0073FE38  0040103D  (00000000, 81652ABC, 00530000, 58450041)
0073FF78  BFF7B9E4  (8163A9F4, 00000008, 81652ABC, 00000000)
      0 [main] a 3795797 handle_exceptions: Error while dumping state
(probably corrupted stack)


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list