This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

Re: [PATCH] Fix optimization regression in constant folder


On 9/30/07, Eric Botcazou <ebotcazou@adacore.com> wrote:
> > Yes.
>
> Do you happen to have some references at hand?  I'd be interested in trying to
> understand the plan.  Note that we have to be able to reorder/simplify size
> calculations in Ada, and Roger helped us to do it better in max_size.

No.

I tried to bootstrap & test the attached, but it fails in libjava:

../../../../../../trunk/libjava/classpath/gnu/java/awt/font/opentype/truetype/TrueTypeScaler.java:0:
internal compiler error: in fold_overflow_warning, at
fold-const.c:1018
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

if we really want to specialize sizetypes, then this would be the way to go
(after making it work, of course).

Richard.
Index: flags.h
===================================================================
--- flags.h	(revision 128885)
+++ flags.h	(working copy)
@@ -314,7 +314,7 @@ extern bool flag_instrument_functions_ex
 /* True if overflow wraps around for the given integral type.  That
    is, TYPE_MAX + 1 == TYPE_MIN.  */
 #define TYPE_OVERFLOW_WRAPS(TYPE) \
-  (TYPE_UNSIGNED (TYPE) || flag_wrapv)
+  ((TYPE_UNSIGNED (TYPE) || flag_wrapv) && (TREE_CODE (TYPE) != INTEGER_TYPE || !TYPE_IS_SIZETYPE (TYPE)))
 
 /* True if overflow is undefined for the given integral type.  We may
    optimize on the assumption that values in the type never overflow.
@@ -325,12 +325,12 @@ extern bool flag_instrument_functions_ex
    other cases it will be appropriate to simply set a flag and let the
    caller decide whether a warning is appropriate or not.  */
 #define TYPE_OVERFLOW_UNDEFINED(TYPE) \
-  (!TYPE_UNSIGNED (TYPE) && !flag_wrapv && !flag_trapv && flag_strict_overflow)
+  ((!TYPE_UNSIGNED (TYPE) && !flag_wrapv && !flag_trapv && flag_strict_overflow) || (TREE_CODE (TYPE) == INTEGER_TYPE && TYPE_IS_SIZETYPE (TYPE)))
 
 /* True if overflow for the given integral type should issue a
    trap.  */
 #define TYPE_OVERFLOW_TRAPS(TYPE) \
-  (!TYPE_UNSIGNED (TYPE) && flag_trapv)
+	 ((!TYPE_UNSIGNED (TYPE) && flag_trapv) && (TREE_CODE (TYPE) != INTEGER_TYPE || !TYPE_IS_SIZETYPE (TYPE)))
 
 /* Names for the different levels of -Wstrict-overflow=N.  The numeric
    values here correspond to N.  */

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