* DEC cxx bug (default copy operator and virtual inheritance)
@ 1995-08-04 4:00 Jean-Louis Moser
1995-08-07 4:00 ` Alec Habig
0 siblings, 1 reply; 12+ messages in thread
From: Jean-Louis Moser @ 1995-08-04 4:00 UTC (permalink / raw)
Here is a bug in default copy operator and virtual inheritance in
DEC C++ V5.0-3 for DEC OSF/1 (Alpha)
Is there any correction. We can notice that there is no problem
with Gnu g++ in the same case.
1/ try class B virtual from A => after the B part of c (it's bc) has been affected
with a B, the address of the A part of C change. it become the same address
than the B part as if B won't be virtual from A.
=> here is the bug. The assertion fail.
2/ try class B NOT virtual from A. DON'T define B::operator =
=> everything is ok
3/ define B::operator =
=> everything is ok
4/ Implement C without data member. DON'T define B::operator =
=> everything is ok
---------------------------------------------------------------------
#include <iostream.h>
#include <assert.h>
class A {
public:
unsigned a_;
};
class B : public /**/virtual/**/ A { // (phase 2)
public:
unsigned b_;
B (int b = 0) : b_ (b) {}
// B& operator = (const B& b) {b_ = b.b_; return *this;} // (phase 3)
};
class C : public B {
public:
unsigned c_; // (phase 4)
C (int c) : c_ (c) {}
};
static void dump (C& c)
{
A& a = c;
B& b = c;
cout << "C | c_ | B | A | a_ " << &c << " | "
<< (char*)&c.c_ - (char*)&c << " | "
<< (char*)&b - (char*)&c << " | "
<< (char*)&a - (char*)&c << " | "
<< (char*)&c.a_ - (char*)&c << endl;
}
void main ()
{
B b = 99;
C c = 101;
B& cb = c;
dump (c);
cb = b; // here is the bug
dump (c);
assert (c.c_ == 101);
}
--
+----------------------------+------------------------------------+
| Jean-Louis Moser | 2001 SA |
| tel: 33 (1)46.60.57.22 | 2, rue de la renaissance |
| Email: jlm@two-oo-one.fr | F-92184 Antony Cedex |
+----------------------------+------------------------------------+
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: DEC cxx bug (default copy operator and virtual inheritance) 1995-08-04 4:00 DEC cxx bug (default copy operator and virtual inheritance) Jean-Louis Moser @ 1995-08-07 4:00 ` Alec Habig 1995-08-14 4:00 ` Bill Kemp ` (2 more replies) 0 siblings, 3 replies; 12+ messages in thread From: Alec Habig @ 1995-08-07 4:00 UTC (permalink / raw) Rather off topic here, but here's my question about a DEC cxx bug - at $8000 a crack for a compiler license, how on earth can they sell any when competing vs. g++ (free, and more widely used)????? Feature, bug, or total obliviousness to basic economic principles? (My pricing info was a quote from a univ. official, and could be skewed). Alec -- Alec Habig, Indiana University High Energy Astrophysics ahabig@bigbang.astro.indiana.edu http://astrowww.astro.indiana.edu/personnel/ahabig/ Ted Kennedy's car has killed more people than my guns. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: DEC cxx bug (default copy operator and virtual inheritance) 1995-08-07 4:00 ` Alec Habig @ 1995-08-14 4:00 ` Bill Kemp 1995-08-14 4:00 ` Andrew Gallatin ` (3 more replies) 1995-08-18 4:00 ` Alex Kowalenko 1995-08-20 4:00 ` Daniel S. Riley 2 siblings, 4 replies; 12+ messages in thread From: Bill Kemp @ 1995-08-14 4:00 UTC (permalink / raw) When you have mission critical applications that can cost you thousands of dollars a second when they are down, $8000 for a compiler that is SUPPORTED is not that much to pay. Who do you call at GNU when you have a problem at 3 in the morning that has to be fixed, NOW? If I was doing research at a university or teaching, you bet I would be using the freeware. But, not everyone is in that situation. Economic prinicples have to be applied to each situation. And if you are down for a minute or two at the stock exchange, for example, that 8G's you saved gets burned up in a hurry and your boss is asking you hard questions about your application of 'basic economic principles' and your total obliviousness to reality. BK ************************************************************************ Obligatory disclaimer: JMHO, and not necessarily the views of my employer, my wife, or my cats! ************************************************************************ ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: DEC cxx bug (default copy operator and virtual inheritance) 1995-08-14 4:00 ` Bill Kemp @ 1995-08-14 4:00 ` Andrew Gallatin 1995-08-15 4:00 ` Dan Pop ` (2 subsequent siblings) 3 siblings, 0 replies; 12+ messages in thread From: Andrew Gallatin @ 1995-08-14 4:00 UTC (permalink / raw) In article <40oe6p$9dm@www.mci.com>, Bill Kemp <bkemp@tuzo.cs.mci.com> wrote: >When you have mission critical applications that can cost you thousands of >dollars a second when they are down, $8000 for a compiler that is SUPPORTED is >not that much to pay. Who do you call at GNU when you have a problem at 3 in >the morning that has to be fixed, NOW? Third-parties provide support for GNU products, such as gcc, g++, etc. Cygnus (http://www.cygnus.com, 1-800-CYGNUS-1 or 1-415-903-1400) is one such company, there may be others. I've got no idea what they charge, but its probably less than $8k. Drew ############################################################################## # Andrew Gallatin, Computer Project Manager # # Institute of Statistics and Decision Sciences # # Box 90251, Duke University, Durham, NC 27708-0251 # ############################################################################## ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: DEC cxx bug (default copy operator and virtual inheritance) 1995-08-14 4:00 ` Bill Kemp 1995-08-14 4:00 ` Andrew Gallatin @ 1995-08-15 4:00 ` Dan Pop 1995-08-15 4:00 ` Bill Kemp 1995-08-15 4:00 ` Leo Bicknell 1995-08-19 4:00 ` A.Schindler 3 siblings, 1 reply; 12+ messages in thread From: Dan Pop @ 1995-08-15 4:00 UTC (permalink / raw) In <40oe6p$9dm@www.mci.com> Bill Kemp <bkemp@tuzo.cs.mci.com> writes: >When you have mission critical applications that can cost you thousands of >dollars a second when they are down, $8000 for a compiler that is SUPPORTED is >not that much to pay. Who do you call at GNU when you have a problem at 3 in >the morning that has to be fixed, NOW? Who guarantees that calling vendor support at any time of the day will provide any kind of fix, on the spot, 1, 3, 6 months later or ever? BTW, you can buy support for GNU software from Cygnus Support (at least). Dan -- Dan Pop CERN, CN Division Email: Dan.Pop@mail.cern.ch Mail: CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: DEC cxx bug (default copy operator and virtual inheritance) 1995-08-15 4:00 ` Dan Pop @ 1995-08-15 4:00 ` Bill Kemp 0 siblings, 0 replies; 12+ messages in thread From: Bill Kemp @ 1995-08-15 4:00 UTC (permalink / raw) >Who guarantees that calling vendor support at any time of the day will >provide any kind of fix, on the spot, 1, 3, 6 months later or ever? >BTW, you can buy support for GNU software from Cygnus Support (at least). And by the same token, who guarantees that Cygnus will provide any kind of fix. I have been pleased with DEC support, in general...and yes it is expensive but, you get what you pay for and Digital provides multiple levels of support depending on how critical your application is and what amount of money you are willing to spend to have it supported. IMO, I would rather have the vendor that created the product support it because they are tied directly to the development and maintenance of the product. I was unaware of the Cygnus option for GNU and I will also admit that with GNU products you have the source and can hack on them immediately if you need to. cxx has been good so far (v5.0) and we are pleased with it and our level of comfort is certainly proportional to the amount of money we spend on support and that number is considerable...but, we are a 5 9's shop and that can be stressful when you don't have products that are vendor supported. bill kemp ******************************************* My opinion and soley my opinion. ******************************************* ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: DEC cxx bug (default copy operator and virtual inheritance) 1995-08-14 4:00 ` Bill Kemp 1995-08-14 4:00 ` Andrew Gallatin 1995-08-15 4:00 ` Dan Pop @ 1995-08-15 4:00 ` Leo Bicknell 1995-08-19 4:00 ` A.Schindler 3 siblings, 0 replies; 12+ messages in thread From: Leo Bicknell @ 1995-08-15 4:00 UTC (permalink / raw) In article <40oe6p$9dm@www.mci.com>, Bill Kemp <bkemp@tuzo.cs.mci.com> wrote: >When you have mission critical applications that can cost you thousands of >dollars a second when they are down, $8000 for a compiler that is SUPPORTED is >not that much to pay. Who do you call at GNU when you have a problem at 3 in >the morning that has to be fixed, NOW? I don't know about you, but I almost always get better turnaround from free software. Most bugs I find the author will patch in a day or so, yet sometimes it takes two months to get DEC to even admit there is a problem. I'm not saying that supported software isn't good, just that 8K is a drop in the bucket to DEC, and doesn't mean you'll get any better then normal service. Now, an 8K donation to GNU might get you a version of GCC that runs on a VIC 20. -- Leo Bicknell - bicknell@ufp.org | Make a little birdhouse bicknell@vt.edu | in your soul...... bicknell@cs.vt.edu | They Might http://www.ufp.org/~bicknell/ | Be Giants ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: DEC cxx bug (default copy operator and virtual inheritance) 1995-08-14 4:00 ` Bill Kemp ` (2 preceding siblings ...) 1995-08-15 4:00 ` Leo Bicknell @ 1995-08-19 4:00 ` A.Schindler 3 siblings, 0 replies; 12+ messages in thread From: A.Schindler @ 1995-08-19 4:00 UTC (permalink / raw) Bill Kemp (bkemp@tuzo.cs.mci.com) wrote: : When you have mission critical applications that can cost you thousands of : dollars a second when they are down, $8000 for a compiler that is SUPPORTED is : not that much to pay. Who do you call at GNU when you have a problem at 3 in : the morning that has to be fixed, NOW? Now, I'm working in the DEC worls in Germany for about 15 Years, and I bet (with very little risk) You will get NO (in words: ZERO) support for an obscure compiler bug at 3 in the morning. If You are lucky, You will be able to launch an official call to the DEC support in only one day. Recently it's getting clearer all the time: Support, security and all the other things claimed by the commercial tools providers to be their natural realm are simply rumors. The stability and support (e.g. via this audience) for GNU tools are much better than many so called SUPPORTED products. Why the heck DOES Digital ship a CD-ROM called "Alpha Freeware" with their machines if this sofware is to be suspected ? I think they (and maybe even Sun, IBM, HP ...) use them by themselves, but don't tak about. Your's Andreas G. Schindler ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: DEC cxx bug (default copy operator and virtual inheritance) 1995-08-07 4:00 ` Alec Habig 1995-08-14 4:00 ` Bill Kemp @ 1995-08-18 4:00 ` Alex Kowalenko 1995-08-20 4:00 ` Daniel S. Riley 2 siblings, 0 replies; 12+ messages in thread From: Alex Kowalenko @ 1995-08-18 4:00 UTC (permalink / raw) Alec Habig (ahabig@bigbang.uucp) wrote: : Rather off topic here, but here's my question about a DEC cxx bug - : at $8000 a crack for a compiler license, how on earth can they sell any when : competing vs. g++ (free, and more widely used)????? The only problem I have is that we been using DEC cxx for a year, and porting it the code now to gnu, would cost us some time, (we have no time!) and g++ dosen't support the same set of features as cxx, i.e. static data members in template classes (sorry not implemented!) Otherwise we could have a neat development environment, since gdb will work with g++ output. Alex ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: DEC cxx bug (default copy operator and virtual inheritance) 1995-08-07 4:00 ` Alec Habig 1995-08-14 4:00 ` Bill Kemp 1995-08-18 4:00 ` Alex Kowalenko @ 1995-08-20 4:00 ` Daniel S. Riley 2 siblings, 0 replies; 12+ messages in thread From: Daniel S. Riley @ 1995-08-20 4:00 UTC (permalink / raw) In a thread about cxx maintenance vs g++ maintenance, in article <40r2jf$t4o@www.mci.com> Bill Kemp <bkemp@tuzo.cs.mci.com> writes: bkemp> And by the same token, who guarantees that Cygnus will provide bkemp> any kind of fix. [...] IMO, I would rather have the vendor bkemp> that created the product support it because they are tied bkemp> directly to the development and maintenance of the product. One of Cygnus's founders is the original author of g++, Cygnus continues to be the primary developer of g++, and much of their business involves supporting and enhancing gcc and g++ for development and cross-development work--so they are very much tied to the development and maintenance of the product. -- Dan Riley Internet: dsr@lns598.lns.cornell.edu Wilson Lab, Cornell University HEPNET/SPAN: lns598::dsr (44630::dsr) "Distance means nothing/To me." -Kate Bush ^ permalink raw reply [flat|nested] 12+ messages in thread
* DEC cxx bug (default copy operator and virtual inheritance)
@ 1995-08-04 4:00 Jean-Louis Moser
1995-08-16 4:00 ` Dennis Murphy
0 siblings, 1 reply; 12+ messages in thread
From: Jean-Louis Moser @ 1995-08-04 4:00 UTC (permalink / raw)
Here is a bug in default copy operator and virtual inheritance in
DEC C++ V5.0-3 for DEC OSF/1 (Alpha)
Is there any correction. We can notice that there is no problem
with Gnu g++ in the same case.
1/ try class B virtual from A => after the B part of c (it's bc) has been affected
with a B, the address of the A part of C change. it become the same address
than the B part as if B won't be virtual from A.
=> here is the bug. The assertion fail.
2/ try class B NOT virtual from A. DON'T define B::operator =
=> everything is ok
3/ define B::operator =
=> everything is ok
4/ Implement C without data member. DON'T define B::operator =
=> everything is ok
---------------------------------------------------------------------
#include <iostream.h>
#include <assert.h>
class A {
public:
unsigned a_;
};
class B : public /**/virtual/**/ A { // (phase 2)
public:
unsigned b_;
B (int b = 0) : b_ (b) {}
// B& operator = (const B& b) {b_ = b.b_; return *this;} // (phase 3)
};
class C : public B {
public:
unsigned c_; // (phase 4)
C (int c) : c_ (c) {}
};
static void dump (C& c)
{
A& a = c;
B& b = c;
cout << "C | c_ | B | A | a_ " << &c << " | "
<< (char*)&c.c_ - (char*)&c << " | "
<< (char*)&b - (char*)&c << " | "
<< (char*)&a - (char*)&c << " | "
<< (char*)&c.a_ - (char*)&c << endl;
}
void main ()
{
B b = 99;
C c = 101;
B& cb = c;
dump (c);
cb = b; // here is the bug
dump (c);
assert (c.c_ == 101);
}
--
+----------------------------+------------------------------------+
| Jean-Louis Moser | 2001 SA |
| tel: 33 (1)46.60.57.22 | 2, rue de la renaissance |
| Email: jlm@two-oo-one.fr | F-92184 Antony Cedex |
+----------------------------+------------------------------------+
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: DEC cxx bug (default copy operator and virtual inheritance) 1995-08-04 4:00 Jean-Louis Moser @ 1995-08-16 4:00 ` Dennis Murphy 0 siblings, 0 replies; 12+ messages in thread From: Dennis Murphy @ 1995-08-16 4:00 UTC (permalink / raw) >Here is a bug in default copy operator and virtual inheritance in >DEC C++ V5.0-3 for DEC OSF/1 (Alpha) I took a look at this problem and I'm entering a bug report related to it. The problem is not the constructor but rather appears to be an invalid size for objects of class B. Here's an example... motie.zko.dec.com> cxx newsbug1_size.C motie.zko.dec.com> tail newsbug1_size.C << (char*)&c.a_ - (char*)&c << endl; } void main () { cout << "class A size : " << sizeof(A) << endl; cout << "class B size : " << sizeof(B) << endl; cout << "class C size : " << sizeof(C) << endl; } motie.zko.dec.com> a.out class A size : 4 class B size : 24 class C size : 24 motie.zko.dec.com> If class B has a size of 24 class C objects may not be of size 24 also as class C defines an additional data member that's destroyed in the copy of b to c. I don't have a workaround other than those you've observed. Dennis Murphy ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~1995-08-20 4:00 UTC | newest] Thread overview: 12+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 1995-08-04 4:00 DEC cxx bug (default copy operator and virtual inheritance) Jean-Louis Moser 1995-08-07 4:00 ` Alec Habig 1995-08-14 4:00 ` Bill Kemp 1995-08-14 4:00 ` Andrew Gallatin 1995-08-15 4:00 ` Dan Pop 1995-08-15 4:00 ` Bill Kemp 1995-08-15 4:00 ` Leo Bicknell 1995-08-19 4:00 ` A.Schindler 1995-08-18 4:00 ` Alex Kowalenko 1995-08-20 4:00 ` Daniel S. Riley -- strict thread matches above, loose matches on Subject: below -- 1995-08-04 4:00 Jean-Louis Moser 1995-08-16 4:00 ` Dennis Murphy
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox