(e-mail address removed)-cnrc.gc.ca (Walter Roberson) writes:
No, it merely causes an unspecified status to be returned to the
calling environment.
I just croschecked C89, and the wording is that the status value
returned is "undefined". So we are into the nitty gritty of exactly
what "undefined behaviour" is.
If it had used the wording you used, that the value was "unspecified",
the implication would be that there was -some- value that would be
returned -- possibly not a constant value, but that it'll get
-something-.
But as the wording says "undefined", I would take that as license for
the compiler to do something like attempt to grab a value from where it
-expects- a return value would be, and if the grabbing happens
upon a trapping value, then a trap could happen.
Hypothesize an implementation in which the ABI was such that
parameters were returned by setting a register to a pointer
to a return area (useful for passing back large structs, for example.)
It could be, even, that the calling routine was responsible for
allocating space for the return parameters and passing in that
pointer to the called routine, and that the called routine was
expected to save and return that pointer. Then the C 'return'
statement could be translated [in this scheme] into retrieving that
saved pointer, saving the return value there, and returning the pointer.
But in this scheme, if there was no 'return' then the register
used to return the pointer might get left in a random state,
possibly holding a value that, if interpreted as an address, would
result in a page fault. It seems to me that the "undefined"
wording of C89 would allow the fault -- i.e., "undefined behaviour",
whereas if the value is merely "unspecified" then although garbage
might get returned, a fault at that point would not be valid.