From: Per Sandberg <per.sandberg@bredband.net>
To: skidmarks <aschwarz@acm.org>
Cc: comp.lang.ada@ada-france.org
Subject: Re: String Pointer Bug
Date: Thu, 04 Nov 2004 07:18:35 +0100
Date: 2004-11-04T07:18:35+01:00 [thread overview]
Message-ID: <mailman.78.1099549167.10401.comp.lang.ada@ada-france.org> (raw)
In-Reply-To: <35f054ea.0411021132.6b03488@posting.google.com>
Running GNAT Pro 5.03w (20041005-34)/ gcc-3.4.3 i get exactly the same
messages as "compiler"
/Per
skidmarks wrote:
>(Program below): The same code fragment was run on two different
>compilers, GNAT and another commercial vendor, 'compiler. The results
>are inconsistent and I don't believe that both sets of errors can be
>correct. Before I scream and holler, I wonder if there are wiser heads
>who can provide insight into which (if any) compiler version is
>incorrect.
>
>The summary is that a pointer to a definite type and a pointer to an
>indefinite typed value have different constraints, detected and
>reported. I would assume that compliant compilers would complain
>similarly.
>
>Thanks
>
>art
>------------------------------ C O D E ------------------------------
>
>procedure Bug is
>
> type String_Ptr is access all String;
>
> subtype Str_Ptr is String_Ptr( 1 .. 12 );
>
> type String_Array is array( 1 .. 68 ) of aliased String( 1 .. 12
>);
>
> Input : String_Array := ( others => (others => ' ') );
> StrArray : array( 1 .. 68 ) of aliased String( 1 .. 12 );
> Strng : aliased String := "one two three";
> -- GNAT warning not issued by Compiler
> -- >>> warning: aliased object has explicit bounds
> -- >>> warning: declare without bounds (and with explicit
>initialization)
> -- >>> warning: for use with unconstrained access
> Str : String_Ptr;
> Str_Def : Str_Ptr;
>
> -- Compiler Diagnostic Message
> -- LRM:3.10.2(27) The nominal subtype of the prefix to 'ACCESS or
> -- 'UNCHECKED_ACCESS must either statically match
> -- the expected type or the designated subtype must
>be
> -- discriminated and unconstrained
>
> -- GNAT (gcc-3.3.1 & gcc-3.3.3)
> -- object subtype must statically match designated subtype
>
> -- Error Messages (See above)
>begin -- Bug GNAT COMPILER
> Str := Input(1)'Access; -- X X
> Str := StrArray(1)'Access; -- X X
> Str := Strng'Access;
>
> Str_Def := Input(1)'Access; -- X
> Str_Def := StrArray(1)'Access; -- X
> Str_Def := Strng'Access; -- X
>end Bug;
>_______________________________________________
>comp.lang.ada mailing list
>comp.lang.ada@ada-france.org
>http://www.ada-france.org/mailman/listinfo/comp.lang.ada
>
>
>
next prev parent reply other threads:[~2004-11-04 6:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-02 19:32 String Pointer Bug skidmarks
2004-11-04 6:18 ` Per Sandberg [this message]
-- strict thread matches above, loose matches on Subject: below --
2004-11-08 13:34 Christoph Karl Walter Grein
2004-11-09 16:47 ` skidmarks
2004-11-09 19:35 ` Martin Krischik
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox