conversion operator problem in x86?

Shigeya Suzuki shigeya@foretune.co.jp
Tue Sep 29 07:39:00 GMT 1998


I'm trying to make latest (9/21) snapshot to work on BSD/OS 4.0 (with
ELF binary, finally!). I'll summalize and submit modifications soon.

Yesterday, I finally successfully bootstrapped a compiler on the
platform. Then, I tried to compile one of my program. The compiler
yields following internal compiler error.

	pooh 1267% g++ z.cpp -o z
	z.cpp: In method `X::operator double() const':
	z.cpp:18: Internal compiler error.
	z.cpp:18: Please submit a full bug report to `egcs-bugs@cygnus.com'.

I attached a code snippet which cause this error.

I retrieved same snapshot and built compiler on sparc-sun-solaris2.6
platform. Same sample compiiled without problem. Thus, I guess it's
float related problem but whether this problem is x86 specific or BSDI
specfic is unknown..

I tried with several configurations but can't find clue. Since I don't
have any x86 platform (at this moment, at least) on my site, would you
please someone using x86 platform like linux/FreeBSD try this code
snippet?

Any hints?

Shigeya Suzuki

------------------------------

#include <iostream>
#include <stdlib.h>

class X {
private:
    char* m_s;
public:
    X() : m_s("0.0") { }
    X(char* s) : m_s(s) { }

    operator double() const { return atof(m_s); }
};

main()
{
    X f1("1.0");
    cout << "f1 = " << double(f1) << endl;
}



More information about the Gcc-bugs mailing list