I'm trying to help DJ with converting m32c to define_constraint, and I'm running into an unrelated problem. Specifically, the unmodified compiler targeting m32c-elf, in -mcpu=m32cm mode, crashes on any use of __builtin_va_start, even this:
int foo(int x, ...) { __builtin_va_list t; __builtin_va_start (t, x); }
test.c:4: internal compiler error: in expand_expr_real_1, at expr.c:7109
The problem appears to be with std_expand_builtin_va_start, which does tree t; t = make_tree (sizetype, nextarg); t = fold_convert (ptr_type_node, t); t = build2 (MODIFY_EXPR, TREE_TYPE (valist), valist, t); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); When -mcpu=m32cm, sizetype is HImode (16 bits) but ptr_type_node is PSImode (24 bits). The VAR_DECL constructed by the first three lines of std_expand_builtin_va_start has a DECL_RTL in PSImode, but a TREE_TYPE in HImode. This is not acceptable to expand_expr_real_1. Naively speaking, I do not see why the function could not be written tree t = build2 (MODIFY_EXPR, TREE_TYPE (valist), valist), make_tree (ptr_type_node, nextarg); expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); or even rtx va_r = expand_normal (valist); emit_move_insn (va_r, nextarg); but this is a part of the compiler I am not at all familiar with... zw