From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6be476fd23132bb7 X-Google-Attributes: gid103376,public From: William Paul Berriss Subject: Re: Segmentation Fault Date: 1997/04/16 Message-ID: <33548420.1046@reading.ac.uk>#1/1 X-Deja-AN: 235154157 References: <335358C5.43F8@reading.ac.uk> Organization: The University of Reading Newsgroups: comp.lang.ada Date: 1997-04-16T00:00:00+00:00 List-Id: Hi Here is the Ada code, v simple. -- -- Filename : test_memory_allocation.adb -- -- Programmer : Will Berriss -- -- Machine : stssrita (SunOs 5.3, a.k.a. Solaris 2.3 ) -- -- Compiler : GNAT 3.07 Ada 95 for Solaris 2.3/2.4/2.5 -- (Installed 3 February 1997 by WPB) -- -- Date : 15 April 1997 -- -- Edited : -- with Ada.Command_Line, Ada.Sequential_IO, Ada.Text_IO, Ada.Integer_Text_IO; use Ada.Text_IO, Ada.Integer_Text_IO; --with EEG.Image_IO; with EEG.Pixel_Types; -- For a 512X512 Image type Image, and type Colour_Pixel use EEG.Pixel_Types; -- and types XCoordinate etc of Steve's procedure Test_Memory_Allocation is RedMax, GreenMax, BlueMax : Natural := 0; begin Put("Enter No of Red Coordinates : "); Get(RedMax); Put("Enter No of Green Coordinates : "); Get(GreenMax); Put("Enter No of Blue Coordinates : "); Get(BlueMax); New_Line; Put("Each bin is a Natural, 4 bytes ."); New_Line; Put("Your Array is of Size : "); Put(Natural(RedMax * GreenMax * BlueMax * (Natural'Size / 8))); Put(" bytes."); New_Line; A:declare subtype RedRange is Natural range 0 .. RedMax -1; subtype GreenRange is Natural range 0 .. GreenMax -1; subtype BlueRange is Natural range 0 .. BlueMax -1; type Hist_Array is array( RedRange, GreenRange, BlueRange ) of Natural; H : Hist_Array := (others => (others => (others => 0))); begin -- A H(1,1,1) := 1; end A; end Test_Memory_Allocation; Enteriung 85, 85, 85 is fine, but entering 128, 128, 128 causes segmentation fault. Will ----- -- W P Berriss E-mail: W.P.Berriss@reading.ac.uk Department of Engineering The University of Reading Whiteknights Reading Tel: 0118 987 5123 Berkshire (+44 118 987 5123 outside UK) RG6 6AY England Fax: 0118 931 3327 World Wide Web Home Page: http://www.elec.rdg.ac.uk/people/postgrads/will.html