From: Eric Botcazou Date: Fri, 19 Oct 2018 07:17:20 +0000 (+0000) Subject: cfgexpand.c (expand_one_var): Use specific wording in error message for non-local... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ba9a8625b0a7eddb237d140e89ddb78afd1e3539;p=gcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 82cc005283f..88ec6863128 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-10-19 Eric Botcazou + + * 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 * haifa-sched.c (priority): Add force_recompute parameter. diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index 35ca276e4ad..9d1eab6dfe2 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 58a3aa369fa..42df2575568 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 742316dd054..edceccd0c3e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2018-10-19 Eric Botcazou + + * gnat.dg/frame_overflow2.adb: New test. + 2018-10-18 H.J. Lu 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 00000000000..64f0194c964 --- /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;