comp.lang.ada
 help / color / mirror / Atom feed
* Abstract Interface - Assertion Error
@ 2007-10-18 18:03 Mike.McNett
  2007-10-18 22:48 ` Georg Bauhaus
  0 siblings, 1 reply; 10+ messages in thread
From: Mike.McNett @ 2007-10-18 18:03 UTC (permalink / raw)


I am having a problem with creating one Interface, then an Abstract
type that implements that interface, and a concrete type from the
Abstract one.  When I don't use the interface, all is good.  When the
Abstract type is based on the Interface Type, however, I get a
"System.Assertions.Assert_Failur" runtime exception.  Here's the basic
code:

In Graph_Interface package, I define Type Graph_Interface_Type is
Interface;

In Abstract_Graph package, I define Type Abstract_Graph_Type is
ABSTRACT NEW Graph_Interface.Graph_Interface_Type with Private;

In my Matrix_Graph package, I define Type Matrix_Graph_Type is new
Abstract_Graph_Type With Private;

Using the above, everything compiles but I get the assertion error.
When I change the Abstract_Graph_Type so that it is just Abstract and
doesn't implement the interface, all is good.

Any ideas / thoughts?

Thanks,
Mike




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Abstract Interface - Assertion Error
  2007-10-18 18:03 Abstract Interface - Assertion Error Mike.McNett
@ 2007-10-18 22:48 ` Georg Bauhaus
  2007-10-19 10:52   ` Mike.McNett
  0 siblings, 1 reply; 10+ messages in thread
From: Georg Bauhaus @ 2007-10-18 22:48 UTC (permalink / raw)



On Thu, 2007-10-18 at 11:03 -0700, Mike.McNett wrote:
> I am having a problem with creating one Interface, then an Abstract
> type that implements that interface, and a concrete type from the
> Abstract one.  When I don't use the interface, all is good.  When the
> Abstract type is based on the Interface Type, however, I get a
> "System.Assertions.Assert_Failur" runtime exception.  Here's the basic
> code:
> 
> In Graph_Interface package, I define Type Graph_Interface_Type is
> Interface;
> 
> In Abstract_Graph package, I define Type Abstract_Graph_Type is
> ABSTRACT NEW Graph_Interface.Graph_Interface_Type with Private;
> 
> In my Matrix_Graph package, I define Type Matrix_Graph_Type is new
> Abstract_Graph_Type With Private;
> 
> Using the above, everything compiles but I get the assertion error.
> When I change the Abstract_Graph_Type so that it is just Abstract and
> doesn't implement the interface, all is good.
> 
> Any ideas / thoughts?
> 
> Thanks,
> Mike
> 

Trying to construe sources as good I can from your hints, I get

georg@K72:~/News$ gnatmake -v -gnat05 graph_interface.ads 

GNATMAKE 4.1.320070929prerelease (Ubuntu 4.1.2-16ubuntu3)
Copyright 1995-2004 Free Software Foundation, Inc.
  "graph_interface.ali" being checked ...
  -> "graph_interface.ali" missing.
gcc-4.1 -c -gnat05 graph_interface.ads
End of compilation
georg@K72:~/News$ rm *.ali
georg@K72:~/News$ gnatmake -v -gnat05 matrix_graph.ads 

GNATMAKE 4.1.320070929prerelease (Ubuntu 4.1.2-16ubuntu3)
Copyright 1995-2004 Free Software Foundation, Inc.
  "matrix_graph.ali" being checked ...
  -> "matrix_graph.ali" missing.
gcc-4.1 -c -gnat05 matrix_graph.ads
  "abstract_graph.ali" being checked ...
  -> "abstract_graph.ali" missing.
gcc-4.1 -c -gnat05 abstract_graph.ads
  "graph_interface.ali" being checked ...
  -> "graph_interface.ali" missing.
gcc-4.1 -c -gnat05 graph_interface.ads
End of compilation

Which compiler/version are you using?





^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Abstract Interface - Assertion Error
  2007-10-18 22:48 ` Georg Bauhaus
@ 2007-10-19 10:52   ` Mike.McNett
  2007-10-19 10:54     ` Mike.McNett
  0 siblings, 1 reply; 10+ messages in thread
From: Mike.McNett @ 2007-10-19 10:52 UTC (permalink / raw)


On Oct 18, 6:48 pm, Georg Bauhaus <rm.tsoh+bauh...@maps.futureapps.de>
wrote:
> On Thu, 2007-10-18 at 11:03 -0700, Mike.McNett wrote:
> > I am having a problem with creating one Interface, then an Abstract
> > type that implements that interface, and a concrete type from the
> > Abstract one.  When I don't use the interface, all is good.  When the
> > Abstract type is based on the Interface Type, however, I get a
> > "System.Assertions.Assert_Failur" runtime exception.  Here's the basic
> > code:
>
> > In Graph_Interface package, I define Type Graph_Interface_Type is
> > Interface;
>
> > In Abstract_Graph package, I define Type Abstract_Graph_Type is
> > ABSTRACT NEW Graph_Interface.Graph_Interface_Type with Private;
>
> > In my Matrix_Graph package, I define Type Matrix_Graph_Type is new
> > Abstract_Graph_Type With Private;
>
> > Using the above, everything compiles but I get the assertion error.
> > When I change the Abstract_Graph_Type so that it is just Abstract and
> > doesn't implement the interface, all is good.
>
> > Any ideas / thoughts?
>
> > Thanks,
> > Mike
>
> Trying to construe sources as good I can from your hints, I get
>
> georg@K72:~/News$ gnatmake -v -gnat05 graph_interface.ads
>
> Which compiler/version are you using?- Hide quoted text -
>

