extern void bar (const __memx void*); void func (char a) { bar (a); } const __memx void* func2 (char a) { return a; } >> avr-gcc ice-memx.c -S -w ice-memx.c: In function 'func2': ice-memx.c:8:20: error: invalid types in nop conversion const <address-space-7> void * long int D.1326 = (const <address-space-7> void *) D.1327; ice-memx.c:8:20: internal compiler error: verify_gimple failed Please submit a full bug report, with preprocessed source if appropriate. Target: avr Configured with: ../gcc-trunk/configure --with-gmp=/usr/local --prefix=/usr/local/avr --target=avr --enable-languages=c,c++ --with-dwarf2 --disable-shared --disable-libada --disable-libssp --disable-nls Thread model: single gcc version 4.7.0 20120217 (experimental) (GCC) GNU C (GCC) version 4.7.0 20120217 (experimental) (avr) compiled by GNU C version 4.6.2, GMP version 5.0.4, MPFR version 3.1.0, MPC version 0.9 I can also see the error on a build from 2012-02-28.
Created attachment 26793 [details] ice-memx.c: C source
/* Allow conversions between integral types and pointers only if there is no sign or zero extension involved. For targets were the precision of ptrofftype doesn't match that of pointers we need to allow arbitrary conversions from and to ptrofftype. */ if ((POINTER_TYPE_P (lhs_type) && INTEGRAL_TYPE_P (rhs1_type) && (TYPE_PRECISION (lhs_type) >= TYPE_PRECISION (rhs1_type) || ptrofftype_p (rhs1_type))) || (POINTER_TYPE_P (rhs1_type) && INTEGRAL_TYPE_P (lhs_type) && (TYPE_PRECISION (rhs1_type) >= TYPE_PRECISION (lhs_type) || ptrofftype_p (sizetype)))) return false; Looks like the above should be if ((POINTER_TYPE_P (lhs_type) && INTEGRAL_TYPE_P (rhs1_type) && (TYPE_PRECISION (lhs_type) <= TYPE_PRECISION (rhs1_type) || ptrofftype_p (rhs1_type))) || (POINTER_TYPE_P (rhs1_type) && INTEGRAL_TYPE_P (lhs_type) && (TYPE_PRECISION (rhs1_type) >= TYPE_PRECISION (lhs_type) || ptrofftype_p (sizetype)))) return false; does that help?
Or rather /* Allow conversions pointer type to integral type only if there is no sign or zero extension involved. For targets were the precision of ptrofftype doesn't match that of pointers we need to allow arbitrary conversions to ptrofftype. */ if (POINTER_TYPE_P (rhs1_type) && INTEGRAL_TYPE_P (lhs_type) && (TYPE_PRECISION (rhs1_type) >= TYPE_PRECISION (lhs_type) || ptrofftype_p (sizetype))) return false; as restricting conversion from integral to pointers does not seem necessary (only pointers do not have a "sign").
Err ... /* Allow conversions pointer type to integral type only if there is no sign or zero extension involved. For targets were the precision of ptrofftype doesn't match that of pointers we need to allow arbitrary conversions to ptrofftype. */ if ((POINTER_TYPE_P (lhs_type) && INTEGRAL_TYPE_P (rhs1_type)) || (POINTER_TYPE_P (rhs1_type) && INTEGRAL_TYPE_P (lhs_type) && (TYPE_PRECISION (rhs1_type) >= TYPE_PRECISION (lhs_type) || ptrofftype_p (sizetype)))) return false; tricky business ;)
Mine, in case that helps (it's in tree-cfg.c)
Author: rguenth Date: Thu Mar 1 12:26:20 2012 New Revision: 184739 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=184739 Log: 2012-03-01 Richard Guenther <rguenther@suse.de> PR middle-end/52443 * tree-cfg.c (verify_gimple_assign_unary): Allow any conversions from integral types to pointer types. Modified: trunk/gcc/ChangeLog trunk/gcc/tree-cfg.c
Fixed.
Yes, thanks. It works now :-)