From edbbb166f762f82bc926ce42c0b2e1c5b4996675 Mon Sep 17 00:00:00 2001 From: Jozef Lawrynowicz Date: Mon, 6 Aug 2018 10:29:17 +0000 Subject: [PATCH] re PR target/86662 (msp430-elf segfault with -flto and -mlarge) PR target/86662 * gcc/tree.c (build_common_tree_nodes): Initialize integer_types array with all enabled __intN types. * gcc/testsuite/gcc.target/msp430/pr86662.c: New test. From-SVN: r263332 --- gcc/ChangeLog | 8 ++++++++ gcc/testsuite/gcc.target/msp430/pr86662.c | 13 +++++++++++++ gcc/tree.c | 3 +-- 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.target/msp430/pr86662.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a47e00e5558..78e51d29f73 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2018-08-06 Jozef Lawrynowicz + + PR target/86662 + * gcc/tree.c (build_common_tree_nodes): Initialize integer_types array + with all enabled __intN types. + + * gcc/testsuite/gcc.target/msp430/pr86662.c: New test. + 2018-08-06 Alan Hayward * alias.c (record_set): Check for clobber high. diff --git a/gcc/testsuite/gcc.target/msp430/pr86662.c b/gcc/testsuite/gcc.target/msp430/pr86662.c new file mode 100644 index 00000000000..1144b3e8394 --- /dev/null +++ b/gcc/testsuite/gcc.target/msp430/pr86662.c @@ -0,0 +1,13 @@ +/* PR/86662 */ + +/* { dg-do link } */ +/* -nostdlib prevents link errors due to mismatched code models for + libgloss objects. */ +/* { dg-options "-mlarge -flto -nostdlib" } */ +/* { dg-skip-if "" { *-*-* } { "-mcpu=msp430" } } */ + +int main(void) +{ + __int20 n = 5; + return 0; +} diff --git a/gcc/tree.c b/gcc/tree.c index 28952e5b1cd..0ec74af0c1c 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -9802,8 +9802,7 @@ build_common_tree_nodes (bool signed_char) int_n_trees[i].signed_type = make_signed_type (int_n_data[i].bitsize); int_n_trees[i].unsigned_type = make_unsigned_type (int_n_data[i].bitsize); - if (int_n_data[i].bitsize > LONG_LONG_TYPE_SIZE - && int_n_enabled_p[i]) + if (int_n_enabled_p[i]) { integer_types[itk_intN_0 + i * 2] = int_n_trees[i].signed_type; integer_types[itk_unsigned_intN_0 + i * 2] = int_n_trees[i].unsigned_type;