home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / gnu / gcc-2.5.8-bin.lha / info / gcc.info-8 (.txt) < prev    next >
GNU Info File  |  1994-02-21  |  51KB  |  897 lines

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