]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR target/86662 (msp430-elf segfault with -flto and -mlarge)
authorJozef Lawrynowicz <jozef.l@mittosystems.com>
Sat, 25 Aug 2018 11:52:15 +0000 (11:52 +0000)
committerJozef Lawrynowicz <jozefl@gcc.gnu.org>
Sat, 25 Aug 2018 11:52:15 +0000 (11:52 +0000)
Backport from mainline

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: r263852

gcc/ChangeLog
gcc/testsuite/gcc.target/msp430/pr86662.c [new file with mode: 0644]
gcc/tree.c

index 777b8628938c1f965a3f49452baec7f5cc2c9e64..8b0941a521f1ba397644eafee23c8b1486fd329c 100644 (file)
@@ -1,3 +1,12 @@
+2018-08-25  Jozef Lawrynowicz  <jozef.l@mittosystems.com>
+
+       Backport from mainline
+       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-21  H.J. Lu  <hongjiu.lu@intel.com>
 
        Backport from mainline
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 c28f87606aba4b2547dad8acf9b29fbcfea04b9f..d00753482646a1f98637cb8ab7e8160ccee83d23 100644 (file)
@@ -10309,8 +10309,7 @@ build_common_tree_nodes (bool signed_char)
       TYPE_SIZE (int_n_trees[i].signed_type) = bitsize_int (int_n_data[i].bitsize);
       TYPE_SIZE (int_n_trees[i].unsigned_type) = bitsize_int (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;