We are running 3.4.6 for GNAT GPL 2006.

Mike





^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Abstract Interface - Assertion Error
  2007-10-19 10:52   ` Mike.McNett
@ 2007-10-19 10:54     ` Mike.McNett
  2007-10-19 17:46       ` Georg Bauhaus
  0 siblings, 1 reply; 10+ messages in thread
From: Mike.McNett @ 2007-10-19 10:54 UTC (permalink / raw)



> > Which compiler/version are you using?- Hide quoted text -
>
> We are running 3.4.6 for GNAT GPL 2006.
>
> Mike- Hide quoted text -
>
> - Show quoted text -

And that's on Linux.
Mike




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Abstract Interface - Assertion Error
  2007-10-19 10:54     ` Mike.McNett
@ 2007-10-19 17:46       ` Georg Bauhaus
  2007-10-19 19:28         ` Mike.McNett
  2007-10-19 19:45         ` Mike.McNett
  0 siblings, 2 replies; 10+ messages in thread
From: Georg Bauhaus @ 2007-10-19 17:46 UTC (permalink / raw)


Mike.McNett wrote:
>>> Which compiler/version are you using?- Hide quoted text -
>> We are running 3.4.6 for GNAT GPL 2006.

> And that's on Linux.

With assertions enabled, nothing unusual is produced by

with Matrix_Graph;

procedure test_iface is
    X: Matrix_Graph.Matrix_Graph_Type;
begin
    null;
end;

using the most recent GNAT GPL 2007-1 (Windows, this time).
Does the Assert_Failure message point anywhere? To the
runtime, or some line number?

IIRC, the 2006 edition did have some support for Ada 2005,
but wasn't fully supporting the new language yet. Perhaps a
more recent compiler is worth a try.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Abstract Interface - Assertion Error
  2007-10-19 17:46       ` Georg Bauhaus
@ 2007-10-19 19:28         ` Mike.McNett
  2007-10-19 19:45         ` Mike.McNett
  1 sibling, 0 replies; 10+ messages in thread
From: Mike.McNett @ 2007-10-19 19:28 UTC (permalink / raw)


On Oct 19, 1:46 pm, Georg Bauhaus <rm.tsoh+bauh...@maps.futureapps.de>
wrote:
> Mike.McNett wrote:
> >>> Which compiler/version are you using?- Hide quoted text -
> >> We are running 3.4.6 for GNAT GPL 2006.
> > And that's on Linux.
>
> With assertions enabled, nothing unusual is produced by
>
> with Matrix_Graph;
>
> procedure test_iface is
>     X: Matrix_Graph.Matrix_Graph_Type;
> begin
>     null;
> end;
>
> using the most recent GNAT GPL 2007-1 (Windows, this time).
> Does the Assert_Failure message point anywhere? To the
> runtime, or some line number?
>
> IIRC, the 2006 edition did have some support for Ada 2005,
> but wasn't fully supporting the new language yet. Perhaps a
> more recent compiler is worth a try.

Well... this certainly is odd.

