home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / sgi / bugs / 99 < prev    next >
Encoding:
Internet Message Format  |  1993-01-11  |  2.6 KB

  1. Path: sparky!uunet!cs.utexas.edu!sun-barr!olivea!sgigate!odin!fido!knobi.munich.sgi.com!knobi
  2. From: knobi@knobi.munich.sgi.com (Martin Knoblauch)
  3. Newsgroups: comp.sys.sgi.bugs
  4. Subject: Re: C++ and -mips2
  5. Keywords: C++, mips2
  6. Message-ID: <1ir99jINNl4s@fido.asd.sgi.com>
  7. Date: 11 Jan 93 07:57:39 GMT
  8. References: <1993Jan9.153935.9091@midway.uchicago.edu>
  9. Organization: Silicon Graphics, Inc.
  10. Lines: 67
  11. NNTP-Posting-Host: knobi.munich.sgi.com
  12.  
  13. In article <1993Jan9.153935.9091@midway.uchicago.edu>,
  14. almgren@math.uchicago.edu (Robert Almgren) writes:
  15. |> 
  16. |> The program below compiles and runs properly with
  17. |> 
  18. |>     CC -o prog prog.C
  19. |> 
  20. |> but dumps core, apparently on the assignment, when compiled with
  21. |> 
  22. |>     CC -mips2 -o prog prog.C
  23. |> 
  24. |> It does the same with the -v2 flag.
  25. |> 
  26. |> Am I overlooking something obvious, or is something wrong with the
  27. |> compiler?  (System is Crimson R4000; compilers are 3.10 release).
  28. |> 
  29. |>                     Robert Almgren
  30. |> 
  31. |>                     University of Chicago
  32. |>                     almgren@math.uchicago.edu
  33. |> 
  34. |>
  35. =====================================================================
  36. |>             File "prog.C"
  37. |> 
  38. |> #include <stdlib.h>
  39. |> #include <stdio.h>
  40. |> 
  41. |> main()
  42. |> {
  43. |>     printf("Beginning of program; allocating d\n");
  44. |> 
  45. |>     double *d = new double[3];
  46. |>     printf("d has been allocated; setting d[0]\n");
  47. |> 
  48. |>     d[0] = 1.;
  49. |>     printf("d[0] has been set; quitting\n");
  50. |> }
  51. |> 
  52. |>
  53. =====================================================================
  54.  
  55.   This is a known bug which has benn fixed for our next OS/compiler
  56. release. It has to do with 'malloc(3)' from libc.a not allocating
  57. doubles on double word boundaries, which is required by '-mips2'.
  58.  
  59.   For YOUR problem (there are others that can't be solved this
  60. way) you can compile the program using:
  61.  
  62. CC prog.cc -o prog -mips2 -lC -lmalloc
  63.  
  64.   Be aware that you HAVE TO enter '-lC' before '-lmalloc'. The usage
  65. '-lmalloc' should solve all simple alignment problems. An additional
  66. benefit is the improved performance of the allocation algorithms in
  67. 'mallox(3x)'.
  68.  
  69. Martin
  70. -- 
  71. +---------------------------------+----------------------------------+
  72. |Martin Knoblauch                 | Silicon Graphics GmbH            |
  73. |Application Support              | Am Hochacker 3 - Technopark      |
  74. |Silicon Graphics Computer Systems| W-8011 Grasbrunn-Neukeferloh, FRG|
  75. |                                 | Phone: (+int) 89 46108-179 or -0 |
  76. |                                 | Fax:   (+int) 89 46108-222       |
  77. +---------------------------------+----------------------------------+
  78. |Network: <knobi@sgi.com>         | V-Mail: 8935   | M/S: IMU-315    |
  79. +--------------------------------------------------------------------+
  80.