This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Ada: fix handling of SEGV under Win32


Arnaud Charlet <charlet@ACT-Europe.FR> writes:

> Tested on x86-windows
> 
> Fix handling of SEGV under Win32 by avoiding the recursive
> implementation to detect a segmentation violation or a stack overflow.

 This testcase also fails with a segfault using gnat 3.3 on powerpc-linux.


> Instead of trying to read the memory before the faulting page (and
> eventually getting a new signal) we properly test the process read
> access for this address using appropriate Win32 routine. This
> implementation is simpler and cleaner and fix a regression on Windows
> XP/SP2 where the second signal was just crashing the program without
> any exception propagation.
> 
> Test case:
> with Ada.Exceptions; use Ada.Exceptions;
> with Ada.Text_IO;use Ada.Text_IO;
> with System;
> 
> procedure Segv is
>    A : Integer;
>    for A'Address use System.Null_Address;
> begin
>    A := 1;
> exception
>    when E : others =>
>       Put_Line ("OK exception");
> end;
> $ gnatmake segv
> $ ./segv
> OK exception


-- 
Thanks,
Jim

http://www.student.cs.uwaterloo.ca/~ja2morri/
http://phython.blogspot.com
http://open.nit.ca/wiki/?page=jim


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]