aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorPrathamesh Kulkarni <prathamesh.kulkarni@linaro.org>2016-11-26 10:41:55 +0000
committerPrathamesh Kulkarni <prathamesh3492@gcc.gnu.org>2016-11-26 10:41:55 +0000
commit7fa6a965355c27a6e493bdcfd285ac622137bf0a (patch)
tree7fb3110a0d8aafa53f91252bb17aee4308e78f9b /gcc/tree.c
parent55ab8dbf4dcf12dbc1d11526245c8240a69ea120 (diff)
downloadgcc-7fa6a965355c27a6e493bdcfd285ac622137bf0a.zip
gcc-7fa6a965355c27a6e493bdcfd285ac622137bf0a.tar.gz
gcc-7fa6a965355c27a6e493bdcfd285ac622137bf0a.tar.bz2
tree.c (build_common_tree_nodes): Initialize ptrdiff_type_node.
2016-11-26 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org> * tree.c (build_common_tree_nodes): Initialize ptrdiff_type_node. (free_lang_data): Remove assignment to ptrdiff_type_node. c-family/ * c-common.c (c_common_nodes_and_builtins): Remove initialization of ptrdiff_type_node. lto/ * lto-lang.c (lto_init): Remove initialization of ptrdiff_type_node. From-SVN: r242888
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index dd6ef63..0f0e675 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -6006,7 +6006,6 @@ free_lang_data (void)
free_lang_data_in_cgraph ();
/* Create gimple variants for common types. */
- ptrdiff_type_node = integer_type_node;
fileptr_type_node = ptr_type_node;
const_tm_ptr_type_node = const_ptr_type_node;
@@ -10314,6 +10313,30 @@ build_common_tree_nodes (bool signed_char)
gcc_unreachable ();
}
+ /* Define what type to use for ptrdiff_t. */
+ if (strcmp (PTRDIFF_TYPE, "int") == 0)
+ ptrdiff_type_node = integer_type_node;
+ else if (strcmp (PTRDIFF_TYPE, "long int") == 0)
+ ptrdiff_type_node = long_integer_type_node;
+ else if (strcmp (PTRDIFF_TYPE, "long long int") == 0)
+ ptrdiff_type_node = long_long_integer_type_node;
+ else if (strcmp (PTRDIFF_TYPE, "short int") == 0)
+ ptrdiff_type_node = short_integer_type_node;
+ else
+ {
+ ptrdiff_type_node = NULL_TREE;
+ for (int i = 0; i < NUM_INT_N_ENTS; i++)
+ if (int_n_enabled_p[i])
+ {
+ char name[50];
+ sprintf (name, "__int%d", int_n_data[i].bitsize);
+ if (strcmp (name, PTRDIFF_TYPE) == 0)
+ ptrdiff_type_node = int_n_trees[i].signed_type;
+ }
+ if (ptrdiff_type_node == NULL_TREE)
+ gcc_unreachable ();
+ }
+
/* Fill in the rest of the sized types. Reuse existing type nodes
when possible. */
intQI_type_node = make_or_reuse_type (GET_MODE_BITSIZE (QImode), 0);