diff options
author | rsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-01-30 19:44:06 +0000 |
---|---|---|
committer | rsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-01-30 19:44:06 +0000 |
commit | 229c9550c46a9d62bb326a9553fc6aa022440d71 (patch) | |
tree | d0831e1e20b8e64cc5661de4a689c8862b9e4e4b /gcc | |
parent | 8e6e94c4c2d1685f4715ed7e581c6f8a16fb8688 (diff) | |
download | gcc-229c9550c46a9d62bb326a9553fc6aa022440d71.tar.gz |
gcc/cp/
PR c++/58708
* parser.c (make_string_pack): Use double_int::from_buffer.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@207320 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/parser.c | 24 |
2 files changed, 11 insertions, 18 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 392fd1d7663..625a880d551 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2014-01-30 Richard Sandiford <rdsandiford@googlemail.com> + + PR c++/58708 + * parser.c (make_string_pack): Use double_int::from_buffer. + 2014-01-30 Marek Polacek <polacek@redhat.com> PR c/59940 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 0636445198b..a53597d205e 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -3808,7 +3808,8 @@ make_string_pack (tree value) { tree charvec; tree argpack = make_node (NONTYPE_ARGUMENT_PACK); - const char *str = TREE_STRING_POINTER (value); + const unsigned char *str + = (const unsigned char *) TREE_STRING_POINTER (value); int sz = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (value)))); int len = TREE_STRING_LENGTH (value) / sz - 1; tree argvec = make_tree_vec (2); @@ -3821,23 +3822,10 @@ make_string_pack (tree value) /* Fill in CHARVEC with all of the parameters. */ charvec = make_tree_vec (len); - if (sz == 1) - { - for (int i = 0; i < len; ++i) - TREE_VEC_ELT (charvec, i) = build_int_cst (str_char_type_node, str[i]); - } - else if (sz == 2) - { - const uint16_t *num = (const uint16_t *)str; - for (int i = 0; i < len; ++i) - TREE_VEC_ELT (charvec, i) = build_int_cst (str_char_type_node, num[i]); - } - else if (sz == 4) - { - const uint32_t *num = (const uint32_t *)str; - for (int i = 0; i < len; ++i) - TREE_VEC_ELT (charvec, i) = build_int_cst (str_char_type_node, num[i]); - } + for (int i = 0; i < len; ++i) + TREE_VEC_ELT (charvec, i) + = double_int_to_tree (str_char_type_node, + double_int::from_buffer (str + i * sz, sz)); /* Build the argument packs. */ SET_ARGUMENT_PACK_ARGS (argpack, charvec); |