This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Problems with GMP in latest Cygwin

I reported earlier some problems with gmp_printf and
gmp_scanf when running GMP under Cygwin.

My program now runs correctly. I will vaguely discuss
some of the problems for the benefit of those who may
have had similar issues:

Firstly I was using Cygwin on a **64** bit Athlon,
running on **32** bit Windows XP.

I'm not sure about what choices of bit length are made
for long's under such circumstances, but one has to be
very careful of the following:

1) printf("%ld",longvar) expects a long
2) Using gmp_scanf and gmp_printf after instances of
ordinary printf and scanf when the incorrect
assumptions have been made about the length of a long
may cause problems (note the compiler may not give an
error or warning).
3) Replacing long's with u_int32_t's may further
compound the problems: GMP expects a ui (in functions
like mpz_mul_ui) to be 32 bits on a 32 bit machine and
64 bits on a 64 bit machine. But what does it expect
on a 64 bit machine running in 32 bit mode? One must
use a long, but this may cause issues elsewhere.

Some combination of the above led me to write a
program which compiled without warnings and which ran
correctly on my 32 bit laptop, but which compiled
correctly did not run correctly on my 64 bit Athlon
running 32 bit Windows XP (under Cygwin). 

C is portable only if you are porting it to the same
kind of machine, using the same operating system with
the same kind of OS emulator!!


--- William Hart <> wrote:

> I seem to be having some problems with the GMP
> library
> in the latest version of Cygwin. I just installed
> the
> latest Cygwin along with the latest GMP, however C
> code that previously worked with GMP+Cygwin no
> longer
> does. 
> To try and determine whether this is a Cygwin
> problem
> or not, I recompiled the earlier version of GMP
> (that
> worked previously) on the latest version of Cygwin
> and
> it doesn't fix the problem. 
> The problems are strange. The gmp_printf and
> gmp_scanf
> functions do not appear to work correctly (the
> former
> not at all, the later does not wait for input).
> For some reason there is also an obscure error which
> causes programs to hang just before they finish. The
> console also does not respond to CTRL-C as it used
> to.
> I have checked that the my code works correctly with
> the old version of Cygwin + GMP (4.1.x).
> Another possibility is a conflict with the hardware
> I
> am using. The new version of Cygwin is installed on
> my
> Athlon 64 Dual Core 3800+ running Windows XP 32 bit
> version. The old version is installed on my Athlon
> 2000+ laptop.
> One possibility would be to try installing the old
> version of Cygwin on my new machine to see if the
> problem goes away. Is there a way of doing this?
> I do not want to install the new version of Cygwin
> on
> my laptop as I am using it to do some development
> which must be completed by Oct 1st, thus I cannot
> risk
> screwing it up.
> Thanks in advance for any help.
> Bill.
> --
> Unsubscribe info:     
> Problem reports:      
> Documentation:
> FAQ:         

Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]