From 0bb37e80bb786e11cb7aa2d23b7d68bb0357fc15 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Mon, 19 Apr 2021 10:13:36 +0200 Subject: Fix another -freorder-blocks-and-partition glitch with Windows SEH Since GCC 8, the -freorder-blocks-and-partition pass can split a function into hot and cold parts, thus generating 2 FDEs for a single function in DWARF for exception purposes and doing an equivalent trick for Windows SEH. Now the Windows system unwinder does not support arbitrarily large frames and there is even a hard limit on the encoding of the CFI, which changes the stack allocation strategy when it is topped and which must be reflected everywhere. gcc/ * config/i386/winnt.c (i386_pe_seh_cold_init): Properly deal with frames larger than the SEH maximum frame size. gcc/testsuite/ * gnat.dg/opt92.adb: New test. --- gcc/testsuite/gnat.dg/opt92.adb | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 gcc/testsuite/gnat.dg/opt92.adb (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/gnat.dg/opt92.adb b/gcc/testsuite/gnat.dg/opt92.adb new file mode 100644 index 0000000..f6eb6a0 --- /dev/null +++ b/gcc/testsuite/gnat.dg/opt92.adb @@ -0,0 +1,38 @@ +-- { dg-do compile { target { lp64 || llp64 } } } +-- { dg-options "-O2 -gnatws" } + +procedure Main is + + subtype Int64 is Long_Long_Integer; + + type Arr is array (Int64 range <>) of Boolean; + + Pow : constant := 10; + + procedure Compute (B : in out Arr) is + Factor : Int64 := 3; + Num : Int64; + begin + while Factor <= 10 ** (Pow / 2) loop + Num := Factor; + while Num < 10 ** Pow loop + if B (Num) then + Factor := Num; + exit; + end if; + Num := Num + 2; + end loop; + Num := Factor * Factor; + while Num < 10 ** Pow loop + B (Num) := False; + Num := Num + Factor * 2; + end loop; + Factor := Factor + 2; + end loop; + end; + + B : Arr (1 .. 10 ** Pow) := (others => True); + +begin + Compute (B); +end; -- cgit v1.1