home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Bug_Fixes / Net.v7bugs / 0079 < prev    next >
Encoding:
Text File  |  1982-02-21  |  1.5 KB  |  53 lines

  1. Apur-ee.244
  2. net.bugs.v7
  3. utcsrgv!utzoo!decvax!pur-ee!bruner
  4. Fri Feb 19 10:46:16 1982
  5. another bug in PDP-11 'ld'
  6. Someone here recently discovered another problem with the PDP-11 "ld".
  7. While in the course of investigating it, I found several cases of
  8. signed arithmetic in the compiler/assembler/loader.  Compile the files:
  9.  
  10.     f1.c:
  11.         short junk[16383];
  12.  
  13.     f2.c:
  14.         short junk[];
  15.         main(){}
  16.  
  17. and everything works just great.  Now, change the 16383 to 16384 and
  18. try again.  This time, the loader will complain that "junk" is
  19. undefined.  I suspect that this occurs because it is using an "int"
  20. rather than an "unsigned" to hold the size of ".comm" symbols.
  21. If there is no explicit declaration of the storage (there is none
  22. in the example above), the loader takes the maximum size of all
  23. ".comm" definitions.  In this case, the sizes that it compares are
  24. zero (junk[]) and -32768, so the maximum size is zero and it appears
  25. that the symbol is undefined.
  26.  
  27. You can't even get this far if you use a "char" array:
  28.  
  29.     char junk[32768];
  30.  
  31. because the compiler gets mad at the (apparently negative) constant
  32. and says "Constant required".
  33.  
  34. You can force the array into the data segment by adding an initializer:
  35.  
  36.     short junk[16384] = {};
  37.  
  38. but the assembler gets mad at this because the compiler passes it
  39. the code:
  40.  
  41.     .globl    _junk
  42.     .data
  43.     _junk:
  44.     0
  45.     .=.+100000
  46.  
  47. and it thinks you are trying to decrease "." (a forbidden operation)
  48. by adding -32768.
  49.  
  50. --John Bruner
  51. decvax!pur-ee!bruner
  52. ucbvax!pur-ee!bruner
  53.