[patch] avoid calling convert from convert_and_check

Rafael Espíndola rafael.espindola@gmail.com
Thu Apr 6 17:40:00 GMT 2006


:ADDPATCH front end:

The attached patch adds the converted exp as a new argument to
convert_and_check  and calls fold_convert instead of convert in
constant_fits_type_p.

The patch also adds a special treatment for REAL_CSTs in
constant_fits_type_p. This is necessary because fold_convert doesn't
handle real to integer conversions.

If desired, I can split this patch in 3. Special treatment for
REAL_CST, use fold_convert, and additional parameter to
convert_and_check.

Bootstraped and regtested on a x86.

Special thanks for Roger Sayle for proposing the additional argument
and for pointing out that the real to integer conversion is
intentionally undefined in fold_convert.

Rafael

2006-02-20  Rafael Ávila de Espíndola  <rafael.espindola@gmail.com>

          * gcc/cp/typeck.c (build_ptrmemfunc1): Add the converted exp
as the third argument of convert_and check.
          * gcc/cp/call.c (convert_like_real): Add the converted exp
as the third argument of convert_and check.
          * gcc/c-typeck.c (build_conditional_expr): Add the converted
exp as the third argument of convert_and check.
          * gcc/c-common.c (convert_and_check): Don't call convert.
Add the converted exp as the third argument of convert_and check.
          (c_add_case_label):  Add the converted exp as the third
argument of convert_and check.
          * gcc/c-common.h (convert_and_check): Change the signature
to match c-common.c


More information about the Gcc-patches mailing list