home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / os / vms / 22132 < prev    next >
Encoding:
Internet Message Format  |  1993-01-28  |  1.8 KB

  1. Path: sparky!uunet!ukma!usenet.ins.cwru.edu!agate!ucbvax!EQL.Caltech.Edu!rankin
  2. From: rankin@EQL.Caltech.Edu (Pat Rankin)
  3. Newsgroups: comp.os.vms
  4. Subject: Re: VAXC divide problems (V3.2)
  5. Message-ID: <930126214249.21c07f31@EQL.Caltech.Edu>
  6. Date: 27 Jan 93 05:47:20 GMT
  7. Sender: usenet@ucbvax.BERKELEY.EDU
  8. Organization: The Internet
  9. Lines: 32
  10.  
  11. >>>     subl2   #4,sp
  12. >>>Don't ask me why it allocated space on the stack without using it,
  13.  
  14. >>I think the stack space is for the condition handler.
  15.  
  16. >       Think again. The subl2 is obviously for the variable i which is
  17. >       allocated on the stack. [...]
  18. >
  19. >       It seems that the compiler didn't "notice" that it didn't use the
  20. >       space it put asside on the stack for i. This has obviously nothing
  21. >       to do with a condition handler.
  22.  
  23.      Nope.  As I explained in an earlier reply, the subtraction of 4
  24. from the stack pointer is for allocation of a local variable for use
  25. by the VAXC$ESTABLISH condition-handler setup routine.  That's not a
  26. condition handler itself, but the address of any handler you pass it
  27. is stored on the stack in the top four bytes, so they actually are
  28. space for a [pointer to a] condition handler.  The value pointed to by
  29. the frame pointer is set to a handler inside the C run-time library.
  30. Gruesome details are available in the CRTL portion of the VMS listings.
  31. This ugly violation of the VMS Procedure Calling Standard is for
  32. setjmp/longjmp handling, and is inherited from the Pascal compiler
  33. of all places!
  34.  
  35.      You can easily verify this by exploring with the debugger.  Or even
  36. simpler for the case in question, either compile with /nooptimize or
  37. declare `i' to be volatile and you'll discover that 8 bytes are allocated
  38. on the stack instead of 4, and `i' uses the 2nd longword.  The compiler
  39. didn't forget that it had moved `i' into a register.
  40.  
  41.         Pat Rankin, rankin@eql.caltech.edu
  42.  
  43.