comp.lang.ada
 help / color / mirror / Atom feed
From: William Paul Berriss <W.P.Berriss@reading.ac.uk>
Subject: Re: Segmentation Fault
Date: 1997/04/16
Date: 1997-04-16T00:00:00+00:00	[thread overview]
Message-ID: <33548420.1046@reading.ac.uk> (raw)
In-Reply-To: 335358C5.43F8@reading.ac.uk


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




  parent reply	other threads:[~1997-04-16  0:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <335358C5.43F8@reading.ac.uk>
1997-04-15  0:00 ` Segmentation Fault Robert Dewar
1997-04-18  0:00   ` Keith Thompson
1997-04-20  0:00     ` Robert Dewar
     [not found] ` <33538A67.709A@reading.ac.uk>
1997-04-15  0:00   ` Charlie Root
1997-04-16  0:00   ` Nicolas HUYNH
     [not found]     ` <3355DB39.3BAF@reading.ac.uk>
1997-04-19  0:00       ` I've Sussed my " Robert Dewar
1997-04-16  0:00 ` William Paul Berriss [this message]
1997-04-16  0:00   ` Stack and Heap sizes William Paul Berriss
1997-04-16  0:00     ` Samuel Tardieu
1997-04-16  0:00       ` Samuel Tardieu
1997-04-18  0:00     ` Robert Dewar
1997-04-20  0:00       ` Ada program's use of Stack and Heap William Paul Berriss
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox