[Bug middle-end/85450] ICE: invalid types in nop conversion during GIMPLE pass: ompexp
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85450 ktkachov at gcc dot gnu.org changed: What|Removed |Added CC||ktkachov at gcc dot gnu.org --- Comment #11 from ktkachov at gcc dot gnu.org --- The commit r259711 should have fixed the aarch64 ICEs
[Bug middle-end/85450] ICE: invalid types in nop conversion during GIMPLE pass: ompexp
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85450 --- Comment #10 from Andreas Schwab--- This also breaks building libgcc with -mabi=ilp32, and the patch in #c8 fixes that.
[Bug middle-end/85450] ICE: invalid types in nop conversion during GIMPLE pass: ompexp
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85450 --- Comment #9 from Christophe Lyon --- Created attachment 44024 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44024=edit vfprintf.i Your patch proposal fixes the ICE with sysopen.i, but I still have a crash with vfprintf.i (with -mabi=ilp32)
[Bug middle-end/85450] ICE: invalid types in nop conversion during GIMPLE pass: ompexp
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85450 --- Comment #8 from 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 --- > Created attachment 44023 > --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44023=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.
[Bug middle-end/85450] ICE: invalid types in nop conversion during GIMPLE pass: ompexp
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85450 --- Comment #7 from Christophe Lyon --- Created attachment 44023 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44023=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 My GCC is configured with: --target=aarch64-none-elf --disable-nls --without-headers --with-newlib --disable-shared --disable-threads --disable-libssp --disable-libgomp --disable-libmudflap --disable-libatomic --disable-libcilkrts --without-libquadmath --disable-libquadmath --enable-languages=c --with-newlib --disable-tls
[Bug middle-end/85450] ICE: invalid types in nop conversion during GIMPLE pass: ompexp
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85450 --- Comment #6 from 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 > > Christophe Lyon changed: > >What|Removed |Added > > CC||clyon at gcc dot gnu.org > > --- Comment #5 from Christophe Lyon --- > Hi Richard, > > This patch (r259667) makes the newlib build fail on aarch64_be-none-elf. > > I'm seeing this in my build log: > aarch64_be-none-elf-gcc > -B/tmp/7730760_9.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64_be-none-elf/newlib/aarch64_be-none-elf/ilp32/newlib/ > -isystem > /tmp/7730760_9.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64_be-none-elf/newlib/aarch64_be-none-elf/ilp32/newlib/targ-include > -isystem /tmp/7730760_9.tmpdir/aci-gcc-fsf/sources/newlib/newlib/libc/include > -B/tmp/7730760_9.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64_be-none-elf/newlib/aarch64_be-none-elf/ilp32/libgloss/aarch64 > -L/tmp/7730760_9.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64_be-none-elf/newlib/aarch64_be-none-elf/ilp32/libgloss/libnosys > -L/tmp/7730760_9.tmpdir/aci-gcc-fsf/sources/newlib/libgloss/aarch64 > -mabi=ilp32 -DPACKAGE_NAME=\"newlib\" -DPACKAGE_TARNAME=\"newlib\" > -DPACKAGE_VERSION=\"2.0.0\" -DPACKAGE_STRING=\"newlib\ 2.0.0\" > -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -I. > -I/tmp/7730760_9.tmpdir/aci-gcc-fsf/sources/newlib/newlib/libc/stdio > -fno-builtin -g -O2 -mabi=ilp32 -fshort-enums -DINTEGER_ONLY -c > /tmp/7730760_9.tmpdir/aci-gcc-fsf/sources/newlib/newlib/libc/stdio/vfprintf.c > -o lib_a-vfiprintf.o > In file included from > /tmp/7730760_9.tmpdir/aci-gcc-fsf/sources/newlib/newlib/libc/stdio/vfwscanf.c:109: > /tmp/7730760_9.tmpdir/aci-gcc-fsf/sources/newlib/newlib/libc/stdio/vfwscanf.c: > In function '__svfwscanf_r': > /tmp/7730760_9.tmpdir/aci-gcc-fsf/sources/newlib/newlib/libc/stdio/vfwscanf.c:140:25: > error: invalid types in nop conversion > # define __SVFWSCANF_R __svfwscanf_r > ^ > /tmp/7730760_9.tmpdir/aci-gcc-fsf/sources/newlib/newlib/libc/stdio/vfwscanf.c:371:8: > note: in expansion of macro '__SVFWSCANF_R' > _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap), > ^ > long long int > void * > _360 = (long long int) _368; > [...] > > > > > > and also: > 0xc40fa3 verify_gimple_in_cfg(function*, bool) > > /tmp/7730760_9.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/tree-cfg.c:5585 > 0xae70ec execute_function_todo > > /tmp/7730760_9.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/passes.c:1994 > 0xae6e85 execute_todo > > /tmp/7730760_9.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/passes.c:2048 > > I'd have to reproduce the problem manually in order to share a preprocessed > file. Can't investigate w/o that though. Please also say how to configure a cross to aarch64_be-none-elf (big-endian aarch64? please not...)
[Bug middle-end/85450] ICE: invalid types in nop conversion during GIMPLE pass: ompexp
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85450 Christophe Lyon changed: What|Removed |Added CC||clyon at gcc dot gnu.org --- Comment #5 from Christophe Lyon --- Hi Richard, This patch (r259667) makes the newlib build fail on aarch64_be-none-elf. I'm seeing this in my build log: aarch64_be-none-elf-gcc -B/tmp/7730760_9.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64_be-none-elf/newlib/aarch64_be-none-elf/ilp32/newlib/ -isystem /tmp/7730760_9.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64_be-none-elf/newlib/aarch64_be-none-elf/ilp32/newlib/targ-include -isystem /tmp/7730760_9.tmpdir/aci-gcc-fsf/sources/newlib/newlib/libc/include -B/tmp/7730760_9.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64_be-none-elf/newlib/aarch64_be-none-elf/ilp32/libgloss/aarch64 -L/tmp/7730760_9.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64_be-none-elf/newlib/aarch64_be-none-elf/ilp32/libgloss/libnosys -L/tmp/7730760_9.tmpdir/aci-gcc-fsf/sources/newlib/libgloss/aarch64 -mabi=ilp32 -DPACKAGE_NAME=\"newlib\" -DPACKAGE_TARNAME=\"newlib\" -DPACKAGE_VERSION=\"2.0.0\" -DPACKAGE_STRING=\"newlib\ 2.0.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -I. -I/tmp/7730760_9.tmpdir/aci-gcc-fsf/sources/newlib/newlib/libc/stdio -fno-builtin -g -O2 -mabi=ilp32 -fshort-enums -DINTEGER_ONLY -c /tmp/7730760_9.tmpdir/aci-gcc-fsf/sources/newlib/newlib/libc/stdio/vfprintf.c -o lib_a-vfiprintf.o In file included from /tmp/7730760_9.tmpdir/aci-gcc-fsf/sources/newlib/newlib/libc/stdio/vfwscanf.c:109: /tmp/7730760_9.tmpdir/aci-gcc-fsf/sources/newlib/newlib/libc/stdio/vfwscanf.c: In function '__svfwscanf_r': /tmp/7730760_9.tmpdir/aci-gcc-fsf/sources/newlib/newlib/libc/stdio/vfwscanf.c:140:25: error: invalid types in nop conversion # define __SVFWSCANF_R __svfwscanf_r ^ /tmp/7730760_9.tmpdir/aci-gcc-fsf/sources/newlib/newlib/libc/stdio/vfwscanf.c:371:8: note: in expansion of macro '__SVFWSCANF_R' _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap), ^ long long int void * _360 = (long long int) _368; [...] and also: 0xc40fa3 verify_gimple_in_cfg(function*, bool) /tmp/7730760_9.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/tree-cfg.c:5585 0xae70ec execute_function_todo /tmp/7730760_9.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/passes.c:1994 0xae6e85 execute_todo /tmp/7730760_9.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/gcc/passes.c:2048 I'd have to reproduce the problem manually in order to share a preprocessed file.
[Bug middle-end/85450] ICE: invalid types in nop conversion during GIMPLE pass: ompexp
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85450 --- Comment #3 from Richard Biener --- Author: rguenth Date: Thu Apr 26 07:21:42 2018 New Revision: 259667 URL: https://gcc.gnu.org/viewcvs?rev=259667=gcc=rev Log: 2018-04-26 Richard BienerPR middle-end/85450 * tree-cfg.c (verify_gimple_assign_unary): Restore proper checking of integer<->pointer conversions. * omp-expand.c (expand_omp_for_static_nochunk): Avoid sign-/zero-extending pointer types. (expand_omp_for_static_chunk): Likewise. Modified: trunk/gcc/ChangeLog trunk/gcc/omp-expand.c trunk/gcc/tree-cfg.c
[Bug middle-end/85450] ICE: invalid types in nop conversion during GIMPLE pass: ompexp
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85450 Richard Biener changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #4 from Richard Biener --- Fixed.
[Bug middle-end/85450] ICE: invalid types in nop conversion during GIMPLE pass: ompexp
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85450 --- Comment #2 from Jakub Jelinek --- There are 4 spots, unsigned_type_for breaks for-5.c though. There are several other spots that do use signed_type_for instead, so following works for the testsuite: --- gcc/omp-expand.c.jj 2018-04-16 20:35:14.663558320 +0200 +++ gcc/omp-expand.c2018-04-19 17:14:13.267424165 +0200 @@ -3501,7 +3501,12 @@ expand_omp_for_static_nochunk (struct om t = fold_convert (itype, s0); t = fold_build2 (MULT_EXPR, itype, t, step); if (POINTER_TYPE_P (type)) -t = fold_build_pointer_plus (n1, t); +{ + t = fold_build_pointer_plus (n1, t); + if (!POINTER_TYPE_P (TREE_TYPE (startvar)) + && TYPE_PRECISION (TREE_TYPE (startvar)) > TYPE_PRECISION (type)) + t = fold_convert (signed_type_for (type), t); +} else t = fold_build2 (PLUS_EXPR, type, t, n1); t = fold_convert (TREE_TYPE (startvar), t); @@ -3515,7 +3520,12 @@ expand_omp_for_static_nochunk (struct om t = fold_convert (itype, e0); t = fold_build2 (MULT_EXPR, itype, t, step); if (POINTER_TYPE_P (type)) -t = fold_build_pointer_plus (n1, t); +{ + t = fold_build_pointer_plus (n1, t); + if (!POINTER_TYPE_P (TREE_TYPE (startvar)) + && TYPE_PRECISION (TREE_TYPE (startvar)) > TYPE_PRECISION (type)) + t = fold_convert (signed_type_for (type), t); +} else t = fold_build2 (PLUS_EXPR, type, t, n1); t = fold_convert (TREE_TYPE (startvar), t); @@ -4000,7 +4010,12 @@ expand_omp_for_static_chunk (struct omp_ t = fold_convert (itype, s0); t = fold_build2 (MULT_EXPR, itype, t, step); if (POINTER_TYPE_P (type)) -t = fold_build_pointer_plus (n1, t); +{ + t = fold_build_pointer_plus (n1, t); + if (!POINTER_TYPE_P (TREE_TYPE (startvar)) + && TYPE_PRECISION (TREE_TYPE (startvar)) > TYPE_PRECISION (type)) + t = fold_convert (signed_type_for (type), t); +} else t = fold_build2 (PLUS_EXPR, type, t, n1); t = fold_convert (TREE_TYPE (startvar), t); @@ -4014,7 +4029,12 @@ expand_omp_for_static_chunk (struct omp_ t = fold_convert (itype, e0); t = fold_build2 (MULT_EXPR, itype, t, step); if (POINTER_TYPE_P (type)) -t = fold_build_pointer_plus (n1, t); +{ + t = fold_build_pointer_plus (n1, t); + if (!POINTER_TYPE_P (TREE_TYPE (startvar)) + && TYPE_PRECISION (TREE_TYPE (startvar)) > TYPE_PRECISION (type)) + t = fold_convert (signed_type_for (type), t); +} else t = fold_build2 (PLUS_EXPR, type, t, n1); t = fold_convert (TREE_TYPE (startvar), t); Though, I think it would be better to replace most of the signed_type_for related to pointer types to unsigned_type_for. Not something I have time for right now though.
[Bug middle-end/85450] ICE: invalid types in nop conversion during GIMPLE pass: ompexp
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85450 Richard Biener changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2018-04-18 Ever confirmed|0 |1 --- Comment #1 from Richard Biener --- For for-3.c it is: static void expand_omp_for_static_nochunk (struct omp_region *region, struct omp_for_data *fd, gimple *inner_stmt) { ... if (POINTER_TYPE_P (type)) t = fold_build_pointer_plus (n1, t); else t = fold_build2 (PLUS_EXPR, type, t, n1); t = fold_convert (TREE_TYPE (startvar), t); where a fix could be to do Index: omp-expand.c === --- omp-expand.c(revision 259457) +++ omp-expand.c(working copy) @@ -3501,7 +3501,10 @@ expand_omp_for_static_nochunk (struct om t = fold_convert (itype, s0); t = fold_build2 (MULT_EXPR, itype, t, step); if (POINTER_TYPE_P (type)) -t = fold_build_pointer_plus (n1, t); +{ + t = fold_build_pointer_plus (n1, t); + t = fold_convert (unsigned_type_for (TREE_TYPE (n1)), t); +} else t = fold_build2 (PLUS_EXPR, type, t, n1); t = fold_convert (TREE_TYPE (startvar), t); but there are likely a few "copies" of the code. The for-3.c testcase also exercises the following spot: @@ -3515,7 +3518,10 @@ expand_omp_for_static_nochunk (struct om t = fold_convert (itype, e0); t = fold_build2 (MULT_EXPR, itype, t, step); if (POINTER_TYPE_P (type)) -t = fold_build_pointer_plus (n1, t); +{ + t = fold_build_pointer_plus (n1, t); + t = fold_convert (unsigned_type_for (TREE_TYPE (n1)), t); +} else t = fold_build2 (PLUS_EXPR, type, t, n1); t = fold_convert (TREE_TYPE (startvar), t); and that's still not enough to fix it fully... Note that I think even for GENERIC using fold_convert the original way is wrong. Given fold_convert is "interesting" we might consider using POINTERS_EXTEND_UNSIGNED there... (ok, I didn't suggest that).