aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorSriraman Tallam <tmsriram@google.com>2014-07-09 00:50:25 +0000
committerSriraman Tallam <tmsriram@gcc.gnu.org>2014-07-09 00:50:25 +0000
commitdc58164b858733ba3e7628d8f4b11bc6a0c81657 (patch)
treeae90afd675e26f79ef09e8f055a0214d7fd79dd8 /gcc
parentfcb090b2ccaa42ef09afca6b40e4d5bbbaaaf635 (diff)
downloadgcc-dc58164b858733ba3e7628d8f4b11bc6a0c81657.zip
gcc-dc58164b858733ba3e7628d8f4b11bc6a0c81657.tar.gz
gcc-dc58164b858733ba3e7628d8f4b11bc6a0c81657.tar.bz2
re PR target/61599 ([x86_64] With -mcmodel=medium, extern global arrays without size are not treated conservatively.)
2014-07-08 Sriraman Tallam <tmsriram@google.com> PR target/61599 * config/i386/i386.c (ix86_in_large_data_p): Check for size less than zero. PR target/61599 * gcc.target/i386/pr61599-1.c: New test. * gcc.target/i386/pr61599-2.c: New test. From-SVN: r212380
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/i386/i386.c7
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gcc.target/i386/pr61599-1.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/pr61599-2.c13
5 files changed, 44 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1950653..783bd63 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2014-07-08 Sriraman Tallam <tmsriram@google.com>
+
+ PR target/61599
+ * config/i386/i386.c (ix86_in_large_data_p): Check for size less
+ than zero.
+
2014-07-08 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/61673
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index d29a25b..a280b46 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -5039,8 +5039,11 @@ ix86_in_large_data_p (tree exp)
HOST_WIDE_INT size = int_size_in_bytes (TREE_TYPE (exp));
/* If this is an incomplete type with size 0, then we can't put it
- in data because it might be too big when completed. */
- if (!size || size > ix86_section_threshold)
+ in data because it might be too big when completed. Also,
+ int_size_in_bytes returns -1 if size can vary or is larger than
+ an integer in which case also it is safer to assume that it goes in
+ large data. */
+ if (size <= 0 || size > ix86_section_threshold)
return true;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 83015ed..98342bb 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2014-07-08 Sriraman Tallam <tmsriram@google.com>
+
+ PR target/61599
+ * gcc.target/i386/pr61599-1.c: New test.
+ * gcc.target/i386/pr61599-2.c: New test.
+
2014-07-08 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/61673
diff --git a/gcc/testsuite/gcc.target/i386/pr61599-1.c b/gcc/testsuite/gcc.target/i386/pr61599-1.c
new file mode 100644
index 0000000..847e736
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr61599-1.c
@@ -0,0 +1,14 @@
+/* PR target/61599 */
+/* { dg-options "-mcmodel=medium -fdata-sections" { target lp64 } } */
+/* { dg-additional-sources pr61599-2.c } */
+/* { dg-do run { target lp64 } } */
+
+char a[1*1024*1024*1024];
+char b[1*1024*1024*1024];
+char c[1*1024*1024*1024];
+
+extern int bar();
+int main()
+{
+ return bar() + c[225];
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr61599-2.c b/gcc/testsuite/gcc.target/i386/pr61599-2.c
new file mode 100644
index 0000000..22a53a4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr61599-2.c
@@ -0,0 +1,13 @@
+/* PR target/61599 */
+/* With -mcmodel=medium, all the arrays will be treated as large data. */
+/* { dg-options "-mcmodel=medium -fdata-sections" { target lp64 } } */
+/* { dg-do compile { target lp64 } } */
+
+extern char a[];
+extern char b[];
+extern char c[];
+
+int bar()
+{
+ return a[2] + b[16] + c[256];
+}