home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 6 / FreshFish_September1994.bin / bbs / gnu / gcc-2.6.0-src.lha / GNU / src / amiga / gcc-2.6.0 / gcc.info-9 < prev    next >
Encoding:
GNU Info File  |  1994-07-15  |  43.3 KB  |  986 lines

  1. This is Info file gcc.info, produced by Makeinfo-1.54 from the input
  2. file gcc.texi.
  3.  
  4.    This file documents the use and the internals of the GNU compiler.
  5.  
  6.    Published by the Free Software Foundation 675 Massachusetts Avenue
  7. Cambridge, MA 02139 USA
  8.  
  9.    Copyright (C) 1988, 1989, 1992, 1993 Free Software Foundation, Inc.
  10.  
  11.    Permission is granted to make and distribute verbatim copies of this
  12. manual provided the copyright notice and this permission notice are
  13. preserved on all copies.
  14.  
  15.    Permission is granted to copy and distribute modified versions of
  16. this manual under the conditions for verbatim copying, provided also
  17. that the sections entitled "GNU General Public License" and "Protect
  18. Your Freedom--Fight `Look And Feel'" are included exactly as in the
  19. original, and provided that the entire resulting derived work is
  20. distributed under the terms of a permission notice identical to this
  21. one.
  22.  
  23.    Permission is granted to copy and distribute translations of this
  24. manual into another language, under the above conditions for modified
  25. versions, except that the sections entitled "GNU General Public
  26. License" and "Protect Your Freedom--Fight `Look And Feel'", and this
  27. permission notice, may be included in translations approved by the Free
  28. Software Foundation instead of in the original English.
  29.  
  30. 
  31. File: gcc.info,  Node: C++ Interface,  Next: C++ Signatures,  Prev: Destructors and Goto,  Up: C++ Extensions
  32.  
  33. Declarations and Definitions in One Header
  34. ==========================================
  35.  
  36.    C++ object definitions can be quite complex.  In principle, your
  37. source code will need two kinds of things for each object that you use
  38. across more than one source file.  First, you need an "interface"
  39. specification, describing its structure with type declarations and
  40. function prototypes.  Second, you need the "implementation" itself.  It
  41. can be tedious to maintain a separate interface description in a header
  42. file, in parallel to the actual implementation.  It is also dangerous,
  43. since separate interface and implementation definitions may not remain
  44. parallel.
  45.  
  46.    With GNU C++, you can use a single header file for both purposes.
  47.  
  48.      *Warning:* The mechanism to specify this is in transition.  For the
  49.      nonce, you must use one of two `#pragma' commands; in a future
  50.      release of GNU C++, an alternative mechanism will make these
  51.      `#pragma' commands unnecessary.
  52.  
  53.    The header file contains the full definitions, but is marked with
  54. `#pragma interface' in the source code.  This allows the compiler to
  55. use the header file only as an interface specification when ordinary
  56. source files incorporate it with `#include'.  In the single source file
  57. where the full implementation belongs, you can use either a naming
  58. convention or `#pragma implementation' to indicate this alternate use
  59. of the header file.
  60.  
  61. `#pragma interface'
  62.      Use this directive in *header files* that define object classes,
  63.      to save space in most of the object files that use those classes.
  64.      Normally, local copies of certain information (backup copies of
  65.      inline member functions, debugging information, and the internal
  66.      tables that implement virtual functions) must be kept in each
  67.      object file that includes class definitions.  You can use this
  68.      pragma to avoid such duplication.  When a header file containing
  69.      `#pragma interface' is included in a compilation, this auxiliary
  70.      information will not be generated (unless the main input source
  71.      file itself uses `#pragma implementation').  Instead, the object
  72.      files will contain references to be resolved at link time.
  73.  
  74. `#pragma implementation'
  75. `#pragma implementation "OBJECTS.h"'
  76.      Use this pragma in a *main input file*, when you want full output
  77.      from included header files to be generated (and made globally
  78.      visible).  The included header file, in turn, should use `#pragma
  79.      interface'.  Backup copies of inline member functions, debugging
  80.      information, and the internal tables used to implement virtual
  81.      functions are all generated in implementation files.
  82.  
  83.      `#pragma implementation' is *implied* whenever the basename(1) of
  84.      your source file matches the basename of a header file it
  85.      includes.  There is no way to turn this off (other than using a
  86.      different name for one of the two files).  In the same vein, if
  87.      you use `#pragma implementation' with no argument, it applies to an
  88.      include file with the same basename as your source file.  For
  89.      example, in `allclass.cc', `#pragma implementation' by itself is
  90.      equivalent to `#pragma implementation "allclass.h"'; but even if
  91.      you do not say `#pragma implementation' at all, `allclass.h' is
  92.      treated as an implementation file whenever you include it from
  93.      `allclass.cc'.
  94.  
  95.      If you use an explicit `#pragma implementation', it must appear in
  96.      your source file *before* you include the affected header files.
  97.  
  98.      Use the string argument if you want a single implementation file to
  99.      include code from multiple header files.  (You must also use
  100.      `#include' to include the header file; `#pragma implementation'
  101.      only specifies how to use the file--it doesn't actually include
  102.      it.)
  103.  
  104.      There is no way to split up the contents of a single header file
  105.      into multiple implementation files.
  106.  
  107.    `#pragma implementation' and `#pragma interface' also have an effect
  108. on function inlining.
  109.  
  110.    If you define a class in a header file marked with `#pragma
  111. interface', the effect on a function defined in that class is similar to
  112. an explicit `extern' declaration--the compiler emits no code at all to
  113. define an independent version of the function.  Its definition is used
  114. only for inlining with its callers.
  115.  
  116.    Conversely, when you include the same header file in a main source
  117. file that declares it as `#pragma implementation', the compiler emits
  118. code for the function itself; this defines a version of the function
  119. that can be found via pointers (or by callers compiled without
  120. inlining).
  121.  
  122.    ---------- Footnotes ----------
  123.  
  124.    (1)  A file's "basename" is the name stripped of all leading path
  125. information and of trailing suffixes, such as `.h' or `.C' or `.cc'.
  126.  
  127. 
  128. File: gcc.info,  Node: C++ Signatures,  Prev: C++ Interface,  Up: C++ Extensions
  129.  
  130. Type Abstraction using Signatures
  131. =================================
  132.  
  133.    In GNU C++, you can use the keyword `signature' to define a
  134. completely abstract class interface as a datatype.  You can connect this
  135. abstraction with actual classes using signature pointers.  If you want
  136. to use signatures, run the GNU compiler with the `-fhandle-signatures'
  137. command-line option.  (With this option, the compiler reserves a second
  138. keyword `sigof' as well, for a future extension.)
  139.  
  140.    Roughly, signatures are type abstractions or interfaces of classes.
  141. Some other languages have similar facilities.  C++ signatures are
  142. related to ML's signatures, Haskell's type classes, definition modules
  143. in Modula-2, interface modules in Modula-3, abstract types in Emerald,
  144. type modules in Trellis/Owl, categories in Scratchpad II, and types in
  145. POOL-I.  For a more detailed discussion of signatures, see `Signatures:
  146. A C++ Extension for Type Abstraction and Subtype Polymorphism' by
  147. Gerald Baumgartner and Vincent F. Russo (Tech report CSD-TR-93-059,
  148. Dept. of Computer Sciences, Purdue University, September 1993, to
  149. appear in *Software Practice & Experience*).  You can get the tech
  150. report by anonymous FTP from `ftp.cs.purdue.edu' in
  151. `pub/reports/TR93-059.PS.Z'.
  152.  
  153.    Syntactically, a signature declaration is a collection of member
  154. function declarations and nested type declarations.  For example, this
  155. signature declaration defines a new abstract type `S' with member
  156. functions `int foo ()' and `int bar (int)':
  157.  
  158.      signature S
  159.      {
  160.        int foo ();
  161.        int bar (int);
  162.      };
  163.  
  164.    Since signature types do not include implementation definitions, you
  165. cannot write an instance of a signature directly.  Instead, you can
  166. define a pointer to any class that contains the required interfaces as a
  167. "signature pointer".  Such a class "implements" the signature type.
  168.  
  169.    To use a class as an implementation of `S', you must ensure that the
  170. class has public member functions `int foo ()' and `int bar (int)'.
  171. The class can have other member functions as well, public or not; as
  172. long as it offers what's declared in the signature, it is suitable as
  173. an implementation of that signature type.
  174.  
  175.    For example, suppose that `C' is a class that meets the requirements
  176. of signature `S' (`C' "conforms to" `S').  Then
  177.  
  178.      C obj;
  179.      S * p = &obj;
  180.  
  181. defines a signature pointer `p' and initializes it to point to an
  182. object of type `C'.  The member function call `int i = p->foo ();'
  183. executes `obj.foo ()'.
  184.  
  185.    Abstract virtual classes provide somewhat similar facilities in
  186. standard C++.  There are two main advantages to using signatures
  187. instead:
  188.  
  189.   1. Subtyping becomes independent from inheritance.  A class or
  190.      signature type `T' is a subtype of a signature type `S'
  191.      independent of any inheritance hierarchy as long as all the member
  192.      functions declared in `S' are also found in `T'.  So you can
  193.      define a subtype hierarchy that is completely independent from any
  194.      inheritance (implementation) hierarchy, instead of being forced to
  195.      use types that mirror the class inheritance hierarchy.
  196.  
  197.   2. Signatures allow you to work with existing class hierarchies as
  198.      implementations of a signature type.  If those class hierarchies
  199.      are only available in compiled form, you're out of luck with
  200.      abstract virtual classes, since an abstract virtual class cannot
  201.      be retrofitted on top of existing class hierarchies.  So you would
  202.      be required to write interface classes as subtypes of the abstract
  203.      virtual class.
  204.  
  205.    There is one more detail about signatures.  A signature declaration
  206. can contain member function *definitions* as well as member function
  207. declarations.  A signature member function with a full definition is
  208. called a *default implementation*; classes need not contain that
  209. particular interface in order to conform.  For example, a class `C' can
  210. conform to the signature
  211.  
  212.      signature T
  213.      {
  214.        int f (int);
  215.        int f0 () { return f (0); };
  216.      };
  217.  
  218. whether or not `C' implements the member function `int f0 ()'.  If you
  219. define `C::f0', that definition takes precedence; otherwise, the
  220. default implementation `S::f0' applies.
  221.  
  222. 
  223. File: gcc.info,  Node: Trouble,  Next: Bugs,  Prev: C++ Extensions,  Up: Top
  224.  
  225. Known Causes of Trouble with GNU CC
  226. ***********************************
  227.  
  228.    This section describes known problems that affect users of GNU CC.
  229. Most of these are not GNU CC bugs per se--if they were, we would fix
  230. them.  But the result for a user may be like the result of a bug.
  231.  
  232.    Some of these problems are due to bugs in other software, some are
  233. missing features that are too much work to add, and some are places
  234. where people's opinions differ as to what is best.
  235.  
  236. * Menu:
  237.  
  238. * Actual Bugs::              Bugs we will fix later.
  239. * Installation Problems::     Problems that manifest when you install GNU CC.
  240. * Cross-Compiler Problems::   Common problems of cross compiling with GNU CC.
  241. * Interoperation::      Problems using GNU CC with other compilers,
  242.                and with certain linkers, assemblers and debuggers.
  243. * External Bugs::    Problems compiling certain programs.
  244. * Incompatibilities::   GNU CC is incompatible with traditional C.
  245. * Fixed Headers::       GNU C uses corrected versions of system header files.
  246.                            This is necessary, but doesn't always work smoothly.
  247. * Disappointments::     Regrettable things we can't change, but not quite bugs.
  248. * C++ Misunderstandings::     Common misunderstandings with GNU C++.
  249. * Protoize Caveats::    Things to watch out for when using `protoize'.
  250. * Non-bugs::        Things we think are right, but some others disagree.
  251. * Warnings and Errors:: Which problems in your code get warnings,
  252.                          and which get errors.
  253.  
  254. 
  255. File: gcc.info,  Node: Actual Bugs,  Next: Installation Problems,  Up: Trouble
  256.  
  257. Actual Bugs We Haven't Fixed Yet
  258. ================================
  259.  
  260.    * The `fixincludes' script interacts badly with automounters; if the
  261.      directory of system header files is automounted, it tends to be
  262.      unmounted while `fixincludes' is running.  This would seem to be a
  263.      bug in the automounter.  We don't know any good way to work around
  264.      it.
  265.  
  266.    * The `fixproto' script will sometimes add prototypes for the
  267.      `sigsetjmp' and `siglongjmp' functions that reference the
  268.      `jmp_buf' type before that type is defined.  To work around this,
  269.      edit the offending file and place the typedef in front of the
  270.      prototypes.
  271.  
  272.    * Loop unrolling doesn't work properly for certain C++ programs.
  273.      This is because of difficulty in updating the debugging
  274.      information within the loop being unrolled.  We plan to revamp the
  275.      representation of debugging information so that this will work
  276.      properly, but we have not done this in version 2.6 because we
  277.      don't want to delay it any further.
  278.  
  279. 
  280. File: gcc.info,  Node: Installation Problems,  Next: Cross-Compiler Problems,  Prev: Actual Bugs,  Up: Trouble
  281.  
  282. Installation Problems
  283. =====================
  284.  
  285.    This is a list of problems (and some apparent problems which don't
  286. really mean anything is wrong) that show up during installation of GNU
  287. CC.
  288.  
  289.    * On certain systems, defining certain environment variables such as
  290.      `CC' can interfere with the functioning of `make'.
  291.  
  292.    * If you encounter seemingly strange errors when trying to build the
  293.      compiler in a directory other than the source directory, it could
  294.      be because you have previously configured the compiler in the
  295.      source directory.  Make sure you have done all the necessary
  296.      preparations.  *Note Other Dir::.
  297.  
  298.    * If you build GNU CC on a BSD system using a directory stored in a
  299.      System V file system, problems may occur in running `fixincludes'
  300.      if the System V file system doesn't support symbolic links.  These
  301.      problems result in a failure to fix the declaration of `size_t' in
  302.      `sys/types.h'.  If you find that `size_t' is a signed type and
  303.      that type mismatches occur, this could be the cause.
  304.  
  305.      The solution is not to use such a directory for building GNU CC.
  306.  
  307.    * In previous versions of GNU CC, the `gcc' driver program looked for
  308.      `as' and `ld' in various places; for example, in files beginning
  309.      with `/usr/local/lib/gcc-'.  GNU CC version 2 looks for them in
  310.      the directory `/usr/local/lib/gcc-lib/TARGET/VERSION'.
  311.  
  312.      Thus, to use a version of `as' or `ld' that is not the system
  313.      default, for example `gas' or GNU `ld', you must put them in that
  314.      directory (or make links to them from that directory).
  315.  
  316.    * Some commands executed when making the compiler may fail (return a
  317.      non-zero status) and be ignored by `make'.  These failures, which
  318.      are often due to files that were not found, are expected, and can
  319.      safely be ignored.
  320.  
  321.    * It is normal to have warnings in compiling certain files about
  322.      unreachable code and about enumeration type clashes.  These files'
  323.      names begin with `insn-'.  Also, `real.c' may get some warnings
  324.      that you can ignore.
  325.  
  326.    * Sometimes `make' recompiles parts of the compiler when installing
  327.      the compiler.  In one case, this was traced down to a bug in
  328.      `make'.  Either ignore the problem or switch to GNU Make.
  329.  
  330.    * If you have installed a program known as purify, you may find that
  331.      it causes errors while linking `enquire', which is part of building
  332.      GNU CC.  The fix is to get rid of the file `real-ld' which purify
  333.      installs--so that GNU CC won't try to use it.
  334.  
  335.    * On Linux SLS 1.01, there is a problem with `libc.a': it does not
  336.      contain the obstack functions.  However, GNU CC assumes that the
  337.      obstack functions are in `libc.a' when it is the GNU C library.
  338.      To work around this problem, change the `__GNU_LIBRARY__'
  339.      conditional around line 31 to `#if 1'.
  340.  
  341.    * On some 386 systems, building the compiler never finishes because
  342.      `enquire' hangs due to a hardware problem in the motherboard--it
  343.      reports floating point exceptions to the kernel incorrectly.  You
  344.      can install GNU CC except for `float.h' by patching out the
  345.      command to run `enquire'.  You may also be able to fix the problem
  346.      for real by getting a replacement motherboard.  This problem was
  347.      observed in Revision E of the Micronics motherboard, and is fixed
  348.      in Revision F.  It has also been observed in the MYLEX MXA-33
  349.      motherboard.
  350.  
  351.      If you encounter this problem, you may also want to consider
  352.      removing the FPU from the socket during the compilation.
  353.      Alternatively, if you are running SCO Unix, you can reboot and
  354.      force the FPU to be ignored.  To do this, type `hd(40)unix auto
  355.      ignorefpu'.
  356.  
  357.    * On some 386 systems, GNU CC crashes trying to compile `enquire.c'.
  358.      This happens on machines that don't have a 387 FPU chip.  On 386
  359.      machines, the system kernel is supposed to emulate the 387 when you
  360.      don't have one.  The crash is due to a bug in the emulator.
  361.  
  362.      One of these systems is the Unix from Interactive Systems: 386/ix.
  363.      On this system, an alternate emulator is provided, and it does
  364.      work.  To use it, execute this command as super-user:
  365.  
  366.           ln /etc/emulator.rel1 /etc/emulator
  367.  
  368.      and then reboot the system.  (The default emulator file remains
  369.      present under the name `emulator.dflt'.)
  370.  
  371.      Try using `/etc/emulator.att', if you have such a problem on the
  372.      SCO system.
  373.  
  374.      Another system which has this problem is Esix.  We don't know
  375.      whether it has an alternate emulator that works.
  376.  
  377.      On NetBSD 0.8, a similar problem manifests itself as these error
  378.      messages:
  379.  
  380.           enquire.c: In function `fprop':
  381.           enquire.c:2328: floating overflow
  382.  
  383.    * On SCO systems, when compiling GNU CC with the system's compiler,
  384.      do not use `-O'.  Some versions of the system's compiler miscompile
  385.      GNU CC with `-O'.
  386.  
  387.    * Sometimes on a Sun 4 you may observe a crash in the program
  388.      `genflags' or `genoutput' while building GNU CC.  This is said to
  389.      be due to a bug in `sh'.  You can probably get around it by running
  390.      `genflags' or `genoutput' manually and then retrying the `make'.
  391.  
  392.    * On Solaris 2, executables of GNU CC version 2.0.2 are commonly
  393.      available, but they have a bug that shows up when compiling current
  394.      versions of GNU CC: undefined symbol errors occur during assembly
  395.      if you use `-g'.
  396.  
  397.      The solution is to compile the current version of GNU CC without
  398.      `-g'.  That makes a working compiler which you can use to recompile
  399.      with `-g'.
  400.  
  401.    * Solaris 2 comes with a number of optional OS packages.  Some of
  402.      these packages are needed to use GNU CC fully.  If you did not
  403.      install all optional packages when installing Solaris, you will
  404.      need to verify that the packages that GNU CC needs are installed.
  405.  
  406.      To check whether an optional package is installed, use the
  407.      `pkginfo' command.  To add an optional package, use the `pkgadd'
  408.      command.  For further details, see the Solaris documentation.
  409.  
  410.      For Solaris 2.0 and 2.1, GNU CC needs six packages: `SUNWarc',
  411.      `SUNWbtool', `SUNWesu', `SUNWhea', `SUNWlibm', and `SUNWtoo'.
  412.  
  413.      For Solaris 2.2, GNU CC needs an additional seventh package:
  414.      `SUNWsprot'.
  415.  
  416.    * On Solaris 2, trying to use the linker and other tools in
  417.      `/usr/ucb' to install GNU CC has been observed to cause trouble.
  418.      For example, the linker may hang indefinitely.  The fix is to
  419.      remove `/usr/ucb' from your `PATH'.
  420.  
  421.    * If you use the 1.31 version of the MIPS assembler (such as was
  422.      shipped with Ultrix 3.1), you will need to use the
  423.      -fno-delayed-branch switch when optimizing floating point code.
  424.      Otherwise, the assembler will complain when the GCC compiler fills
  425.      a branch delay slot with a floating point instruction, such as
  426.      `add.d'.
  427.  
  428.    * If on a MIPS system you get an error message saying "does not have
  429.      gp sections for all it's [sic] sectons [sic]", don't worry about
  430.      it.  This happens whenever you use GAS with the MIPS linker, but
  431.      there is not really anything wrong, and it is okay to use the
  432.      output file.  You can stop such warnings by installing the GNU
  433.      linker.
  434.  
  435.      It would be nice to extend GAS to produce the gp tables, but they
  436.      are optional, and there should not be a warning about their
  437.      absence.
  438.  
  439.    * In Ultrix 4.0 on the MIPS machine, `stdio.h' does not work with GNU
  440.      CC at all unless it has been fixed with `fixincludes'.  This causes
  441.      problems in building GNU CC.  Once GNU CC is installed, the
  442.      problems go away.
  443.  
  444.      To work around this problem, when making the stage 1 compiler,
  445.      specify this option to Make:
  446.  
  447.           GCC_FOR_TARGET="./xgcc -B./ -I./include"
  448.  
  449.      When making stage 2 and stage 3, specify this option:
  450.  
  451.           CFLAGS="-g -I./include"
  452.  
  453.    * Users have reported some problems with version 2.0 of the MIPS
  454.      compiler tools that were shipped with Ultrix 4.1.  Version 2.10
  455.      which came with Ultrix 4.2 seems to work fine.
  456.  
  457.      Users have also reported some problems with version 2.20 of the
  458.      MIPS compiler tools that were shipped with RISC/os 4.x.  The
  459.      earlier version 2.11 seems to work fine.
  460.  
  461.    * Some versions of the MIPS linker will issue an assertion failure
  462.      when linking code that uses `alloca' against shared libraries on
  463.      RISC-OS 5.0, and DEC's OSF/1 systems.  This is a bug in the
  464.      linker, that is supposed to be fixed in future revisions.  To
  465.      protect against this, GNU CC passes `-non_shared' to the linker
  466.      unless you pass an explicit `-shared' or `-call_shared' switch.
  467.  
  468.    * On System V release 3, you may get this error message while
  469.      linking:
  470.  
  471.           ld fatal: failed to write symbol name SOMETHING
  472.            in strings table for file WHATEVER
  473.  
  474.      This probably indicates that the disk is full or your ULIMIT won't
  475.      allow the file to be as large as it needs to be.
  476.  
  477.      This problem can also result because the kernel parameter `MAXUMEM'
  478.      is too small.  If so, you must regenerate the kernel and make the
  479.      value much larger.  The default value is reported to be 1024; a
  480.      value of 32768 is said to work.  Smaller values may also work.
  481.  
  482.    * On System V, if you get an error like this,
  483.  
  484.           /usr/local/lib/bison.simple: In function `yyparse':
  485.           /usr/local/lib/bison.simple:625: virtual memory exhausted
  486.  
  487.      that too indicates a problem with disk space, ULIMIT, or `MAXUMEM'.
  488.  
  489.    * Current GNU CC versions probably do not work on version 2 of the
  490.      NeXT operating system.
  491.  
  492.    * On NeXTStep 3.0, the Objective C compiler does not work, due,
  493.      apparently, to a kernel bug that it happens to trigger.  This
  494.      problem does not happen on 3.1.
  495.  
  496.    * On the Tower models 4N0 and 6N0, by default a process is not
  497.      allowed to have more than one megabyte of memory.  GNU CC cannot
  498.      compile itself (or many other programs) with `-O' in that much
  499.      memory.
  500.  
  501.      To solve this problem, reconfigure the kernel adding the following
  502.      line to the configuration file:
  503.  
  504.           MAXUMEM = 4096
  505.  
  506.    * On HP 9000 series 300 or 400 running HP-UX release 8.0, there is a
  507.      bug in the assembler that must be fixed before GNU CC can be
  508.      built.  This bug manifests itself during the first stage of
  509.      compilation, while building `libgcc2.a':
  510.  
  511.           _floatdisf
  512.           cc1: warning: `-g' option not supported on this version of GCC
  513.           cc1: warning: `-g1' option not supported on this version of GCC
  514.           ./xgcc: Internal compiler error: program as got fatal signal 11
  515.  
  516.      A patched version of the assembler is available by anonymous ftp
  517.      from `altdorf.ai.mit.edu' as the file
  518.      `archive/cph/hpux-8.0-assembler'.  If you have HP software support,
  519.      the patch can also be obtained directly from HP, as described in
  520.      the following note:
  521.  
  522.           This is the patched assembler, to patch SR#1653-010439, where
  523.           the assembler aborts on floating point constants.
  524.  
  525.           The bug is not really in the assembler, but in the shared
  526.           library version of the function "cvtnum(3c)".  The bug on
  527.           "cvtnum(3c)" is SR#4701-078451.  Anyway, the attached
  528.           assembler uses the archive library version of "cvtnum(3c)"
  529.           and thus does not exhibit the bug.
  530.  
  531.      This patch is also known as PHCO_0800.
  532.  
  533.    * On HP-UX version 8.05, but not on 8.07 or more recent versions,
  534.      the `fixproto' shell script triggers a bug in the system shell.
  535.      If you encounter this problem, upgrade your operating system or
  536.      use BASH (the GNU shell) to run `fixproto'.
  537.  
  538.    * Some versions of the Pyramid C compiler are reported to be unable
  539.      to compile GNU CC.  You must use an older version of GNU CC for
  540.      bootstrapping.  One indication of this problem is if you get a
  541.      crash when GNU CC compiles the function `muldi3' in file
  542.      `libgcc2.c'.
  543.  
  544.      You may be able to succeed by getting GNU CC version 1, installing
  545.      it, and using it to compile GNU CC version 2.  The bug in the
  546.      Pyramid C compiler does not seem to affect GNU CC version 1.
  547.  
  548.    * There may be similar problems on System V Release 3.1 on 386
  549.      systems.
  550.  
  551.    * On the Intel Paragon (an i860 machine), if you are using operating
  552.      system version 1.0, you will get warnings or errors about
  553.      redefinition of `va_arg' when you build GNU CC.
  554.  
  555.      If this happens, then you need to link most programs with the
  556.      library `iclib.a'.  You must also modify `stdio.h' as follows:
  557.      before the lines
  558.  
  559.           #if     defined(__i860__) && !defined(_VA_LIST)
  560.           #include <va_list.h>
  561.  
  562.      insert the line
  563.  
  564.           #if __PGC__
  565.  
  566.      and after the lines
  567.  
  568.           extern int  vprintf(const char *, va_list );
  569.           extern int  vsprintf(char *, const char *, va_list );
  570.           #endif
  571.  
  572.      insert the line
  573.  
  574.           #endif /* __PGC__ */
  575.  
  576.      These problems don't exist in operating system version 1.1.
  577.  
  578.    * On the Altos 3068, programs compiled with GNU CC won't work unless
  579.      you fix a kernel bug.  This happens using system versions V.2.2
  580.      1.0gT1 and V.2.2 1.0e and perhaps later versions as well.  See the
  581.      file `README.ALTOS'.
  582.  
  583.    * You will get several sorts of compilation and linking errors on the
  584.      we32k if you don't follow the special instructions.  *Note
  585.      Configurations::.
  586.  
  587.    * A bug in the HP-UX 8.05 (and earlier) shell will cause the fixproto
  588.      program to report an error of the form:
  589.  
  590.           ./fixproto: sh internal 1K buffer overflow
  591.  
  592.      To fix this, change the first line of the fixproto script to look
  593.      like:
  594.  
  595.           #!/bin/ksh
  596.  
  597. 
  598. File: gcc.info,  Node: Cross-Compiler Problems,  Next: Interoperation,  Prev: Installation Problems,  Up: Trouble
  599.  
  600. Cross-Compiler Problems
  601. =======================
  602.  
  603.    You may run into problems with cross compilation on certain machines,
  604. for several reasons.
  605.  
  606.    * Cross compilation can run into trouble for certain machines because
  607.      some target machines' assemblers require floating point numbers to
  608.      be written as *integer* constants in certain contexts.
  609.  
  610.      The compiler writes these integer constants by examining the
  611.      floating point value as an integer and printing that integer,
  612.      because this is simple to write and independent of the details of
  613.      the floating point representation.  But this does not work if the
  614.      compiler is running on a different machine with an incompatible
  615.      floating point format, or even a different byte-ordering.
  616.  
  617.      In addition, correct constant folding of floating point values
  618.      requires representing them in the target machine's format.  (The C
  619.      standard does not quite require this, but in practice it is the
  620.      only way to win.)
  621.  
  622.      It is now possible to overcome these problems by defining macros
  623.      such as `REAL_VALUE_TYPE'.  But doing so is a substantial amount of
  624.      work for each target machine.  *Note Cross-compilation::.
  625.  
  626.    * At present, the program `mips-tfile' which adds debug support to
  627.      object files on MIPS systems does not work in a cross compile
  628.      environment.
  629.  
  630. 
  631. File: gcc.info,  Node: Interoperation,  Next: External Bugs,  Prev: Cross-Compiler Problems,  Up: Trouble
  632.  
  633. Interoperation
  634. ==============
  635.  
  636.    This section lists various difficulties encountered in using GNU C or
  637. GNU C++ together with other compilers or with the assemblers, linkers,
  638. libraries and debuggers on certain systems.
  639.  
  640.    * Objective C does not work on the RS/6000.
  641.  
  642.    * GNU C++ does not do name mangling in the same way as other C++
  643.      compilers.  This means that object files compiled with one compiler
  644.      cannot be used with another.
  645.  
  646.      This effect is intentional, to protect you from more subtle
  647.      problems.  Compilers differ as to many internal details of C++
  648.      implementation, including: how class instances are laid out, how
  649.      multiple inheritance is implemented, and how virtual function
  650.      calls are handled.  If the name encoding were made the same, your
  651.      programs would link against libraries provided from other
  652.      compilers--but the programs would then crash when run.
  653.      Incompatible libraries are then detected at link time, rather than
  654.      at run time.
  655.  
  656.    * Older GDB versions sometimes fail to read the output of GNU CC
  657.      version 2.  If you have trouble, get GDB version 4.4 or later.
  658.  
  659.    * DBX rejects some files produced by GNU CC, though it accepts
  660.      similar constructs in output from PCC.  Until someone can supply a
  661.      coherent description of what is valid DBX input and what is not,
  662.      there is nothing I can do about these problems.  You are on your
  663.      own.
  664.  
  665.    * The GNU assembler (GAS) does not support PIC.  To generate PIC
  666.      code, you must use some other assembler, such as `/bin/as'.
  667.  
  668.    * On some BSD systems, including some versions of Ultrix, use of
  669.      profiling causes static variable destructors (currently used only
  670.      in C++) not to be run.
  671.  
  672.    * Use of `-I/usr/include' may cause trouble.
  673.  
  674.      Many systems come with header files that won't work with GNU CC
  675.      unless corrected by `fixincludes'.  The corrected header files go
  676.      in a new directory; GNU CC searches this directory before
  677.      `/usr/include'.  If you use `-I/usr/include', this tells GNU CC to
  678.      search `/usr/include' earlier on, before the corrected headers.
  679.      The result is that you get the uncorrected header files.
  680.  
  681.      Instead, you should use these options (when compiling C programs):
  682.  
  683.           -I/usr/local/lib/gcc-lib/TARGET/VERSION/include -I/usr/include
  684.  
  685.      For C++ programs, GNU CC also uses a special directory that
  686.      defines C++ interfaces to standard C subroutines.  This directory
  687.      is meant to be searched *before* other standard include
  688.      directories, so that it takes precedence.  If you are compiling
  689.      C++ programs and specifying include directories explicitly, use
  690.      this option first, then the two options above:
  691.  
  692.           -I/usr/local/lib/g++-include
  693.  
  694.    * On some SGI systems, when you use `-lgl_s' as an option, it gets
  695.      translated magically to `-lgl_s -lX11_s -lc_s'.  Naturally, this
  696.      does not happen when you use GNU CC.  You must specify all three
  697.      options explicitly.
  698.  
  699.    * On a Sparc, GNU CC aligns all values of type `double' on an 8-byte
  700.      boundary, and it expects every `double' to be so aligned.  The Sun
  701.      compiler usually gives `double' values 8-byte alignment, with one
  702.      exception: function arguments of type `double' may not be aligned.
  703.  
  704.      As a result, if a function compiled with Sun CC takes the address
  705.      of an argument of type `double' and passes this pointer of type
  706.      `double *' to a function compiled with GNU CC, dereferencing the
  707.      pointer may cause a fatal signal.
  708.  
  709.      One way to solve this problem is to compile your entire program
  710.      with GNU CC.  Another solution is to modify the function that is
  711.      compiled with Sun CC to copy the argument into a local variable;
  712.      local variables are always properly aligned.  A third solution is
  713.      to modify the function that uses the pointer to dereference it via
  714.      the following function `access_double' instead of directly with
  715.      `*':
  716.  
  717.           inline double
  718.           access_double (double *unaligned_ptr)
  719.           {
  720.             union d2i { double d; int i[2]; };
  721.           
  722.             union d2i *p = (union d2i *) unaligned_ptr;
  723.             union d2i u;
  724.           
  725.             u.i[0] = p->i[0];
  726.             u.i[1] = p->i[1];
  727.           
  728.             return u.d;
  729.           }
  730.  
  731.      Storing into the pointer can be done likewise with the same union.
  732.  
  733.    * On Solaris, the `malloc' function in the `libmalloc.a' library may
  734.      allocate memory that is only 4 byte aligned.  Since GNU CC on the
  735.      Sparc assumes that doubles are 8 byte aligned, this may result in a
  736.      fatal signal if doubles are stored in memory allocated by the
  737.      `libmalloc.a' library.
  738.  
  739.      The solution is to not use the `libmalloc.a' library.  Use instead
  740.      `malloc' and related functions from `libc.a'; they do not have
  741.      this problem.
  742.  
  743.    * On a Sun, linking using GNU CC fails to find a shared library and
  744.      reports that the library doesn't exist at all.
  745.  
  746.      This happens if you are using the GNU linker, because it does only
  747.      static linking and looks only for unshared libraries.  If you have
  748.      a shared library with no unshared counterpart, the GNU linker
  749.      won't find anything.
  750.  
  751.      We hope to make a linker which supports Sun shared libraries, but
  752.      please don't ask when it will be finished--we don't know.
  753.  
  754.    * Sun forgot to include a static version of `libdl.a' with some
  755.      versions of SunOS (mainly 4.1).  This results in undefined symbols
  756.      when linking static binaries (that is, if you use `-static').  If
  757.      you see undefined symbols `_dlclose', `_dlsym' or `_dlopen' when
  758.      linking, compile and link against the file `mit/util/misc/dlsym.c'
  759.      from the MIT version of X windows.
  760.  
  761.    * The 128-bit long double format that the Sparc port supports
  762.      currently works by using the architecturally defined quad-word
  763.      floating point instructions.  Since there is no hardware that
  764.      supports these instructions they must be emulated by the operating
  765.      system.  Long doubles do not work in Sun OS versions 4.0.3 and
  766.      earlier, because the kernel eumulator uses an obsolete and
  767.      incompatible format.  Long doubles do not work in Sun OS versions
  768.      4.1.1 to 4.1.3 because of emululator bugs that cause random
  769.      unpredicatable failures.  Long doubles appear to work in Sun OS 5.x
  770.      (Solaris 2.x).
  771.  
  772.    * On HP-UX version 9.01 on the HP PA, the HP compiler `cc' does not
  773.      compile GNU CC correctly.  We do not yet know why.  However, GNU CC
  774.      compiled on earlier HP-UX versions works properly on HP-UX 9.01
  775.      and can compile itself properly on 9.01.
  776.  
  777.    * On the HP PA machine, ADB sometimes fails to work on functions
  778.      compiled with GNU CC.  Specifically, it fails to work on functions
  779.      that use `alloca' or variable-size arrays.  This is because GNU CC
  780.      doesn't generate HP-UX unwind descriptors for such functions.  It
  781.      may even be impossible to generate them.
  782.  
  783.    * Debugging (`-g') is not supported on the HP PA machine, unless you
  784.      use the preliminary GNU tools (*note Installation::.).
  785.  
  786.    * Taking the address of a label may generate errors from the HP-UX
  787.      PA assembler.  GAS for the PA does not have this problem.
  788.  
  789.    * Using floating point parameters for indirect calls to static
  790.      functions will not work when using the HP assembler.  There simply
  791.      is no way for GCC to specify what registers hold arguments for
  792.      static functions when using the HP assembler.  GAS for the PA does
  793.      not have this problem.
  794.  
  795.    * For some very large functions you may receive errors from the HP
  796.      linker complaining about an out of bounds unconditional branch
  797.      offset.  Fixing this problem correctly requires fixing problems in
  798.      GNU CC and GAS.  We hope to fix this in time for GNU CC 2.6.
  799.      Until then you can work around by making your function smaller,
  800.      and if you are using GAS, splitting the function into multiple
  801.      source files may be necessary.
  802.  
  803.    * GNU CC compiled code sometimes emits warnings from the HP-UX
  804.      assembler of the form:
  805.  
  806.           (warning) Use of GR3 when
  807.             frame >= 8192 may cause conflict.
  808.  
  809.      These warnings are harmless and can be safely ignored.
  810.  
  811.    * The current version of the assembler (`/bin/as') for the RS/6000
  812.      has certain problems that prevent the `-g' option in GCC from
  813.      working.  Note that `Makefile.in' uses `-g' by default when
  814.      compiling `libgcc2.c'.
  815.  
  816.      IBM has produced a fixed version of the assembler.  The upgraded
  817.      assembler unfortunately was not included in any of the AIX 3.2
  818.      update PTF releases (3.2.2, 3.2.3, or 3.2.3e).  Users of AIX 3.1
  819.      should request PTF U403044 from IBM and users of AIX 3.2 should
  820.      request PTF U416277.  See the file `README.RS6000' for more
  821.      details on these updates.
  822.  
  823.      You can test for the presense of a fixed assembler by using the
  824.      command
  825.  
  826.           as -u < /dev/null
  827.  
  828.      If the command exits normally, the assembler fix already is
  829.      installed.  If the assembler complains that "-u" is an unknown
  830.      flag, you need to order the fix.
  831.  
  832.    * On the IBM RS/6000, compiling code of the form
  833.  
  834.           extern int foo;
  835.           
  836.           ... foo ...
  837.           
  838.           static int foo;
  839.  
  840.      will cause the linker to report an undefined symbol `foo'.
  841.      Although this behavior differs from most other systems, it is not a
  842.      bug because redefining an `extern' variable as `static' is
  843.      undefined in ANSI C.
  844.  
  845.    * AIX on the RS/6000 provides support (NLS) for environments outside
  846.      of the United States.  Compilers and assemblers use NLS to support
  847.      locale-specific representations of various objects including
  848.      floating-point numbers ("." vs "," for separating decimal
  849.      fractions).  There have been problems reported where the library
  850.      linked with GCC does not produce the same floating-point formats
  851.      that the assembler accepts.  If you have this problem, set the
  852.      LANG environment variable to "C" or "En_US".
  853.  
  854.    * Even if you specify `-fdollars-in-identifiers', you cannot
  855.      successfully use `$' in identifiers on the RS/6000 due to a
  856.      restriction in the IBM assembler.  GAS supports these identifiers.
  857.  
  858.    * On the RS/6000, XLC version 1.3.0.0 will miscompile `jump.c'.  XLC
  859.      version 1.3.0.1 or later fixes this problem.  You can obtain
  860.      XLC-1.3.0.2 by requesting PTF 421749 from IBM.
  861.  
  862.    * There is an assembler bug in versions of DG/UX prior to 5.4.2.01
  863.      that occurs when the `fldcr' instruction is used.  GNU CC uses
  864.      `fldcr' on the 88100 to serialize volatile memory references.  Use
  865.      the option `-mno-serialize-volatile' if your version of the
  866.      assembler has this bug.
  867.  
  868.    * On VMS, GAS versions 1.38.1 and earlier may cause spurious warning
  869.      messages from the linker.  These warning messages complain of
  870.      mismatched psect attributes.  You can ignore them.  *Note VMS
  871.      Install::.
  872.  
  873.    * On NewsOS version 3, if you include both of the files `stddef.h'
  874.      and `sys/types.h', you get an error because there are two typedefs
  875.      of `size_t'.  You should change `sys/types.h' by adding these
  876.      lines around the definition of `size_t':
  877.  
  878.           #ifndef _SIZE_T
  879.           #define _SIZE_T
  880.           ACTUAL TYPEDEF HERE
  881.           #endif
  882.  
  883.    * On the Alliant, the system's own convention for returning
  884.      structures and unions is unusual, and is not compatible with GNU
  885.      CC no matter what options are used.
  886.  
  887.    * On the IBM RT PC, the MetaWare HighC compiler (hc) uses a different
  888.      convention for structure and union returning.  Use the option
  889.      `-mhc-struct-return' to tell GNU CC to use a convention compatible
  890.      with it.
  891.  
  892.    * On Ultrix, the Fortran compiler expects registers 2 through 5 to
  893.      be saved by function calls.  However, the C compiler uses
  894.      conventions compatible with BSD Unix: registers 2 through 5 may be
  895.      clobbered by function calls.
  896.  
  897.      GNU CC uses the same convention as the Ultrix C compiler.  You can
  898.      use these options to produce code compatible with the Fortran
  899.      compiler:
  900.  
  901.           -fcall-saved-r2 -fcall-saved-r3 -fcall-saved-r4 -fcall-saved-r5
  902.  
  903.    * On the WE32k, you may find that programs compiled with GNU CC do
  904.      not work with the standard shared C ilbrary.  You may need to link
  905.      with the ordinary C compiler.  If you do so, you must specify the
  906.      following options:
  907.  
  908.           -L/usr/local/lib/gcc-lib/we32k-att-sysv/2.6.0 -lgcc -lc_s
  909.  
  910.      The first specifies where to find the library `libgcc.a' specified
  911.      with the `-lgcc' option.
  912.  
  913.      GNU CC does linking by invoking `ld', just as `cc' does, and there
  914.      is no reason why it *should* matter which compilation program you
  915.      use to invoke `ld'.  If someone tracks this problem down, it can
  916.      probably be fixed easily.
  917.  
  918.    * On the Alpha, you may get assembler errors about invalid syntax as
  919.      a result of floating point constants.  This is due to a bug in the
  920.      C library functions `ecvt', `fcvt' and `gcvt'.  Given valid
  921.      floating point numbers, they sometimes print `NaN'.
  922.  
  923.    * On Irix 4.0.5F (and perhaps in some other versions), an assembler
  924.      bug sometimes reorders instructions incorrectly when optimization
  925.      is turned on.  If you think this may be happening to you, try
  926.      using the GNU assembler; GAS version 2.1 supports ECOFF on Irix.
  927.  
  928.      Or use the `-noasmopt' option when you compile GNU CC with itself,
  929.      and then again when you compile your program.  (This is a temporary
  930.      kludge to turn off assembler optimization on Irix.)  If this
  931.      proves to be what you need, edit the assembler spec in the file
  932.      `specs' so that it unconditionally passes `-O0' to the assembler,
  933.      and never passes `-O2' or `-O3'.
  934.  
  935. 
  936. File: gcc.info,  Node: External Bugs,  Next: Incompatibilities,  Prev: Interoperation,  Up: Trouble
  937.  
  938. Problems Compiling Certain Programs
  939. ===================================
  940.  
  941.    * Parse errors may occur compiling X11 on a Decstation running
  942.      Ultrix 4.2 because of problems in DEC's versions of the X11 header
  943.      files `X11/Xlib.h' and `X11/Xutil.h'.  People recommend adding
  944.      `-I/usr/include/mit' to use the MIT versions of the header files,
  945.      using the `-traditional' switch to turn off ANSI C, or fixing the
  946.      header files by adding this:
  947.  
  948.           #ifdef __STDC__
  949.           #define NeedFunctionPrototypes 0
  950.           #endif
  951.  
  952.    * If you have trouble compiling Perl on a SunOS 4 system, it may be
  953.      because Perl specifies `-I/usr/ucbinclude'.  This accesses the
  954.      unfixed header files.  Perl specifies the options
  955.  
  956.           -traditional -Dvolatile=__volatile__
  957.           -I/usr/include/sun -I/usr/ucbinclude
  958.           -fpcc-struct-return
  959.  
  960.      most of which are unnecessary with GCC 2.4.5 and newer versions.
  961.      You can make a properly working Perl by setting `ccflags' to
  962.      `-fwritable-strings' (implied by the `-traditional' in the
  963.      original options) and `cppflags' to empty in `config.sh', then
  964.      typing `./doSH; make depend; make'.
  965.  
  966.    * On various 386 Unix systems derived from System V, including SCO,
  967.      ISC, and ESIX, you may get error messages about running out of
  968.      virtual memory while compiling certain programs.
  969.  
  970.      You can prevent this problem by linking GNU CC with the GNU malloc
  971.      (which thus replaces the malloc that comes with the system).  GNU
  972.      malloc is available as a separate package, and also in the file
  973.      `src/gmalloc.c' in the GNU Emacs 19 distribution.
  974.  
  975.      If you have installed GNU malloc as a separate library package,
  976.      use this option when you relink GNU CC:
  977.  
  978.           MALLOC=/usr/local/lib/libgmalloc.a
  979.  
  980.      Alternatively, if you have compiled `gmalloc.c' from Emacs 19, copy
  981.      the object file to `gmalloc.o' and use this option when you relink
  982.      GNU CC:
  983.  
  984.           MALLOC=gmalloc.o
  985.  
  986.