Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!rutgers!sri-unix!hplabs!tektronix!uw-beaver!uw-june!brian From: brian@uw-june.UUCP Newsgroups: comp.lang.c++ Subject: porting c++ release 1.1 to sun2 running SUN 4.2BSD 1.1 UNIX Message-ID: <1618@uw-june.UUCP> Date: Sun, 23-Nov-86 00:12:47 EST Article-I.D.: uw-june.1618 Posted: Sun Nov 23 00:12:47 1986 Date-Received: Mon, 24-Nov-86 00:49:47 EST Reply-To: brian@uw-june.UUCP (Brian Bershad) Distribution: world Organization: U of Washington, Computer Science, Seattle Lines: 71 Has anybody managed to do this? (is anybody even running SUN 1.1 anymore?) After creating a scratch directory on a VAX (where things run fine), and using the size alignment files (as generated by szal.c), I am having the following (seemingly unrelated) problems. 1. Two files in the scratch directory cause the sun compiler to croak when the ..c files from the scratch directory are transferred to the sun from the vax. These are dcl..c and simpl..c. Sun's 1.1 C compiler complains (something like) line xxx: compiler error: no table entry for op REG The problem stems from this expression: (strcuct expr *)(_type_tsizeof( sdkhfk ) / someInteger ); which, on the face of it, seems to be coercing the result of an integer division into a pointer. While this is allowed on the vax (don't ask me why), Sun's 1.1 cc won't swallow it. You can test your compiler with something like: struct A { int x }; main() { struct A* ap; int XX; ap = (struct A*)(XX/32); } If it compiles... your compiler works. The "fix" was the following in the makefile sed 's/(struct expr \*)\((_type_tsizeof (.*\/\)/\1/' src/dcl..c > t..c mv t.c src/dcl..c for both dcl..c and simpl..c This got things past cc and got make scratch working, giving me a cfront. Ambitiously, I decided to see if I could make cfront from the c++/src directory directly. Everything hummed along nicely until cfront was handed main.c: CC main.c: "main.c", line 451: internal <> error: bus error (or something nasty like that) *** Error code 1 Stop This had me a little worried. I tried my (from scratch) cfront on the usual test suite (#include main(){cout << "hello world\n");} and it worked just fine. No core dumps, no segv's... nothing. I then tried cfront on a medium size c++ program (~2000 lines) and everything compiled and ran great. I then figured... so what if I can't get it to make itself... I just won't ever erase the binary. This is not a good thing to assume since the next thing I ported (about 10K lines) (which runs great on a VAX) gave me a bus error on the last line of some function (line 451 in c++/src/main.c is also the last line of a function which caused cfront to croak (but at least catch itself)) Since I am not sure why dcl..c and simpl..c would want to coerce results of integer divisions into pointers, I can't be sure if my sed expression "broke" things. I know that this stuff runs on sun 3's and I know that the sun 3 compiler will accept (struct x*)(int/int)... but that could just be a coincidence. Anybody else have any problems porting this thing to sun 2's running BSD UNIX 4.2 release 1.1. -- brian@june.cs.washington.edu Brian Bershad {ihnp4,decvax,ucbvax}!uw-beaver!brian Dept. of Computer Science, FR-35 Seattle, WA 98195