[GiNaC-devel] Yet another parser related breakage (Was: Release GiNaC 1.5.3)

Alexei Sheplyakov varg at metalica.kh.ua
Fri Jul 31 10:37:56 CEST 2009


Dear all,

On Fri, Jul 31, 2009 at 09:00:10AM +0200, Richard B. Kreckel wrote:
> While building Debian packages, g++ 4.3.3 complained  
> "parser/parser.cpp:69: error: cast from 'GiNaC::ex (*)(const  
> GiNaC::exvector&)' to 'unsigned int' loses precision". (Besides, that's  
> a weird error message!)

I think the error message is absolutely correct.

The thing is that commit 5fc9d1ab ('Allow user defined functions to be parsed')
contains (at least) two (unrelated) bugs. First of all, the parser can not read
pow, sqrt, and user-defined classes any more.
Secondly, the code is not going to work on 64-bit architectures due to the cast
from integer into a pointer (to a function):

ginac/parser/default_reader.tpl:

for ( unsigned ser=0; ; ++ser ) {
	GiNaC::function f(ser);
	std::string name = f.get_name();
	for ( std::size_t nargs=0; ; ++nargs ) {
		try {
			function::find_function(name, nargs);
			prototype proto = std::pair<std::string, std::size_t>(name, nargs);
			std::pair<prototype_table::iterator, bool> ins = reader.insert(std::pair<prototype,reader_func>(proto, (reader_func)ser));
			// BAD BAD BAD: converting int into void*

I think the above mentioned commit is wrong and should be reverted.

Best regards,
	Alexei




More information about the GiNaC-devel mailing list