[GiNaC-devel] Bus error with GiNaC-1.3.0 on Mac OS X

Gregory Wright gwright at comcast.net
Thu Dec 2 11:35:04 CET 2004


Hi,

I'm trying to build GiNaC-1.3.0 on Mac OS X 10.3.6 using gcc 3.4.3. The
build seems to work fine, and test programs can be linked, but they
always fail with a bus error. Running "make check" fails with three
successive bus error, after which it gives up.

Here's an example program---it's the part of the configuration process
for the nestedsums library:

/***
Build with:
g++-3.4.3 -o conftest -g -O2 -I/opt/local/include  conftest.cc -lginac 
-L/opt/local/lib -lcln -lgmp
***/

/* confdefs.h.  */

#define PACKAGE_NAME ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define PACKAGE_STRING ""
#define PACKAGE_BUGREPORT ""
#define PACKAGE "nestedsums"
#define VERSION "1.4.6"
#ifdef __cplusplus
extern "C" void std::exit (int) throw (); using std::exit;
#endif
#define STDC_HEADERS 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRING_H 1
#define HAVE_MEMORY_H 1
#define HAVE_STRINGS_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_STDINT_H 1
#define HAVE_UNISTD_H 1
#define HAVE_DLFCN_H 1
#define SIZEOF_LONG 4
#define SIZEOF_LONG_LONG 8
#define SIZEOF_LONG_DOUBLE 8
/* end confdefs.h.  */

#include <stdio.h>
#include <string.h>
#include <ginac/version.h>

/* we do not #include <stdlib.h> because autoconf in C++ mode inserts a
    prototype for exit() that conflicts with the one in stdlib.h */
extern "C" int system(const char *);

int main(void)
{
     int major, minor, micro;
     char *tmp_version;

     system("touch conf.ginactest");

     if ((GINACLIB_MAJOR_VERSION != 1) ||
         (GINACLIB_MINOR_VERSION != 3) ||
         (GINACLIB_MICRO_VERSION != 0)) {
         printf("\n*** 'ginac-config --version' returned %d.%d.%d, but 
the header file I found\n", 1, 3, 0);
         printf("*** corresponds to %d.%d.%d. This mismatch suggests 
your installation of GiNaC\n", GINACLIB_MAJOR_VERSION, 
GINACLIB_MINOR_VERSION, GINACLIB_MICRO_VERSION);
         printf("*** is corrupted or you have specified some wrong -I 
compiler flags.\n");
         printf("*** Please inquire and consider reinstalling GiNaC.\n");
         return 1;
     }
     if ((GiNaC::version_major != 1) ||
         (GiNaC::version_minor != 3) ||
         (GiNaC::version_micro != 0)) {
         printf("\n*** 'ginac-config --version' returned %d.%d.%d, but 
the library I found\n", 1, 3, 0);
         printf("*** corresponds to %d.%d.%d. This mismatch suggests 
your installation of GiNaC\n", GiNaC::version_major, 
GiNaC::version_minor, GiNaC::version_micro);
         printf("*** is corrupted or you have specified some wrong -L 
compiler flags.\n");
         printf("*** Please inquire and consider reinstalling GiNaC.\n");
         return 1;
     }
     return 0;
}



And here's the result:

crossroads-able> ./conftest
Bus error
crossroads-able>



GDB gives some perhaps helpful information:

crossroads-able> gdb ./conftest
GNU gdb 5.3-20030128 (Apple version gdb-309) (Thu Dec  4 15:41:30 GMT 
2003)
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and 
you are
welcome to change it and/or distribute copies of it under certain 
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for 
details.
This GDB was configured as "powerpc-apple-darwin".
Reading symbols for shared libraries ....... done
(gdb) run
Starting program: 
/Users/gwright/src/darwinports/dports/math/nestedsums/conftest
Reading symbols for shared libraries +++++. done

Program received signal EXC_BAD_ACCESS, Could not access memory.
GiNaC::basic::is_equal(GiNaC::basic const&) const (this=0x6003d0, 
other=@0x0) at basic.h:254
254                     if (flags & status_flags::hash_calculated) {
(gdb) bt
#0  GiNaC::basic::is_equal(GiNaC::basic const&) const (this=0x6003d0, 
other=@0x0) at basic.h:254
#1  0x013fd3cc in GiNaC::power::eval(int) const (this=0xbffff820, 
level=21536100) at ptr.h:94
#2  0x012ba4b4 in GiNaC::ex::construct_from_basic(GiNaC::basic const&) 
(other=@0x1) at ex.cpp:287
#3  0x013f86a8 in GiNaC::ex::ex(GiNaC::basic const&) (this=0xc35e2ab4, 
other=@0x0) at ex.h:304
#4  0x013f9fd0 in GiNaC::power::evalf(int) const (this=0xbffff820, 
level=1) at basic.h:118
#5  0x0139023c in __static_initialization_and_destruction_0(int, int) 
(__initialize_p=-1, __priority=-1073744816) at basic.h:118
#6  0x8fe17728 in __dyld_call_module_initializers_for_library ()
#7  0x8fe174a0 in __dyld_call_module_initializers ()
#8  0x8fe14584 in __dyld__dyld_make_delayed_module_initializer_calls ()
#9  0x000028c0 in _call_mod_init_funcs () at 
/SourceCache/Csu/Csu-47/crt.c:299
#10 0x0000279c in _start (argc=1, argv=0xbffffd54, envp=0xbffffd5c) at 
/SourceCache/Csu/Csu-47/crt.c:217
#11 0x8fe1a558 in __dyld__dyld_start ()
(gdb)


The programs in the GiNaC test suite exams, times and checks, all fail 
at the same
point in basic.h.

I'm not enough of a C++ programmer to understand what is really going on
here. Perhaps it's a gcc bug. Let me know what additional tests I can 
run.
Any help would be appreciated.

Best Wishes,
Greg Wright




More information about the GiNaC-devel mailing list