When I enable assertions and build my files.  I get the assertion
error.  When I turn OFF assertions and rebuild everything, making no
other changes, the program runs fine.  When I turn them back ON and
rebuild, I get the assertion error.  The assertion error is at s-
assert.adb:44 ("s-assert.adb: No such file or directory. in s-
assert.adb").

This occurs on the line immediately preceding the "Package
Abstract_Graph is ..." where I have the "With Graph_Interface;" at.

So, what do you think?

Mike




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Abstract Interface - Assertion Error
  2007-10-19 17:46       ` Georg Bauhaus
  2007-10-19 19:28         ` Mike.McNett
@ 2007-10-19 19:45         ` Mike.McNett
  2007-10-22 17:02           ` Georg Bauhaus
  1 sibling, 1 reply; 10+ messages in thread
From: Mike.McNett @ 2007-10-19 19:45 UTC (permalink / raw)


On Oct 19, 1:46 pm, Georg Bauhaus <rm.tsoh+bauh...@maps.futureapps.de>
wrote:
> Mike.McNett wrote:
> >>> Which compiler/version are you using?- Hide quoted text -
> >> We are running 3.4.6 for GNAT GPL 2006.
> > And that's on Linux.
>
> With assertions enabled, nothing unusual is produced by
>
> with Matrix_Graph;
>
> procedure test_iface is
>     X: Matrix_Graph.Matrix_Graph_Type;
> begin
>     null;
> end;
>
> using the most recent GNAT GPL 2007-1 (Windows, this time).
> Does the Assert_Failure message point anywhere? To the
> runtime, or some line number?
>
> IIRC, the 2006 edition did have some support for Ada 2005,
> but wasn't fully supporting the new language yet. Perhaps a
> more recent compiler is worth a try.

This is rather odd....

When I build the project with Assertions enabled, I get an assertion
error.  If I turn off the Assertions and rebuild all, I don't get the
assertion error and everything runs as expected.  When I re-enable
Assertions and rebuild, the assertion error comes back.

The assertion I get (shown in the debugger) is:
... in system.assertions.raise_assert_failure (msg=(null)) at s-
assert.adb:44
44      s-assert.adb: No such file or directory.
        in s-assert.adb

>From what I can tell, it seems like it's a bug in gcc.  What do you
think?

Mike




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Abstract Interface - Assertion Error
  2007-10-19 19:45         ` Mike.McNett
@ 2007-10-22 17:02           ` Georg Bauhaus
  2007-10-22 18:07             ` Georg Bauhaus
  2007-10-23 19:18             ` Simon Wright
  0 siblings, 2 replies; 10+ messages in thread
From: Georg Bauhaus @ 2007-10-22 17:02 UTC (permalink / raw)


On Fri, 2007-10-19 at 12:45 -0700, Mike.McNett wrote:

> When I build the project with Assertions enabled, I get an assertion
> error.  If I turn off the Assertions and rebuild all, I don't get the
> assertion error and everything runs as expected.  When I re-enable
> Assertions and rebuild, the assertion error comes back.
> 
> The assertion I get (shown in the debugger) is:
> ... in system.assertions.raise_assert_failure (msg=(null)) at s-
> assert.adb:44
> 44      s-assert.adb: No such file or directory.

(Adding the GNAT source directory (gcc/..../adainclude/)
to GDBs search path should make the location be known to it.)

>         in s-assert.adb
> 

The next best thing to do that I can think of (other than asking
the library producers if this is a bug) is to try tracing
this. E.g., using a dummy program main_unit that will deliberately
trigger an exception in library code,

$ gnatmake -s -a -g -gnata main_unit.adb -bargs -E

$ ./main_unit
Execution terminated by unhandled exception
Exception name: PROGRAM_ERROR
Message: a-cohama.adb:198 explicit raise
Call stack traceback locations:
0x805f4bc 0x805d03b 0x805df9a 0x805cfa4 0x80498ca 0xb7e25eba

$  addr2line -e trigger_af 0x805f4bc 0x805d03b 0x805df9a \
	0x805cfa4 0x80498ca 0xb7e25eba






^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Abstract Interface - Assertion Error
  2007-10-22 17:02           ` Georg Bauhaus
@ 2007-10-22 18:07             ` Georg Bauhaus
  2007-10-23 19:18             ` Simon Wright
  1 sibling, 0 replies; 10+ messages in thread
From: Georg Bauhaus @ 2007-10-22 18:07 UTC (permalink / raw)


On Mon, 2007-10-22 at 19:02 +0200, Georg Bauhaus wrote:

> $  addr2line -e trigger_af 0x805f4bc 0x805d03b 0x805df9a \
                  main_unit
> 	0x805cfa4 0x80498ca 0xb7e25eba





^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Abstract Interface - Assertion Error
  2007-10-22 17:02           ` Georg Bauhaus
  2007-10-22 18:07             ` Georg Bauhaus
@ 2007-10-23 19:18             ` Simon Wright
  1 sibling, 0 replies; 10+ messages in thread
From: Simon Wright @ 2007-10-23 19:18 UTC (permalink / raw)


Georg Bauhaus <rm.tsoh+bauhaus@maps.futureapps.de> writes:

> On Fri, 2007-10-19 at 12:45 -0700, Mike.McNett wrote:

>> The assertion I get (shown in the debugger) is:
>> ... in system.assertions.raise_assert_failure (msg=(null)) at s-
>> assert.adb:44
>> 44      s-assert.adb: No such file or directory.
>
> (Adding the GNAT source directory (gcc/..../adainclude/)
> to GDBs search path should make the location be known to it.)

It doesn't really matter about s-assert.adb; you're actually
interested in the frame above. In gdb, 'up'. This should take you to
the place where the compiler has inserted a call to
raise_assert_failure -- probably as a result of a pragma Assert?



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2007-10-23 19:18 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-18 18:03 Abstract Interface - Assertion Error Mike.McNett
2007-10-18 22:48 ` Georg Bauhaus
2007-10-19 10:52   ` Mike.McNett
2007-10-19 10:54     ` Mike.McNett
2007-10-19 17:46       ` Georg Bauhaus
2007-10-19 19:28         ` Mike.McNett
2007-10-19 19:45         ` Mike.McNett
2007-10-22 17:02           ` Georg Bauhaus
2007-10-22 18:07             ` Georg Bauhaus
2007-10-23 19:18             ` Simon Wright

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