The following fixes the intermediate conversions inserted by
convert_to_integer when facing address-spaces and converts
to their effective [u]intptr_t when they are registered_builtin_types
by considering those also from c_common_type_for_size and not
only from c_common_type_for_mode.
PR c/89270
gcc/c-family/
* c-common.cc (c_common_type_for_size): Consider
registered_builtin_types.
gcc/testsuite/
* gcc.target/avr/pr89270.c: New testcase.
return (unsignedp ? widest_unsigned_literal_type_node
: widest_integer_literal_type_node);
+ for (tree t = registered_builtin_types; t; t = TREE_CHAIN (t))
+ {
+ tree type = TREE_VALUE (t);
+ if (TREE_CODE (type) == INTEGER_TYPE
+ && bits == TYPE_PRECISION (type)
+ && !!unsignedp == !!TYPE_UNSIGNED (type))
+ return type;
+ }
+
if (bits <= TYPE_PRECISION (intQI_type_node))
return unsignedp ? unsigned_intQI_type_node : intQI_type_node;
--- /dev/null
+/* { dg-do compile } */
+
+void test()
+{
+ extern const unsigned char __memx __data_load_end;
+ __uint24 top=(__uint24)&__data_load_end;
+}