SparcWorks C++ 4.2 Compiler Bug!

SparcWorks C++ 4.2 Compiler Bug!

Post by Mark Boswel » Wed, 18 Aug 1999 04:00:00



I am having a problem with some very basic functionality of the
SparcWorks C++ 4.2 compiler running on a Sparc Ultra-5. A program will
die from a SIGABRT and say: "Run-time error, libC: 'delete[]' does not
correspond to any new[]' ". It appears to be related to the fact that I
am deleteing an a array of derived objects. Unless we are missing
something really obvious, it looks like a bug in the compiler.  I
compile with 'CC -g0 test.cxx -o testprog.' Any help is greatly
appreciated.

Here is a simple test case:

     class baseItem {
         public:
             baseItem() {};
             virtual ~baseItem();
     };

     baseItem::~baseItem() { }

     class derivedItem : public baseItem {
         public:
             derivedItem() : derivedItemValue(0) {};
             virtual ~derivedItem();

         private:
             int derivedItemValue;
     };

     derivedItem::~derivedItem() {}

     int main()
     {
         baseItem* itemList = new derivedItem[10];
         delete [] itemList;
         return(0);
     }

 
 
 

SparcWorks C++ 4.2 Compiler Bug!

Post by Alan Stang » Wed, 18 Aug 1999 04:00:00



> I am having a problem with some very basic functionality of the
> SparcWorks C++ 4.2 compiler running on a Sparc Ultra-5. A program will
> die from a SIGABRT and say: "Run-time error, libC: 'delete[]' does not
> correspond to any new[]' ". It appears to be related to the fact that
> I am deleteing an a array of derived objects. Unless we are missing
> something really obvious, it looks like a bug in the compiler.  I
> compile with 'CC -g0 test.cxx -o testprog.' Any help is greatly
> appreciated.

>      <snip>

Very interesting.  I'd suggest getting the CC 5.0 compiler.  The 4.2
CC compiler is now somewhat dated.

$ CC a.cc
$ a.out
Run-time error, libC:
        'delete[]' does not correspond to any 'new[]'
Abort (core dumped)

Update my path to use the 5.0 C++ compiler:
$ cc50
$ CC a.cc
$ a.out

works like a charm.

now try g++

$ g++ a.cc
a.out
$ a.out
Segmentation Fault (core dumped)

$ g++ -v
 gcc -v
Reading specs from
/usr/local/gnu/install/gcc/2.7.2.3/lib/gcc-lib/sparc-sun-solaris2.6/2.7.2.3/specs

gcc version 2.7.2.3

$ g++ a.cc
a.out
$ a.out
Segmentation Fault (core dumped)
$ g++ -v
Reading specs from
/scratch/stange/lib/gcc-lib/sparc-sun-solaris2.6/2.95/specs
gcc version 2.95 19990728 (release)

I'm not going to venture a gues into your C++ code.  I'm not
knowledgable enough to venture opinions...except that the 4.2
C++ compiler is to be avoided.

--


 
 
 

1. Where can I find SparcWorks C++ compiler 4.2?

I'm trying to port our code which uses Inprise/Borland's Visibroker
CORBA 3.3 to Solaris.  Visibroker's software requirements are quite
clear and quite strict.  For some reason they require the 4.1 or 4.2
version of SparcWorks C++.  We have SparcWorks C++ compiler v .0 and
I've tried to compile using the -compat=4 flag.  Everything compiles
just fine, but all our programs hang at startup.

I'd just like to know whether the problem is the compiler or our code.
Does anyone know where I can find even just a demo copy of the
SparcWorks C++ compiler version 4.1 or 4.2.  I already tried contacting
Sun's software sales, and they said they can't help me.

Any help would be greatly appreciated, and an email CC would be great.
Thanks in advance.

--Ivans

--

Photon Research Associates                         Phone: (858) 455-9741
5720 Oberlin Drive San Diego, California 92121       FAX: (858) 455-0658

2. Linux NIS HOWTO (part 1/1)

3. where can I find: SPARCWorks Compiler C/C++ 4.2 for x86

4. Enterprise Management Theater

5. Possible patch for C++ 4.2 compiler on Solaris 2.6?

6. Multiple concurrent SCSI commands to same target

7. SPARCworks C++ compiler and gdb

8. Who does Know a bir more about lilo

9. Sun Workshop 4.2 C++ Compiler - debug symbol format not understood by debuggers

10. SUN C++ 4.2 Compiler Questions

11. C++ 4.2 Compiler Questions

12. Linker Error in generation of .so on Solaris 6 with Sun C++ 4.2 compiler

13. SparcWorks C++ Compiler 5.0 and include paths