https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85450
--- Comment #8 from rguenther at suse dot de <rguenther at suse dot de> --- On Thu, 26 Apr 2018, clyon at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85450 > > --- Comment #7 from Christophe Lyon <clyon at gcc dot gnu.org> --- > Created attachment 44023 > --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44023&action=edit > Newlib's sysopen.i > > I could reproduce the problem with aarch64-none-elf too, and this requires > -mabi=ilp32. > > Compiling the attached file with -c ./sysopen.i -mabi=ilp32: > > In file included from > /home/christophe.lyon/src/GCC/sources/newlib/newlib/libc/include/sys/fcntl.h:3, > from > /home/christophe.lyon/src/GCC/sources/newlib/newlib/libc/include/fcntl.h:1, > from > /home/christophe.lyon/src/GCC/sources/newlib/newlib/libc/syscalls/sysopen.c:4: > /home/christophe.lyon/src/GCC/sources/newlib/newlib/libc/include/sys/_default_fcntl.h: > In function 'open': > /home/christophe.lyon/src/GCC/sources/newlib/newlib/libc/include/sys/_default_fcntl.h:182:12: > error: invalid types in nop conversion > extern int open _PARAMS ((const char *, int, ...)); > ^~~~ > long long int > void * > _19 = (long long int) _18; > /home/christophe.lyon/src/GCC/sources/newlib/newlib/libc/include/sys/_default_fcntl.h:182:12: > error: invalid types in nop conversion > long long int > void * > _28 = (long long int) _18; > during GIMPLE pass: lower_vaarg > /home/christophe.lyon/src/GCC/sources/newlib/newlib/libc/include/sys/_default_fcntl.h:182:12: > internal compiler error: verify_gimple failed > 0xc4cd2b verify_gimple_in_cfg(function*, bool) > > /home/christophe.lyon/src/GCC/sources/gcc-fsf/trunk/gcc/tree-cfg.c:5585 > 0xb03a27 execute_function_todo > /home/christophe.lyon/src/GCC/sources/gcc-fsf/trunk/gcc/passes.c:1994 > 0xb04399 execute_todo > /home/christophe.lyon/src/GCC/sources/gcc-fsf/trunk/gcc/passes.c:2048 Caused by aarch64_gimplify_va_arg_expr: /* Advance ap.__stack */ t = fold_convert (intDI_type_node, arg); t = build2 (PLUS_EXPR, TREE_TYPE (t), t, build_int_cst (TREE_TYPE (t), size + 7)); t = build2 (BIT_AND_EXPR, TREE_TYPE (t), t, build_int_cst (TREE_TYPE (t), -8)); t = fold_convert (TREE_TYPE (arg), t); I'm not sure why, for ILP32, this code converts to intDI_type_node. Probably missing ILP32 adjustments. I suggest to simplify the code with Index: gcc/config/aarch64/aarch64.c =================================================================== --- gcc/config/aarch64/aarch64.c (revision 259669) +++ gcc/config/aarch64/aarch64.c (working copy) @@ -12278,12 +12278,9 @@ aarch64_gimplify_va_arg_expr (tree valis else roundup = NULL; /* Advance ap.__stack */ - t = fold_convert (intDI_type_node, arg); - t = build2 (PLUS_EXPR, TREE_TYPE (t), t, - build_int_cst (TREE_TYPE (t), size + 7)); + t = fold_build_pointer_plus_hwi (arg, size + 7); t = build2 (BIT_AND_EXPR, TREE_TYPE (t), t, build_int_cst (TREE_TYPE (t), -8)); - t = fold_convert (TREE_TYPE (arg), t); t = build2 (MODIFY_EXPR, TREE_TYPE (stack), unshare_expr (stack), t); /* String up roundup and advance. */ if (roundup) which fixes the issue for me.