home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.lang.c++:16239 comp.sys.hp:12894
- Newsgroups: comp.lang.c++,comp.sys.hp
- Path: sparky!uunet!pilchuck!fnx!sgihbtn!dkarr
- From: dkarr@sierra.com (David Karr)
- Subject: C code from cfront doesn't compile
- Message-ID: <1992Nov11.231655.21277@sierra.com>
- Sender: news@sierra.com
- Nntp-Posting-Host: dopey
- Organization: Sierra Geophysics, Kirkland WA
- X-Newsreader: Tin 1.1 PL4
- Date: Wed, 11 Nov 1992 23:16:55 GMT
- Lines: 46
-
- We have been running into a bug with the HP C++ compiler that occurs when
- we try to compile certain source files with "-g" to keep a symbol table.
- The compiler fails with an "internal error". This subject has been written
- about previously in this newsgroup.
-
- I've been trying to find a workaround for this. I may have found one, but
- it is quite painful, and the reason it is painful is because of a bug in
- either the HP C++ compiler or the HP C compiler, I'm not sure which.
-
- The normal operation of the C++ compiler is to generate object code
- directly from the C++ source. There is an option called "translator mode"
- (the "+T" option) which makes the C++ compiler generate C code, and then
- pass that code to the C compiler. I thought I would experiment with that
- by looking at the generated C code and see if there was something screwy
- about it, and then try to manually compile that with the C compiler. I
- found that the original C code generated by cfront would not compile with
- the C compiler. I found it generating sequences of code like this:
-
- -------------------
- struct something;
- struct something { int stuff; }
- struct something;
- -------------------
-
- The C compiler would flag the last "forward" declaration with an error
- saying:
-
- error 1587: Redeclaration of tag "something"
-
- I hand-edited the generated C source, removing all the "post-forward"
- references, then I recompiled (with "-g"). It compiled with no errors. I
- haven't tried linking the final object file with the rest of my C++ objects
- to see whether it would make any sense.
-
- I don't know whether the "error" is on the part of the C++ compiler or the
- C compiler, it just doesn't work.
-
- The question is, is anyone aware of this situation? Will the "manually"
- generated object file link properly with a collection of C++ objects, and
- will I be able to debug this executable in a debugger and look at the
- symbols from the original source file?
- --
- David M. Karr
- Sierra Geophysics, Inc.
- ARPA: dkarr@sierra.com, UUNET: uunet!sgihbtn!dkarr
- Phone: (206) 822-5200 (x343)
-