home *** CD-ROM | disk | FTP | other *** search
/ IRIS Development Option 6.2 / IRIS_Development_Option_6.2_814-0478-001.iso / relnotes / c_dev / ch4.z / ch4
Text File  |  1996-03-14  |  19KB  |  594 lines

  1.  
  2.  
  3.  
  4.                                                - 1 -
  5.  
  6.  
  7.  
  8.                     6.2 ANSI C Release Notes
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.                                                - 2 -
  69.  
  70.  
  71.  
  72.                     DDDDooooccccuuuummmmeeeennnntttt NNNNuuuummmmbbbbeeeerrrr 000000007777----1111666655559999----000011110000
  73.  
  74.  
  75.                     4.  _K_n_o_w_n__P_r_o_b_l_e_m_s__a_n_d__W_o_r_k_a_r_o_u_n_d_s
  76.  
  77.                     Unless otherwise indicated, the following bugs
  78.                     in release 6.2 of the C compiler apply to both
  79.                     traditional C and ANSI C.
  80.  
  81.                     4.1  _K_n_o_w_n__P_r_o_b_l_e_m_s__(_6_4_-_B_i_t__M_o_d_e_)
  82.  
  83.                     This section describes problems known to exist
  84.                     in the 6.2 C compiler running in 64-bit mode.
  85.  
  86.  
  87.                     4.1.1  _P_r_e_p_r_o_c_e_s_s_o_r
  88.  
  89.                        +o A warning is issued about macro
  90.                          redefinitions, even when the new definition
  91.                          is lexically identical to the existing
  92.                          (previous) definition.
  93.  
  94.  
  95.                     4.1.2  _C_o_m_p_i_l_e_r
  96.  
  97.                        +o For inlined functions, we generate code and
  98.                          debugging information, even though the
  99.                          function may be static and inlined at every
  100.                          call site.
  101.  
  102.                        +o We cannot completely turn off the warning:
  103.  
  104.                               "209116.c", line 4971: warning(1556): transfer of control bypasses
  105.                                  initialization of:
  106.                                  variable "count" (declared at line 5067)
  107.                                                        goto try_autogrow;
  108.  
  109.                          with the -_w_o_f_f _1_5_5_6 option, since the
  110.                          message fragment:
  111.  
  112.                               variable "count" (declared at line 5067)
  113.  
  114.                          still will be output.
  115.  
  116.                     4.2  _K_n_o_w_n__P_r_o_b_l_e_m_s__(_3_2_-_B_i_t__M_o_d_e_)
  117.  
  118.                     This section describes problems known to exist
  119.                     in the 6.2 C compiler running in 32-bit mode.
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.                                                - 3 -
  135.  
  136.  
  137.  
  138.                     4.2.1  _P_r_e_p_r_o_c_e_s_s_o_r
  139.  
  140.                        +o The following is permitted by the _c_f_e
  141.                          preprocessor:
  142.  
  143.                               #undef __STDC__
  144.  
  145.                          However, it should be illegal.
  146.  
  147.                        +o The source location for ``f()'' in:
  148.  
  149.                               #  /* some rather
  150.                                        lengthy
  151.                                        and multi-line
  152.                                        comment */
  153.                                  void f(void) {...}
  154.  
  155.                          will be wrongly perceived by _c_f_e to begin
  156.                          at the line where the comment starts, since
  157.                          the "#" is assumed to be a line-directive
  158.                          while the whole comment is viewed as a
  159.                          single space within the line-directive.
  160.                          This will cause _d_b_x to list the wrong
  161.                          source lines for statements in the body of
  162.                          ``f()''.
  163.  
  164.                        +o The -_w_l_i_n_t option causes an incorrect
  165.                          ``implicit type conversion'' warning when
  166.                          an enumerator is assigned to an enumeration
  167.                          variable, and may also cause incorrect
  168.                          ``used before set'' warnings for variables
  169.                          in the controlling expressions of loops:
  170.  
  171.                               void
  172.                               foo(int *head)
  173.                               {
  174.                                  enum E {e1, e2, e3} c;
  175.                                  int *p, *nextp;
  176.                                  int i;
  177.  
  178.                                  /* incorrect warning: "implicit conversion from int to enum" */
  179.                                  c = e1;
  180.  
  181.                                  /* incorrect warning: "i may be used before set" */
  182.                                  do {i = *(p++);} while (!i);
  183.  
  184.                                  /* incorrect warning: "nextp may be used before set" */
  185.                                  for (p = head; p; p = nextp) nextp = p;
  186.                               }
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.                                                - 4 -
  201.  
  202.  
  203.  
  204.                        +o There is a problem with constant
  205.                          propagation in the context of weakextern
  206.                          definitions.  For the source:
  207.  
  208.                               #include <stdio.h>
  209.                               extern int a;
  210.                               #pragma weak a=b
  211.                               int b = 3;
  212.                               main()
  213.                               {
  214.                                  a = 5;
  215.                                  printf("%d, %d", a, b);
  216.                               }
  217.  
  218.                          the output when compiled without any
  219.                          optimization (-_O_0) ``5, 5'', as expected,
  220.                          while with optimization the output is  ``5,
  221.                          3''.  The latter is a result of constant
  222.                          propagation, which reduces the body of
  223.                          ``main()'' to:
  224.  
  225.                               printf("%d, %d", 5, b);
  226.  
  227.                          thus effectively eliminating the assignment
  228.                          to ``a'' and its alias ``b''.
  229.  
  230.  
  231.                     4.2.2  _C_o_m_p_i_l_e_r
  232.  
  233.                        +o Signed and unsigned ``long long''
  234.                          bitfields, spanning across a 32-bit (word)
  235.                          aligned boundary, can only be accessed
  236.                          through the ``.'' operator when the left-
  237.                          hand side is an addressable lvalue.  This
  238.                          is a limitation of our compiler front-end
  239.                          (_c_f_e) implementation and _c_f_e will emit
  240.                          error messages when this constraint is
  241.                          violated.  In earlier versions of the
  242.                          compiler, _c_f_e terminated with an assertion
  243.                          for such expressions.
  244.  
  245.                        +o An indexing expression with a complicated
  246.                          index expression may sometime generate
  247.                          illegal ucode, which causes _u_g_e_n to core
  248.                          dump.  A workaround is to move the index
  249.                          expression out and assign it to a temporary
  250.                          variable, or just change the expression.
  251.                          The following illustrates the only known
  252.                          case of this happening:
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.                                                - 5 -
  267.  
  268.  
  269.  
  270.                               char board[19];
  271.                               int capture[2];
  272.                               setboard (int x)
  273.                               {
  274.                                  capture[!(board[x])]++;    /* Ugen coredumps on this! */
  275.                                  capture[(board[x])?0:1]++; /* This works just fine! */
  276.                               }
  277.  
  278.                        +o A standalone _l_i_n_t is available, but it does
  279.                          not support the same options and
  280.                          compilation modes supported by the C
  281.                          compiler (it supports the the AT&T SVR4
  282.                          compilation modes, and treats ``long long''
  283.                          types as ``long'').  Unless _l_i_n_t is used to
  284.                          handle _l_i_n_t-directives, to provide _l_i_n_t_2
  285.                          diagnostics, or to produce the _l_i_n_t output
  286.                          files, we instead strongly recommend use of
  287.                          the -_w_l_i_n_t option with the _c_c command.
  288.                          This option works with all the other
  289.                          compiler options and flags, including
  290.                          compilation in ANSI mode.  Note that -_w_l_i_n_t
  291.                          does not produce the traditional output
  292.                          files from the _l_i_n_t passes, nor does it
  293.                          handle _l_i_n_t directives, while it does
  294.                          provide _l_i_n_t-like diagnostics.
  295.  
  296.  
  297.                     4.3  _K_n_o_w_n _P_r_o_b_l_e_m_s _w_i_t_h _W_o_r_k_a_r_o_u_n_d_s (_6_4-_B_i_t
  298.                          _M_o_d_e)
  299.  
  300.                        +o The 64-bit and N32 Optimizer produces code
  301.                          (at optimization level -_O_2 ) that can
  302.                          suffer from poor performance under the
  303.                          following conditions:
  304.  
  305.                             +o The program has NOT been marked
  306.                               QUICKSTART by ld, (You can verify
  307.                               whether a program has been marked
  308.                               QUICKSTART by running the %elfdump
  309.                               -info command.)  OR the program has
  310.                               been marked QUICKSTART by ld, but has
  311.                               not been requickstarted (see _r_q_s(1)
  312.                               for more info).
  313.  
  314.                             +o The program contains loops where
  315.                               functions are called and executed for
  316.                               the first time.
  317.  
  318.                          Under these circumstances, the optimizer
  319.                          produces code that moves the instruction
  320.                          that loads the address of the function out
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.                                                - 6 -
  333.  
  334.  
  335.  
  336.                          of the loop and replaces it with a load of
  337.                          the temporary register that contains that
  338.                          address.  As a result, if that address has
  339.                          not been resolved by rld (either by that
  340.                          function being called previously, or by the
  341.                          program being QUICKSTARTED), the code will
  342.                          repeatedly call the stub that rld uses for
  343.                          lazy text resolution.  The program will
  344.                          execute properly, but with a large
  345.                          performance degradation.
  346.  
  347.                          You can verify that this is happening by
  348.                          doing the following:
  349.  
  350.                               For N32 programs:
  351.                               %setenv _RLDN32_PATH /usr/lib32/rld.debug
  352.                               %setenv _RLD_ARGS "-trace"
  353.  
  354.                               For N64 programs:
  355.                               %setenv _RLD64_PATH /usr/lib64/rld.debug
  356.                               %setenv _RLD_ARGS "-trace"
  357.  
  358.                          Running the program then generates a trace
  359.                          log which can be searched for "lazy text
  360.                          of". If you see the same symbol being
  361.                          resolved, you have this problem.
  362.  
  363.                          For programs that have been marked
  364.                          QUICKSTART, you can execute the following
  365.                          workaround before running the executable:
  366.  
  367.                               %setenv LD_BIND_NOW 1
  368.  
  369.                          (Bug #355959)
  370.  
  371.                        +o Benchmarks using computational kernels that
  372.                          operate on arrays with dimensions of a
  373.                          modulus of the cache size can cause cache
  374.                          line thrashing. This condition will usually
  375.                          manifest in a program taking much longer to
  376.                          compile than expected, and can be analyzed
  377.                          further by monitoring system performance
  378.                          statistics such as I/O use during
  379.                          compilation.  The remedy is to increase the
  380.                          size of the array by a multiple of the
  381.                          cache line size.  Because cache line size
  382.                          is fixed for each specific architecture,
  383.                          check your hardware documentation to see
  384.                          what applies for your system.  (126115)
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.                                                - 7 -
  399.  
  400.  
  401.  
  402.                        +o The following will produce an error message
  403.                          in -cckr mode:
  404.  
  405.                               struct X {int i;} *j, *k;
  406.                               main()
  407.                               {
  408.                                  j = k?k:k?0:0;
  409.                               }
  410.  
  411.                          since k?0:0 is an int expression, and as
  412.                          such is incompatible with k which is a
  413.                          pointer. (224372)
  414.  
  415.  
  416.                     4.4  _K_n_o_w_n _P_r_o_b_l_e_m_s _w_i_t_h _W_o_r_k_a_r_o_u_n_d_s (_3_2-_B_i_t
  417.                          _M_o_d_e)
  418.  
  419.                        +o In 3.17 and earlier versions of the
  420.                          compiler, no diagnostics were emitted (by
  421.                          default) in -_c_c_k_r mode for a function
  422.                          redeclaration with incompatible parameter
  423.                          types.  This could be highly error-prone,
  424.                          since an argument could be passed to the
  425.                          same function in differing ways, dependent
  426.                          on which declaration were in scope at the
  427.                          point of call.  Consider the following
  428.                          code:
  429.  
  430.                               #include <stdio.h>
  431.                               int f(float f1, float f2);
  432.                               f(f1, f2)
  433.                                  float f1, f2;
  434.                               {
  435.                                  printf("f1=%g, f2=%g0, f1, f2);
  436.                               }
  437.                               main()
  438.                               {
  439.                                  f(17.17, 17.17);
  440.                               }
  441.  
  442.                          The unprototyped function definition
  443.                          expects float arguments to be promoted to
  444.                          doubles (64 bits entities), while the call
  445.                          in fact heeds the prototype and passes the
  446.                          arguments as floats (32 bits entities).
  447.                          The values printed will be unpredictable.
  448.                          To avoid this kind of unexpected behavior
  449.                          we highly recommend that users compile
  450.                          their code with -_p_r_o_t_o_t_y_p_e_s in -_c_c_k_r mode.
  451.                          For redeclarations, where references to
  452.                          parameters in the function body may access
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.                                                - 8 -
  465.  
  466.  
  467.  
  468.                          a different bit pattern than that passed on
  469.                          the caller site (as in the above example),
  470.                          we now issue an error in -_c_c_k_r mode.  Other
  471.                          forms of incompatible redeclarations still
  472.                          pass without any diagnostics.  The old
  473.                          (ccom) compiler sometimes successfully
  474.                          combined such incompatible redeclarations,
  475.                          but not always.  We therefore found it
  476.                          sounder to disallow the most blatant forms
  477.                          of mismatches in this version of the
  478.                          compiler.
  479.  
  480.                        +o Note that _l_i_n_t incorrectly diagnoses a
  481.                          syntax error for the latter of the
  482.                          following two declarations for
  483.                          ``XSynchronize'':
  484.  
  485.                               typedef int Display;
  486.                               extern int (*XSynchronize(int*))();
  487.                               extern int (*XSynchronize(Display*))();
  488.  
  489.                          The first form of declaration (without the
  490.                          typedef) can be used as a workaround for
  491.                          this particular problem.
  492.  
  493.                        +o The compiler will incorrectly diagnose the
  494.                          last of the initializers in the following
  495.                          code fragment as an incorrect initializing
  496.                          expression:
  497.  
  498.                               typedef unsigned int size_t;
  499.                               typedef struct uacdef
  500.                               {
  501.                                 unsigned int  *uacind;
  502.                                 unsigned int  *uacaln;
  503.                                 unsigned int  *uacrcp;
  504.                                 unsigned int  *uaccal;
  505.                               } uacdef;
  506.  
  507.                               size_t uacsiz[] = {
  508.                                  (size_t)&(((uacdef*)0))->uacrcp,
  509.                                  (1&0x40 ? sizeof(uacdef) : (unsigned int)&(((uacdef*)0))->uacrcp),
  510.                                  (1&0x40 ? sizeof(uacdef) : (size_t)&(((uacdef*)0))->uacrcp)
  511.                               };
  512.  
  513.                          The first two forms of initializers may be
  514.                          used as a workaround for this problem.
  515.  
  516.                        +o Benchmarks using computational kernels that
  517.                          operate on arrays with dimensions of a
  518.                          modulus of the cache size can cause cache
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.                                                - 9 -
  531.  
  532.  
  533.  
  534.                          line thrashing. This condition will usually
  535.                          manifest in a program taking much longer to
  536.                          compile than expected, and can be analyzed
  537.                          further by monitoring system performance
  538.                          statistics such as I/O use during
  539.                          compilation.  The remedy is to increase the
  540.                          size of the array by a multiple of the
  541.                          cache line size.  Because cache line size
  542.                          is fixed for each specific architecture,
  543.                          check your hardware documentation to see
  544.                          what applies for your system.  (126115)
  545.  
  546.  
  547.  
  548.  
  549.  
  550.  
  551.  
  552.  
  553.  
  554.  
  555.  
  556.  
  557.  
  558.  
  559.  
  560.  
  561.  
  562.  
  563.  
  564.  
  565.  
  566.  
  567.  
  568.  
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.