[PATCH] Fix optimization regression in constant folder

Eric Botcazou ebotcazou@adacore.com
Sun Sep 30 16:36:00 GMT 2007

> I tried to bootstrap & test the attached, but it fails in libjava:
> ../../../../../../trunk/libjava/classpath/gnu/java/awt/font/opentype/truety
>pe/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.

The assertion checks that there is no undefined overflow in Java and your 
patch arranges for TYPE_IS_SIZETYPE => TYPE_OVERFLOW_UNDEFINED, so that's not 
very surprising.  The assertion would need to be weakened too.

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

Yes, I think that we need to keep them specialized.  However, your patch is 
not sufficient because TYPE_IS_SIZETYPE => !TYPE_OVERFLOW_WRAPS with it so 
the pessimization in fold_binary won't be undone for example.

It sounds like you really want to have TYPE_IS_SIZETYPE subsumed into the 3 

Then I think that we should have


Note that, in all languages except Ada, size types are unsigned so the first 
assertion is almost already true.  A first step would be to make it true in 
Ada too, which would fix the performance regression in fold_binary.

Eric Botcazou

More information about the Gcc-patches mailing list