diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2017-08-30 11:12:55 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2017-08-30 11:12:55 +0000 |
commit | e05c94bad29dd443cc28ae314e2874992afce348 (patch) | |
tree | 464c6084aa6d986120de2dce326c3955b27fde13 /gcc | |
parent | 1e047eedb4c116f861f9d781b0a36821084242ef (diff) | |
download | gcc-e05c94bad29dd443cc28ae314e2874992afce348.zip gcc-e05c94bad29dd443cc28ae314e2874992afce348.tar.gz gcc-e05c94bad29dd443cc28ae314e2874992afce348.tar.bz2 |
[32/77] Check is_a <scalar_int_mode> before calling valid_pointer_mode
A future patch will make valid_pointer_mode take a scalar_int_mode
instead of a machine_mode. is_a <...> rather than as_a <...> is
needed here because we're checking a mode supplied by the user.
2017-08-30 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
gcc/c-family/
* c-attribs.c (handle_mode_attribute): Check for a scalar_int_mode
before calling targetm.addr_space.valid_pointer_mode.
Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r251484
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/c-family/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/c-family/c-attribs.c | 6 |
2 files changed, 11 insertions, 2 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 36413cf..fe3fd58 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -2,6 +2,13 @@ Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> + * c-attribs.c (handle_mode_attribute): Check for a scalar_int_mode + before calling targetm.addr_space.valid_pointer_mode. + +2017-08-30 Richard Sandiford <richard.sandiford@linaro.org> + Alan Hayward <alan.hayward@arm.com> + David Sherwood <david.sherwood@arm.com> + * c-cppbuiltin.c (c_cpp_builtins): Use opt_scalar_float_mode. 2017-08-30 Richard Sandiford <richard.sandiford@linaro.org> diff --git a/gcc/c-family/c-attribs.c b/gcc/c-family/c-attribs.c index 5f79468..e564c72 100644 --- a/gcc/c-family/c-attribs.c +++ b/gcc/c-family/c-attribs.c @@ -1469,10 +1469,12 @@ handle_mode_attribute (tree *node, tree name, tree args, if (POINTER_TYPE_P (type)) { + scalar_int_mode addr_mode; addr_space_t as = TYPE_ADDR_SPACE (TREE_TYPE (type)); tree (*fn)(tree, machine_mode, bool); - if (!targetm.addr_space.valid_pointer_mode (mode, as)) + if (!is_a <scalar_int_mode> (mode, &addr_mode) + || !targetm.addr_space.valid_pointer_mode (addr_mode, as)) { error ("invalid pointer mode %qs", p); return NULL_TREE; @@ -1482,7 +1484,7 @@ handle_mode_attribute (tree *node, tree name, tree args, fn = build_pointer_type_for_mode; else fn = build_reference_type_for_mode; - typefm = fn (TREE_TYPE (type), mode, false); + typefm = fn (TREE_TYPE (type), addr_mode, false); } else { |