X-Spam-Check-By: sourceware.org Message-ID: <20061007202454.67767.qmail@web82304.mail.mud.yahoo.com> Date: Sat, 7 Oct 2006 13:24:54 -0700 (PDT) From: William Hart Subject: Re: Problems with GMP in latest Cygwin To: cygwin AT cygwin DOT com In-Reply-To: <20060928141602.70509.qmail@web82305.mail.mud.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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!! Bill. --- 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: > http://cygwin.com/ml/#unsubscribe-simple > Problem reports: > http://cygwin.com/problems.html > Documentation: http://cygwin.com/docs.html > FAQ: http://cygwin.com/faq/ > > -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/