Ada: fix handling of SEGV under Win32

James A. Morrison ja2morri@csclub.uwaterloo.ca
Sun Nov 21 21:18:00 GMT 2004


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



More information about the Gcc-patches mailing list