re PR target/86662 (msp430-elf segfault with -flto and -mlarge)
authorJozef Lawrynowicz <jozef.l@mittosystems.com>
Mon, 6 Aug 2018 10:29:17 +0000 (10:29 +0000)
committerJozef Lawrynowicz <jozefl@gcc.gnu.org>
Mon, 6 Aug 2018 10:29:17 +0000 (10:29 +0000)
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
gcc/testsuite/gcc.target/msp430/pr86662.c [new file with mode: 0644]
gcc/tree.c

index a47e00e5558d25495242075cefc6f84d70dff40a..78e51d29f73c821b2f121b69d824b871a98e48d1 100644 (file)
@@ -1,3 +1,11 @@
+2018-08-06  Jozef Lawrynowicz  <jozef.l@mittosystems.com>
+
+       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  <alan.hayward@arm.com>
 
        * 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 (file)
index 0000000..1144b3e
--- /dev/null
@@ -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;
+}
index 28952e5b1cdec18c15806383d4df1c0bd7e74d2c..0ec74af0c1c75a44e11d27c8a23304ec6834b2f5 100644 (file)
@@ -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;