This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Change uint*_type_node definition to make_or_reuse_type
- From: Andreas Krebbel <krebbel at linux dot vnet dot ibm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 5 Jun 2013 14:26:38 +0200
- Subject: [PATCH] Change uint*_type_node definition to make_or_reuse_type
Hi,
I'm trying to implement a builtin with a uint64_t* argument type as
build_pointer_type (uint64_type_node). Unfortunately this fails for a
simple case like:
uint64_t a;
__builtin_test (&a);
t.c:7:3: warning: passing argument 1 of â__builtin_testâ from incompatible pointer type [enabled by default]
__builtin_test(&a);
^
t.c:7:3: note: expected âlong unsigned int *â but argument is of type âuint64_t *â
The problem is how the uint64_type_node is generated. We just create
a new "unsigned long" data type which cannot be unified with the
existing in convert_for_assignment because its main_variant type just
points to itself.
Reusing the existing integer data types as a base this matches the
implementation in stdint.h and works fine for me.
The only other user appears to be the bswap64 builtin. This keeps
working as before with that change.
Ok for mainline?
Bye,
-Andreas-
2013-06-05 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
* tree.c (build_common_tree_nodes): Create uint*_t type nodes with
make_or_reuse_type.
---
gcc/tree.c | 6 !!!!!!
1 file changed, 6 modifications(!)
Index: gcc/tree.c
===================================================================
*** gcc/tree.c.orig
--- gcc/tree.c
*************** build_common_tree_nodes (bool signed_cha
*** 9550,9558 ****
integer_ptr_type_node = build_pointer_type (integer_type_node);
/* Fixed size integer types. */
! uint16_type_node = build_nonstandard_integer_type (16, true);
! uint32_type_node = build_nonstandard_integer_type (32, true);
! uint64_type_node = build_nonstandard_integer_type (64, true);
/* Decimal float types. */
dfloat32_type_node = make_node (REAL_TYPE);
--- 9550,9558 ----
integer_ptr_type_node = build_pointer_type (integer_type_node);
/* Fixed size integer types. */
! uint16_type_node = make_or_reuse_type (16, true);
! uint32_type_node = make_or_reuse_type (32, true);
! uint64_type_node = make_or_reuse_type (64, true);
/* Decimal float types. */
dfloat32_type_node = make_node (REAL_TYPE);