This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: What is acceptable for -ffast-math? (Was: associative law in combine)


> From: dewar@gnat.com
> To: dewar@gnat.com, jbuck@synopsys.COM
> Cc: gcc@gcc.gnu.org, moshier@moshier.ne.mediaone.net, mrs@windriver.com
> Date: Mon, 30 Jul 2001 21:38:24 -0400 (EDT)

> But it is interesting that many of the GNU extensions do not
> conflict with the standard (e.g. nested procedures, dynamic arrays),
> so these are not examples of GNU-C not meeting the criterion of
> being standard by default.

?

When there is wording that states that the value inside the [] shall
be a constant greater than 0 and non-negative, there is absolutely no
room for gcc to extend the sematics to include dynamicly sized arrays,
sorry.

  If the constant-expression (5.19) is present, it shall be an
  integral constant expression and its value shall be greater than
  zero.

From:

1 In a declaration  T  D where  D has the form

          D1 [constant-expressionopt]

  and the type of the identifier in the declaration  T  D1 is   derived-
  declarator-type-list    T, then the type of the identifier of  D is an
  array type.   T is called the array  element  type;  this  type  shall
  not  be  a  reference  type,  the  type    void, a function type or an
  abstract class type.  If the  constant-expression (5.19)  is  present,
  it  shall  be  an  integral constant expression and its value shall be
  greater than zero.  The constant expression specifies the    bound  of
  (number  of  elements  in)  the  array.   If the value of the constant
  expression is  N, the array has  N elements numbered  0 to   N-1,  and
  the type of the identifier of  D is derived-declarator-type-list array
  of  N  T.  An object of array type contains a  contiguously  allocated


  8.3.4  Arrays           DRAFT: 2 December 1996       Declarators  8-11

  non-empty  set  of    N  sub-objects  of  type    T.   If the constant
  expression is omitted, the type of the identifier of   D  is  derived-
  declarator-type-list  array  of  unknown  bound  of   T, an incomplete
  object type.  The type derived-declarator-type-list array of  N  T  is
  a  different  type from the type derived-declarator-type-list array of
  unknown bound of  T, see 3.9.  Any type of the  form  cv-qualifier-seq
  array  of    N   T is adjusted to array of  N cv-qualifier-seq  T, and
  similarly for array of unknown bound of  T.  [Example:

          typedef int A[5], AA[2][3];
          typedef const A CA;     // type is ``array of 5 const int''
          typedef const AA CAA;   // type is ``array of 2 array of 3 const int'\
'

   -end example] [Note: an array of   N  cv-qualifier-seq    T  has  cv-
  qualified  type;  such an array has internal linkage unless explicitly
  declared  extern (7.1.5.1) and must be  initialized  as  specified  in
  8.5.  ]

I don't have any clue how you were so misled on this.  Similar I
suspect for nested procedures.  When the standard says that violation
of a mandate of the standard must result in a diagnostic:

2 Every conforming C++ implementation shall, within its resource limits,
  accept and correctly execute well-formed C++ programs, and shall issue
  at least one diagnostic message when  presented  with  any  ill-formed
  program  that contains a violation of any diagnosable semantic rule or
  of any syntax rule.

this _does_ result in failure to comply with the standard and gcc does
fail to meet a criterion of the standard, as you put it.  These are
reasonably safe extensions, as no conforming program can use the
standard to complain about the semantics then, but that is all.

#include <alloca.h> is an example of an allowed extension.  It isn't
defined in the standard, and the standard doesn't mandate a
diagnostic.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]