[ghemical-devel] about problems with gcc-3.2

Tommi Hassinen thassine@messi.uku.fi
Wed, 5 Mar 2003 14:33:49 +0200 (WET)


Hi all.

I have been studying the problems related to gcc-3.2, and now it seems
that the *compilation* problems are more or less solved. The current CVS
versions of both v1.00 and v1.50 should compile with all compilers.

When doing my testing I changed the compiler by using settings

	export CC=gcc-3.2
	export CXX=g++-3.2
	./configure

But the problem of program crashing when compiled with gcc-3.2 still
remains, and *that* seems to be a really strange one.

The problem is exactly same in v1.00 and v1.50; when a new project is
opened, the functions

	menu_FileNew()
	InitGnomeMDIChild()
	GnomeViewCreator()

are called in the normal sequence, but in the beginning of
GnomeViewCreator() an illegal instruction(?!?!) is encountered.
The locations of the problematic code are roughly

for v1.00:	src/target3/t3docv.cpp line ~92
for v1.50:	src/gnome_project.cpp line ~565

The most strange thing is that the illegal instruction seems to happen in
the dynamic_cast<>() command, which is a C++ reserved word and handled by
the compiler itself!

As far as I understand, dynamic_cast<>() should process run-time pointer
conversions from base class to derived classes (when possible, using the
collected run-time-type-information). So it should never fail, no matter
what parameters are given to it, but just give a valid pointer to a
derived class object or a NULL pointer. So it seems to me that the input
which goes to dynamic_cast<>() is valid, but theoretically, even that does
not matter since it should be able to process any input.

I added some pretty straight-forward output commands to the
GnomeViewCreator() function, so could you please test it and see if it
works the same way?

I only can figure out two possible reasons for the behaviour:

	1) there is a memory-management bug, that overwrites the
	code/data related to the dynamic_cast<>() operation.

	2) the problem is in gcc-3.2 itself???

I re-compiled everything using gcc-2.95 and used the excellent memory
debugger program "valgrind" (highly recommended to everyone ;) to see if
there's something going on, and of course found some errors, but most of
those seems to come from system libraries, and I found nothing that IMO
could relate to the problem seen in GnomeViewCreator().

So, any ideas? Do you know any "compiler gurus" who could give us an
opinion about this? If you see, using gcc-3.2, any other behaviour than
what I described above, please report all that to me.

Regards,

	Tommi