This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [cs] Robustify in the presence of PCH n snarf-n-barf


On Thursday, October 30, 2003, at 01:14 PM, Geoff Keating wrote:
This change is wrong, please make sure it never gets into mainline GCC.

Please explain how one can have two pointers to the same piece of GCed data that have different static types on them?


In C++, this would be:

class Base {
} *base;

class Derived : public base {
} *derived;

int main() {
	base = derived = new Derived;
}

In C, this would be:

tree base;
tree_decl derived;

int main() {
	base = derived = make_decl ();
	return 0;
}

Per and I are experimenting with tightening up the compiler to include more static typing, so that we can have the compiler's static type system diagnose type errors instead of depending upon DECL_CHECK as much. This aids readability, give type violations sooner, and has other good benefits.

The C++ runtime system has the exact same code as your PCH code, but, it does all the required runtime conversions, unlike your code. Please explain why your code isn't just plain wrong.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]