home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / gnu / gcc / bug / 2753 < prev    next >
Encoding:
Text File  |  1992-11-13  |  7.8 KB  |  368 lines

  1. Newsgroups: gnu.gcc.bug
  2. Path: sparky!uunet!stanford.edu!ames!sun-barr!cs.utexas.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!relay.mod.uk!
  3. From: @relay.mod.uk (David Bilsby, LISZT: :bilsby%hermes.mod.uk)
  4. Subject: (none)
  5. Message-ID: <9211121124.AA02667@aeneas.MIT.EDU>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: GNUs Not Usenet
  8. Distribution: gnu
  9. Date: Thu, 12 Nov 1992 11:21:00 GMT
  10. Approved: bug-gcc@prep.ai.mit.edu
  11. Lines: 355
  12.  
  13. Dear gcc-bug people,
  14.  
  15.     I am having problem with version 2.3.1 of gcc when I try to compile position independent code. I recently obtained a copy of gcc 2.3.1 for the SUN SPARCstation IPX platform running SunOS 4.1.3, I'm working on because it did not exist and the cc compiler is terrible. After careful reading of the installation instructions I proceeded to compile it. The configureation options I used were :-
  16.  
  17.     configure --target=sparc-sun-sunos4.1 --prefix=/usr2/local
  18.  
  19.     After an hour or more of compilation and recompilation it had installed gcc without any error being produced. I produced a stage 3 compiler to check against the stage 2 compiler with :-
  20.  
  21.     make compare
  22.  
  23. and this found no differences.
  24.     As I planned to use gcc mostly in ANSI mode I also ran the header file fixing script :-
  25.  
  26.     make install-fixincludes
  27.  
  28. This produced a fair number of include files in the /usr2/local/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/include directory.
  29.     After setting the appropriate path /usr2/local/bin in my system path variable I proceeded to use the compiler and found it worked OK on several progr
  30. ams. I then had cause to use it to compile a program (which is included at the end in gcc -E format) that would be a dynamically linked function. The program just consists of one function (no main).
  31.  
  32. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  33. ===============================================================================
  34. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  35.  
  36. #ifndef lint
  37. static char rcsid[] = "$Id: example.c,v 1.2 1992/04/22 20:05:14 jeffry Exp $";
  38.  
  39. #endif
  40.  
  41. /***********************************************************************
  42.      * * *   ALL RIGHTS RESERVED   * * *
  43.  
  44.     Copyright 1992 Precision Visuals, Inc.
  45.  
  46. This media contains information which is proprietary to and a trade
  47. secret of Precision Visuals, Inc. and its licensors.  It is not to be
  48. disclosed to anyone outside of this organization.
  49.  
  50.     * * *   Restricted Rights Legend * * *
  51.  
  52. Use, duplication, or disclosure by the Government is subject to
  53. restrictions as set forth in subparagraph (c) (1) (ii) of the Rights
  54. in Technical Data and Computer Software clause at 252.227-7013.
  55.  
  56. Contractor: Precision Visuals, Inc. 6230 Lookout Rd., Boulder, CO 80301
  57.  
  58. ***********************************************************************/
  59.  
  60.  
  61.  
  62. #include <stdio.h>
  63.  
  64. typedef struct complex {
  65.    float r, i;
  66. }  complex;
  67.  
  68.  
  69. long WaveParams (argc, argp)
  70. int argc;
  71. char *argp[];
  72. {
  73.    char *b;
  74.    short *s;
  75.    long *l;
  76.    float *f;
  77.    double *d;
  78.    complex *c;
  79.    char **str;
  80.  
  81.    if (argc != 7) {
  82.       fprintf (stderr, "wrong # of parameters\n");
  83.       return (0);
  84.    }
  85.  
  86.    b = ((char **) argp)[0];
  87.    s = ((short **) argp)[1];
  88.    l = ((long **) argp)[2];
  89.    f = ((float **) argp)[3];
  90.    d = ((double **) argp)[4];
  91.    c = ((complex **) argp)[5];
  92.    str = ((char ***) argp)[6];
  93.  
  94.    fprintf (stderr, "%d %d %ld %g %g <%g,%gi> '%s'\n",
  95.      (int) b[0], (int) s[0], (long) l[0], f[0], d[0], c[0].r, c[0].i, str[0]);
  96.  
  97.    return (12345);
  98. }
  99.  
  100. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  101. ===============================================================================
  102. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  103.  
  104.     The program is for use with Precision Visuals PV-WAVE graphics package and the function WaveParams is called from PV-WAVE. The sources with PV-WAVE also provided several build files for this example, the Sun one is below :-
  105.  
  106. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  107. ===============================================================================
  108. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  109.  
  110. {filename build.sun4}
  111.  
  112. #!/bin/csh
  113. #$Id: build.sun4,v 1.1 1992/03/05 11:49:52 javid Exp $
  114. cc -c -pic example.c
  115. ld -o example.so -assert pure-text example.o
  116. unalias rm
  117. rm -f example.o
  118.  
  119. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  120. ===============================================================================
  121. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  122.  
  123.     After checking the gcc manual for a 'pic' equivalent I found -fpic or -fPIC. I simply then hand compiled the program as:-
  124.  
  125.     gcc -c -fpic example.c
  126.  
  127. expecting it to work fine. Instead the following error message was generated :-
  128.  
  129. muffin% gcc -c -fpic example.c
  130. gcc: Internal compiler error: program cc1 got fatal signal 6
  131. muffin% 
  132.  
  133. I repeated the proceedure with -fPIC but the same error was generated.
  134.  
  135.     I have subsequently recompiled gcc from the begining and the new copy of gcc still produced this error. I have scanned through all the gcc info files for any anomilies about a SPARC and position independent code but could find no more than the comment abount the maximum offset of table of 8K for a SPARC chip.
  136.  
  137.     Can you help? I have tried to include as much information as possible in order to make your life easier.
  138.  
  139. Thanks for you time.
  140.  
  141. David. ("liszt::bilsby"@uk.mod.hermes)
  142.  
  143. The preprocessor output follows:-
  144.  
  145.  
  146. | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 
  147. \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
  148.  
  149. # 1 "example.c"
  150.  
  151. static char rcsid[] = "$Id: example.c,v 1.2 1992/04/22 20:05:14 jeffry Exp $";
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176. # 1 "/usr2/local/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/include/stdio.h" 1 3
  177.  
  178. # 1 "/usr2/local/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/include/stdarg.h" 1 3
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210. # 1 "/usr2/local/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/include/va-sparc.h" 1 3
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222. typedef char * __gnuc_va_list;
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232. # 79 "/usr2/local/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/include/va-sparc.h" 3
  233.  
  234.  
  235. # 32 "/usr2/local/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/include/stdarg.h" 2 3
  236.  
  237. # 77 "/usr2/local/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/include/stdarg.h" 3
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244. # 140 "/usr2/local/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/include/stdarg.h" 3
  245.  
  246.  
  247.  
  248.  
  249.  
  250. # 2 "/usr2/local/lib/gcc-lib/sparc-sun-sunos4.1/2.3.1/include/stdio.h" 2 3
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257. extern    struct    _iobuf {
  258.     int    _cnt;
  259.     unsigned char *_ptr;
  260.     unsigned char *_base;
  261.     int    _bufsiz;
  262.     short    _flag;
  263.     char    _file;         
  264. } _iob[];
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305. extern struct _iobuf     *fopen();
  306. extern struct _iobuf     *fdopen();
  307. extern struct _iobuf     *freopen();
  308. extern struct _iobuf     *popen();
  309. extern struct _iobuf     *tmpfile();
  310. extern long    ftell();
  311. extern char    *fgets();
  312. extern char    *gets();
  313. extern char    *sprintf();
  314. extern char    *ctermid();
  315. extern char    *cuserid();
  316. extern char    *tempnam();
  317. extern char    *tmpnam();
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324. # 27 "example.c" 2
  325.  
  326.  
  327. typedef struct complex {
  328.    float r, i;
  329. }  complex;
  330.  
  331.  
  332. long WaveParams (argc, argp)
  333. int argc;
  334. char *argp[];
  335. {
  336.    char *b;
  337.    short *s;
  338.    long *l;
  339.    float *f;
  340.    double *d;
  341.    complex *c;
  342.    char **str;
  343.  
  344.    if (argc != 7) {
  345.       fprintf ((&_iob[2]) , "wrong # of parameters\n");
  346.       return (0);
  347.    }
  348.  
  349.    b = ((char **) argp)[0];
  350.    s = ((short **) argp)[1];
  351.    l = ((long **) argp)[2];
  352.    f = ((float **) argp)[3];
  353.    d = ((double **) argp)[4];
  354.    c = ((complex **) argp)[5];
  355.    str = ((char ***) argp)[6];
  356.  
  357.    fprintf ((&_iob[2]) , "%d %d %ld %g %g <%g,%gi> '%s'\n",
  358.      (int) b[0], (int) s[0], (long) l[0], f[0], d[0], c[0].r, c[0].i, str[0]);
  359.  
  360.    return (12345);
  361. }
  362.  
  363. /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  364. | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 
  365.  
  366. END END END END END END END END END END END END END END END END END END END END
  367.  
  368.