[4.5 C] Fix types in fold_builtin_sincos

Richard Guenther richard.guenther@gmail.com
Sat Jan 17 09:48:00 GMT 2009


On Sat, Jan 17, 2009 at 12:55 AM, Joseph S. Myers
<joseph@codesourcery.com> wrote:
> After my latest merge to c-4_5-branch from trunk some ICEs appeared
> arising from fold_builtin_sincos building MODIFY_EXPRs in void_type_node
> and then trying to use a COMPOUND_EXPR to convert to a non-void type.  (I
> don't know why this didn't cause ICEs before; I don't think such trees,
> where COMPOUND_EXPR involves a nontrivial conversion, are valid.)

That's weird.  a MODIFY_EXPR doesn't have a type, so using void_type_node
is exactly correct.  What is using the type of the MODIFY_EXPR?  It's better
to fix that instead - if you grep for MODIFY_EXPR and void_type_node there
are a lot more offenders otherwise.

Richard.

> I'm testing this patch to fix the problems (with a full bootstrap and
> testsuite run; it passed the specific tests in question).  OK for 4.5 if
> it passes?
>
> Index: builtins.c
> ===================================================================
> --- builtins.c  (revision 143450)
> +++ builtins.c  (working copy)
> @@ -7931,10 +7931,10 @@
>   call = builtin_save_expr (call);
>
>   return build2 (COMPOUND_EXPR, type,
> -                build2 (MODIFY_EXPR, void_type_node,
> +                build2 (MODIFY_EXPR, type,
>                         build_fold_indirect_ref (arg1),
>                         build1 (IMAGPART_EXPR, type, call)),
> -                build2 (MODIFY_EXPR, void_type_node,
> +                build2 (MODIFY_EXPR, type,
>                         build_fold_indirect_ref (arg2),
>                         build1 (REALPART_EXPR, type, call)));
>  }
> Index: ChangeLog.c45
> ===================================================================
> --- ChangeLog.c45       (revision 143404)
> +++ ChangeLog.c45       (working copy)
> @@ -1,3 +1,8 @@
> +2009-01-16  Joseph Myers  <joseph@codesourcery.com>
> +
> +       * builtins.c (fold_builtin_sincos): Build MODIFY_EXPRs in TYPE,
> +       not void_type_node.
> +
>  2008-12-10  Joseph Myers  <joseph@codesourcery.com>
>
>        * c-typeck.c (c_fully_fold, c_fully_fold_internal,
>
> --
> Joseph S. Myers
> joseph@codesourcery.com
>



More information about the Gcc-patches mailing list