This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix optimization regression in constant folder
> 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
macros TYPE_OVERFLOW_WRAPS, TYPE_OVERFLOW_UNDEFINED, TYPE_OVERFLOW_TRAPS.
Then I think that we should have
TYPE_IS_SIZETYPE => TYPE_OVERFLOW_WRAPS
TYPE_IS_SIZETYPE => TYPE_OVERFLOW_UNDEFINED
TYPE_IS_SIZETYPE => !TYPE_OVERFLOW_TRAPS
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