This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug ada/39411] New: GNAT BUG DETECTED: implementation of protected interface by protected type


Hi Team,

I have 'GNAT BUG DETECTED' error message when I try to compile my project. I am
providing the more simple example of source code which will help to reproduce
the problem.

Please, advise

+===========================GNAT BUG DETECTED==============================+
| 4.3.2 (i386-portbld-freebsd7.0) Assert_Failure sinfo.adb:1079            |
| Error detected at sample.ads:29:5                                        |
| Please submit a bug report; see http://gcc.gnu.org/bugs.html.            |
| Use a subject line meaningful to you and us to track the bug.            |
| Include the entire contents of this bug box in the report.               |
| Include the exact gcc or gnatmake command that you entered.              |
| Also include sources listed below in gnatchop format                     |
| (concatenated together with no headers between files).                   |
+==========================================================================+

----------------------------------------------------------------------------
The gcc -v output:

Using built-in specs.
Target: i386-portbld-freebsd7.0
Configured with: ./..//gcc-4.3.2/configure --enable-languages=c,ada
--disable-nls --with-system-zlib --with-libiconv-prefix=/usr/local
--program-suffix=43 --bindir=/usr/local/bin/gcc43
--libdir=/usr/local/lib/gcc-4.3.2 --prefix=/usr/local --mandir=/usr/local/man
--infodir=/usr/local/info/gcc43 --build=i386-portbld-freebsd7.0
Thread model: posix
gcc version 4.3.2 (GCC)
----------------------------------------------------------------------------

The compilation command:

$ gnatmake -p -P sample.gpr

The source/project files:

-------------------------------- sample.ads ---------------------------------
--                                                                         --
--  Author: Andriy Bakay <andriy@irbisnet.com>                             --
--                                                                         --
--  Indent: 4                                                              --
--  Tabs:   no                                                             --
--                                                                         --
--  Copyright (c) Andriy Bakay. 2009                                       --
--      All rights reserved.                                               --
--                                                                         --
-----------------------------------------------------------------------------

package Sample is

    type Return_Code is mod 2 ** 32;

    type Interface_Type is protected interface;

    procedure Write(
        Inst    : in out Interface_Type;
        RC      :    out Return_Code;
        D       : in     Integer ) is abstract;

    function Read(
        Inst    : in Interface_Type;
        D       : not null access Integer )
        return       Return_Code is abstract;

    protected type Instance is new Interface_Type with

        overriding
        procedure Write(
            RC      :    out Return_Code;
            D       : in     Integer );

        overriding
        function Read(
            D       : not null access Integer )
            return    Return_Code;

    private

        Data    : Integer   := 0;

    end Instance;

end Sample;

-------------------------------- sample.ads ---------------------------------
-------------------------------- sample.adb ---------------------------------
--                                                                         --
--  Author: Andriy Bakay <andriy@irbisnet.com>                             --
--                                                                         --
--  Indent: 4                                                              --
--  Tabs:   no                                                             --
--                                                                         --
--  Copyright (c) Andriy Bakay. 2009                                       --
--      All rights reserved.                                               --
--                                                                         --
-----------------------------------------------------------------------------

package body Sample is

    protected body Instance is

        procedure Write(

            RC      :    out Return_Code;
            D       : in     Integer )

        is

        begin
            RC      := 0;

            Data    := D;
        end Write;

        function Read(

            D       : not null access Integer )
            return    Return_Code

        is

        begin
            D.all   := Data;
            return 0;
        end Read;

    end Instance;

end Sample;

-------------------------------- sample.adb ---------------------------------
-------------------------------- common.gpr ---------------------------------
--                                                                         --
--  Author: Andriy Bakay <andriy@irbisnet.com>                             --
--                                                                         --
--  Indent: 4                                                              --
--  Tabs:   no                                                             --
--                                                                         --
--  Copyright (c) Andriy Bakay. 2009                                       --
--      All rights reserved.                                               --
--                                                                         --
-----------------------------------------------------------------------------

project Common is

    type Config_Type is ( "debug", "release" );
    type Lib_Kind is ( "static", "relocatable" );

    Config      : Config_Type   := external( "CONFIG", "debug" );
    Lib_Type    : Lib_Kind      := external( "LIB_TYPE", "static" );
    OS_Name                     := external( "OS_NAME" );
    OS_Version                  := external( "OS_VERSION" );
    Comp_Name                   := external( "COMPILER_NAME" );
    Root_Dir                    := external( "ROOT_DIR" );
    Build_Root                  := external( "BUILD_ROOT" );

    Bld_Dir                     := Root_Dir & "/" &
                                   Build_Root & "/" &
                                   OS_Name & "_" & OS_Version & "/" &
                                   Comp_Name & "/" &
                                   Config;
    Obj_Dir                     := Bld_Dir & "/obj/";
    Lib_Dir                     := Bld_Dir & "/lib";
    Bin_Dir                     := Bld_Dir & "/bin";

    for Source_Dirs use ();

    Comm_Flags                  := ();
    Comp_Flags                  := ( "-Wall", "-gnato", "-gnatwa", "-gnatwl" );

    case Config is
        when "debug"    =>
            Comm_Flags          := Comm_Flags & "-g";
            Comp_Flags          := Comp_Flags & "-O0";
        when "release"  =>
            Comp_Flags          := Comp_Flags & "-O2";
    end case;

    package Builder is
        for Default_Switches( "Ada" ) use ( "-s" );
    end Builder;

    package Compiler is
        for Default_Switches( "Ada" ) use Comm_Flags & Comp_Flags;
    end Compiler;

    package Linker is
        for Default_Switches( "Ada" ) use Comm_Flags;
    end Linker;

end Common;

-------------------------------- common.gpr ---------------------------------
-------------------------------- sample.gpr ---------------------------------
--                                                                         --
--  Author: Andriy Bakay <andriy@irbisnet.com>                             --
--                                                                         --
--  Indent: 4                                                              --
--  Tabs:   no                                                             --
--                                                                         --
--  Copyright (c) Andriy Bakay. 2009                                       --
--      All rights reserved.                                               --
--                                                                         --
-----------------------------------------------------------------------------

with "common.gpr";

project Sample is

    Lib_Name    := "irsample";
    Lib_Ver     := "1.0";

    for Object_Dir use Common.Obj_Dir & Lib_Name;
    for Library_Dir use Common.Lib_Dir;
    for Library_Name use Lib_Name;
    for Library_Kind use Common.Lib_Type;
    for Library_Version use "lib" & Lib_Name & ".so." & Lib_Ver;

    package Builder renames Common.Builder;
    package Compiler renames Common.Compiler;
    package Linker renames Common.Linker;

end Sample;

-------------------------------- sample.gpr ---------------------------------


-- 
           Summary: GNAT BUG DETECTED: implementation of protected interface
                    by protected type
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Severity: blocker
          Priority: P3
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: andriy at irbisnet dot com
 GCC build triplet: i386-portbld-freebsd7.0
  GCC host triplet: i386-portbld-freebsd7.0
GCC target triplet: i386-portbld-freebsd7.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39411


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]