FISCHER@RU-BLUE.ARPA (02/24/84)
From: Ron <FISCHER@RU-BLUE.ARPA> This refers to UniPlus UNIX from version III (by UNISOFT). After much hunting around I found an odd problem. The compiler was generating bogus code at the end of a function. The function accepted a pointer to a structure and returned nothing. The bogus code included a small area in common storage (.bss), large enough to hold one copy of the structure that was passed into the function, and some instructions to copy from a structure pointed to by an uninitialized working register, into the .bss area. The bogus code then put the address of the .bss area in the return value register. There was also normal "return from a function" code in there. By examining the assembler output files in detail I determined that this only happens for the FIRST function in the file that accepts a pointer to a structure (may happen again for different types of structure, I don't know). The fixI used (not being able to get source, Mr. Gwyn) was to just put a bogus procedure at the top of the file that accepts a pointer to a structure as its argument. Thought I'd send the symptoms in. Was confusing because the superficial error resulting is a "bus error," and adb shows it occurring in an odd piece of code... Is this a standard problem of PCC, perhaps an old problem? (ron) -------
chris%umcp-cs.csnet@csnet-relay.arpa (03/02/84)
From: Chris Torek <chris%umcp-cs.csnet@csnet-relay.arpa> Sounds like you wrote struct xxx { ... } foo () { which creates a ***STRUCTURE VALUED*** function. Don't forget that ';'! Try struct xxx { ... }; foo () { instead.
ka@hou3c.UUCP (Kenneth Almquist) (03/02/84)
A piece of code which caused the compiler to exhibit the same behavior was posted to net.lang.c a couple of weeks ago. The code looked like: struct s { int x ; } subr(p, q) struct s *p, *q ; { *q = *p ; } Because the semicolon after the declaration of "s" was omitted, the routine "subr" is declared to be a routine returning a structure s rather than a routine returning int. The missing semicolon would have been caught by the compiler if "subr" had been declared to be of type "void". Kenneth Almquist