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/30827] New: [Ada] GNAT.compiler_version problem for official releases?


The following prints some garbage characters for GCC 4.0.x and GCC 4.1.x on
x86-linux (for various x, I believe all official GCC releases are affected).

with Ada.Text_IO; use Ada.Text_IO;
with GNAT.compiler_version;
procedure P is
   package V is new GNAT.compiler_version;
begin
   Put_Line ("compiled with GNAT " & V.version);
end P;

Example of output:

compiled with GNAT GNAT Version:
4.1.2_ada_p�q՘y>�j�k���}��Kj

An extract of b~p.ads generated by the binder:

   GNAT_Version : constant String :=
                    "GNAT Version: 4.1.2";

And ada/g-comvers.adb expects a closing parenthese:

   function Version return String is
   begin
      --  Search for terminating right paren

      for J in Ver_Prefix'Length + 1 .. GNAT_Version'Last loop
         if GNAT_Version (J) = ')' then
            return GNAT_Version (Ver_Prefix'Length + 1 .. J);
         end if;
      end loop;

      --  This should not happen (no right paren found)

      return GNAT_Version;
   end Version;

We need a way to properly pass the length of the version string, any
suggestion?


-- 
           Summary: [Ada] GNAT.compiler_version problem for official
                    releases?
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: laurent at guerby dot net


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


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