This is the mail archive of the
mailing list for the GCC project.
Re: List of simplifications we should perform
- To: Tom Tromey <tromey at redhat dot com>
- Subject: Re: List of simplifications we should perform
- From: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>
- Date: Sat, 12 May 2001 01:03:39 +0100 (BST)
- cc: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>, <dan at www dot cgsoftware dot com>, <gcc at gcc dot gnu dot org>
On 11 May 2001, Tom Tromey wrote:
> Java has fairly strict rules about what can, cannot, and must be
> folded. Right now fold() violates some of these rules. We'll
> probably have to write our own fold() for Java, which is a shame.
ISO C has fairly strict rules about what an "integer constant expression"
is. GCC does not currently implement them properly. Some constant
folding is effectively required by the standard, but other constant
folding is an optimization only and should not construct integer constant
expressions. To complicate matters, correctly implementing these rules
will require __extension__ to make integer constant expressions out of
what wouldn't otherwise be integer constant expressions, since offsetof
needs to be one. Also, the additional forms of constant expressions
accepted in initializers (which is where ISO C allows an implementation to
accept additional forms, as long as they don't violate the constraints) -
such as constant differences between addresses in the same object - need
to be documented and to continue to be accepted.
Joseph S. Myers