[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Problem with assignment operator
From: |
William Garrett Mitchener |
Subject: |
Problem with assignment operator |
Date: |
Tue, 11 Jan 2005 13:57:33 -0500 (EST) |
Hi, I'm helping someone debug a gmp program, and we've come up with this
minimal example:
----- bug.cc -----
#include <gmp.h>
#include <gmpxx.h>
#include <iostream>
using namespace std;
int
main(int, char**)
{
mpz_class a, b;
a = 9;
b = -14;
mpq_class c;
c = mpq_class(a, b); // seg fault here
cout << c << endl;
}
-----
We are running this on linux and have the same problem on Fedora 2 and
Fedora 3.
We are compiling as follows:
g++ -g -Wall bug.cc -o bug -lgmpxx -lgmp
But when we run it, we get a segmentation fault on the line c = ...; On
Fedora 3, we are using the packages: gmp-4.1.4-3 and gcc-3.4.2-6.fc3. On
Fedora 3, we aren't able to get any information out of gdb. It gives
cryptic errors about
warning: Child process unexpectedly missing: No child process
and
Program terminated with signal ?, Unknown signal
The Fedora 3 machine is an IBM thinkpad T42 with a Pentium M.
On Fedora 2, we are using gmp-4.1.2-14 and gcc-3.3.3-7, and gdb is able to
pinpoint the problem at:
Program received signal SIGSEGV, Segmentation fault.
__gmpn_copyi () at tmp-copyi.s:97
97 tmp-copyi.s: No such file or directory.
in tmp-copyi.s
This machine is a house-build PC with two Pentium 4s:
argon{wgm}1126: uname -a
Linux argon 2.6.9-1.6_FC2smp #1 SMP Thu Nov 18 22:20:16 EST 2004 i686 i686
i386 GNU/Linux
argon{wgm}1127: gcc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.3.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --disable-libunwind-exceptions --with-system-zlib
--enable-__cxa_atexit --host=i386-redhat-linux
Thread model: posix
gcc version 3.3.3 20040412 (Red Hat Linux 3.3.3-7)
Please help!
Thanks,
-- Garrett Mitchener
- Problem with assignment operator,
William Garrett Mitchener <=