aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/rust-lang.cc
diff options
context:
space:
mode:
authorThomas Schwinge <thomas@codesourcery.com>2023-04-07 21:56:15 +0200
committerThomas Schwinge <thomas_schwinge@mentor.com>2023-04-07 21:56:15 +0200
commit353f5e8f00a2f897d2974f07d27dd10f79666889 (patch)
tree1c82332ff22e5a8c17569e2282bf59a0fa9ec479 /gcc/rust/rust-lang.cc
parent6ee85b3255d638fd77ee3fe17a4e146c81545efb (diff)
parentaee5ee35602e0098c2ae16fa2fc9c8845caf92ed (diff)
downloadgcc-353f5e8f00a2f897d2974f07d27dd10f79666889.zip
gcc-353f5e8f00a2f897d2974f07d27dd10f79666889.tar.gz
gcc-353f5e8f00a2f897d2974f07d27dd10f79666889.tar.bz2
Merge commit 'aee5ee35602e0098c2ae16fa2fc9c8845caf92ed' into HEAD
Addresses: #1713 Fixes: #1973
Diffstat (limited to 'gcc/rust/rust-lang.cc')
-rw-r--r--gcc/rust/rust-lang.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/rust/rust-lang.cc b/gcc/rust/rust-lang.cc
index 23b23bf..49d072d 100644
--- a/gcc/rust/rust-lang.cc
+++ b/gcc/rust/rust-lang.cc
@@ -232,6 +232,21 @@ grs_langhook_type_for_mode (machine_mode mode, int unsignedp)
if (mode == TYPE_MODE (complex_integer_type_node) && !unsignedp)
return complex_integer_type_node;
}
+
+ /* See (a) <https://github.com/Rust-GCC/gccrs/issues/1713>
+ "Test failure on msp430-elfbare target", and
+ (b) <https://gcc.gnu.org/PR46805>
+ "ICE: SIGSEGV in optab_for_tree_code (optabs.c:407) with -O -fno-tree-scev-cprop -ftree-vectorize"
+ -- we have to support "random" modes/types here.
+ TODO Clean all this up (either locally, or preferably per PR46805:
+ "Ideally we'd never use lang_hooks.types.type_for_mode (or _for_size) in the
+ middle-end but had a pure middle-end based implementation". */
+ for (size_t i = 0; i < NUM_INT_N_ENTS; i ++)
+ if (int_n_enabled_p[i]
+ && mode == int_n_data[i].m)
+ return (unsignedp ? int_n_trees[i].unsigned_type
+ : int_n_trees[i].signed_type);
+
/* gcc_unreachable */
return NULL;
}