aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2018-10-19 07:17:20 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2018-10-19 07:17:20 +0000
commitba9a8625b0a7eddb237d140e89ddb78afd1e3539 (patch)
tree5de81f3816c8f5b37652cdeee06c9657d98e97e1 /gcc
parent079c81d010e3303c8fdbc4669bf3907fe7a37052 (diff)
downloadgcc-ba9a8625b0a7eddb237d140e89ddb78afd1e3539.zip
gcc-ba9a8625b0a7eddb237d140e89ddb78afd1e3539.tar.gz
gcc-ba9a8625b0a7eddb237d140e89ddb78afd1e3539.tar.bz2
cfgexpand.c (expand_one_var): Use specific wording in error message for non-local frame variables.
* cfgexpand.c (expand_one_var): Use specific wording in error message for non-local frame variables. * stor-layout.c (layout_decl): Do not issue a warning for them. From-SVN: r265305
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/cfgexpand.c7
-rw-r--r--gcc/stor-layout.c4
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gnat.dg/frame_overflow2.adb24
5 files changed, 42 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 82cc005..88ec686 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2018-10-19 Eric Botcazou <ebotcazou@adacore.com>
+
+ * cfgexpand.c (expand_one_var): Use specific wording in error message
+ for non-local frame variables.
+ * stor-layout.c (layout_decl): Do not issue a warning for them.
+
2018-10-19 Robin Dapp <rdapp@linux.ibm.com>
* haifa-sched.c (priority): Add force_recompute parameter.
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 35ca276..9d1eab6 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -1674,7 +1674,12 @@ expand_one_var (tree var, bool toplevel, bool really_expand)
/* Reject variables which cover more than half of the address-space. */
if (really_expand)
{
- error ("size of variable %q+D is too large", var);
+ if (DECL_NONLOCAL_FRAME (var))
+ error_at (DECL_SOURCE_LOCATION (current_function_decl),
+ "total size of local objects is too large");
+ else
+ error_at (DECL_SOURCE_LOCATION (var),
+ "size of variable %q+D is too large", var);
expand_one_error_var (var);
}
}
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index 58a3aa3..42df257 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -755,8 +755,8 @@ layout_decl (tree decl, unsigned int known_align)
DECL_SIZE_UNIT (decl) = variable_size (DECL_SIZE_UNIT (decl));
/* If requested, warn about definitions of large data objects. */
- if ((code == VAR_DECL || code == PARM_DECL)
- && ! DECL_EXTERNAL (decl))
+ if ((code == PARM_DECL || (code == VAR_DECL && !DECL_NONLOCAL_FRAME (decl)))
+ && !DECL_EXTERNAL (decl))
{
tree size = DECL_SIZE_UNIT (decl);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 742316d..edceccd 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2018-10-19 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/frame_overflow2.adb: New test.
+
2018-10-18 H.J. Lu <hongjiu.lu@intel.com>
PR target/72782
diff --git a/gcc/testsuite/gnat.dg/frame_overflow2.adb b/gcc/testsuite/gnat.dg/frame_overflow2.adb
new file mode 100644
index 0000000..64f0194
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/frame_overflow2.adb
@@ -0,0 +1,24 @@
+-- { dg-do compile }
+
+with System;
+
+procedure Frame_Overflow2 is -- { dg-error "too large" }
+
+ type Index_T is range 1 .. 2**(System.Word_Size - 1) - 1;
+
+ type SetArray is array (Index_T) of Boolean;
+
+ type Set is record
+ Store: SetArray := (Others => False);
+ end record;
+
+ Phi: constant Set := (Store => (Others => False));
+
+ function F return Set is
+ begin
+ return Phi;
+ end;
+
+begin
+ null;
+end;