From: Eric Botcazou Date: Sat, 6 Apr 2019 21:44:33 +0000 (+0000) Subject: backport: rtlanal.c (get_initial_register_offset): Fall back to the estimate as long... X-Git-Tag: releases/gcc-7.5.0~499 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e99fd71a93277020ee00bedf1677132f84536c31;p=thirdparty%2Fgcc.git backport: rtlanal.c (get_initial_register_offset): Fall back to the estimate as long as the epilogue isn't completed. Backport from mainline 2019-02-19 Eric Botcazou * rtlanal.c (get_initial_register_offset): Fall back to the estimate as long as the epilogue isn't completed. From-SVN: r270183 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7aab465db1c9..b32a5d734e35 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2019-04-06 Eric Botcazou + + Backport from mainline + 2019-02-19 Eric Botcazou + + * rtlanal.c (get_initial_register_offset): Fall back to the estimate + as long as the epilogue isn't completed. + 2019-04-03 Richard Biener PR lto/89896 diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c index 5df0e5d6fdd0..5642c0d6fcf4 100644 --- a/gcc/rtlanal.c +++ b/gcc/rtlanal.c @@ -357,10 +357,10 @@ get_initial_register_offset (int from, int to) if (to == from) return 0; - /* It is not safe to call INITIAL_ELIMINATION_OFFSET - before the reload pass. We need to give at least - an estimation for the resulting frame size. */ - if (! reload_completed) + /* It is not safe to call INITIAL_ELIMINATION_OFFSET before the epilogue + is completed, but we need to give at least an estimate for the stack + pointer based on the frame size. */ + if (!epilogue_completed) { offset1 = crtl->outgoing_args_size + get_frame_size (); #if !STACK_GROWS_DOWNWARD diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6df23353ccf1..5175202bff5b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2019-04-06 Eric Botcazou + + * gnat.dg/opt73.adb: New test. + 2019-04-02 Xiong Hu Luo Backport from trunk r250477. diff --git a/gcc/testsuite/gnat.dg/opt73.adb b/gcc/testsuite/gnat.dg/opt73.adb new file mode 100644 index 000000000000..38ab4774fb77 --- /dev/null +++ b/gcc/testsuite/gnat.dg/opt73.adb @@ -0,0 +1,34 @@ +-- { dg-do run } +-- { dg-options "-O" } + +procedure Opt73 is + + type Terminal_Set_Indexed_By_Non_Terminal is + array (Natural range <>, Natural range <>) of Boolean with Pack; + + type Terminal_Set_Per_Non_Terminal + (Last_Terminal : Natural; + Last_Non_Terminal : Natural) is + record + Map : Terminal_Set_Indexed_By_Non_Terminal + (1 .. Last_Non_Terminal, 0 .. Last_Terminal); + end record; + + Follow : Terminal_Set_Per_Non_Terminal (5, 4); + Expect : Terminal_Set_Per_Non_Terminal := + (5, 4, (1 => (2 => True, others => False), + others => (others => False))); + + procedure Get_Follow (Value : out Terminal_Set_Per_Non_Terminal) is + begin + Value.Map := (others => (others => False)); + Value.Map (1, 2) := True; + Value.Map (2, 0) := Value.Map (2, 0) or Value.Map (1, 0); + end; + +begin + Get_Follow (Follow); + if Follow /= Expect then + raise Program_Error; + end if; +end;