From 953e520dbe6794655602cdecec878d0393404731 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Fri, 18 Aug 2017 23:56:28 +0000 Subject: jit: fix segfault with autovectorization (PR tree-optimization/46805) libgccjit ran into its own version of PR tree-optimization/46805 (seen with the Go frontend); this patch fixes it in the same way. gcc/jit/ChangeLog: PR tree-optimization/46805 * dummy-frontend.c (jit_langhook_parse_file): Handle vector types. gcc/testsuite/ChangeLog: PR tree-optimization/46805 * jit.dg/all-non-failing-tests.h: Add test-autovectorize.c. * jit.dg/test-autovectorize.c: New test case. From-SVN: r251192 --- gcc/jit/dummy-frontend.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'gcc/jit/dummy-frontend.c') diff --git a/gcc/jit/dummy-frontend.c b/gcc/jit/dummy-frontend.c index d7d2172..b217290 100644 --- a/gcc/jit/dummy-frontend.c +++ b/gcc/jit/dummy-frontend.c @@ -165,6 +165,17 @@ jit_langhook_parse_file (void) static tree jit_langhook_type_for_mode (machine_mode mode, int unsignedp) { + /* Build any vector types here (see PR 46805). */ + if (VECTOR_MODE_P (mode)) + { + tree inner; + + inner = jit_langhook_type_for_mode (GET_MODE_INNER (mode), unsignedp); + if (inner != NULL_TREE) + return build_vector_type_for_mode (inner, mode); + return NULL_TREE; + } + if (mode == TYPE_MODE (float_type_node)) return float_type_node; -- cgit v1.1