diff options
author | hainque <hainque@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-08-24 21:23:22 +0000 |
---|---|---|
committer | hainque <hainque@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-08-24 21:23:22 +0000 |
commit | c6636ef7908cde85356f57a3261c1953a8dcd607 (patch) | |
tree | 30ea226563257ca2559d6f9e7614fcc3b8ea38f8 /gcc/convert.c | |
parent | 81a71e2bc93ebca74f5036a21c672b13cb9a791d (diff) | |
download | gcc-c6636ef7908cde85356f57a3261c1953a8dcd607.tar.gz |
* convert.c (convert_to_integer): Don't assume an input pointer is
POINTER_SIZE wide. Fetch from the type instead.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151060 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/convert.c')
-rw-r--r-- | gcc/convert.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/convert.c b/gcc/convert.c index f7ddfc956fc..a833418d273 100644 --- a/gcc/convert.c +++ b/gcc/convert.c @@ -530,10 +530,13 @@ convert_to_integer (tree type, tree expr) if (integer_zerop (expr)) return build_int_cst (type, 0); - /* Convert to an unsigned integer of the correct width first, - and from there widen/truncate to the required type. */ + /* Convert to an unsigned integer of the correct width first, and from + there widen/truncate to the required type. Some targets support the + coexistence of multiple valid pointer sizes, so fetch the one we need + from the type. */ expr = fold_build1 (CONVERT_EXPR, - lang_hooks.types.type_for_size (POINTER_SIZE, 0), + lang_hooks.types.type_for_size + (TYPE_PRECISION (intype), 0), expr); return fold_convert (type, expr); |