[EMAIL PROTECTED] simplify-rtx]$ gcc -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-languages=c,c++,objc,java,f95,ada
--enable-java-awt=gtk --host=x86_64-redhat-linux
Thread model: posix
gcc version 4.0.0 20050314 (Red Hat 4.0.0-0.34)
[EMAIL PROTECTED] simplify-rtx]$ gcc -c bug.adb
+===========================GNAT BUG DETECTED==============================+
| 4.0.0 20050314 (Red Hat 4.0.0-0.34) (x86_64-redhat-linux-gnu) GCC error: |
| in simplify_subreg, at simplify-rtx.c:3671                               |
| Error detected at bug.adb:6:14                                           |
| Please submit a bug report; see http://gcc.gnu.org/bugs.html.            |
| 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).                   |
+==========================================================================+

Please include these source files with error report
Note that list may not be accurate in some cases, 
so please double check that the problem can still 
be reproduced with the set of files listed.

bug.adb
bug.ads

bug.adb:4:07: warning: "Result" is never assigned a value
compilation abandoned
[EMAIL PROTECTED] simplify-rtx]$ 

-- bug.ads and bug.adb are as follows

package Bug is

   type Record_Type (Class : Boolean := False) is
      record
         case Class is
            when False =>
               null;
            when True =>
               Kind : Integer;
         end case;
      end record;

   function To_Record (Item : String) return Record_Type;

end Bug;

package body Bug is

   function To_Record (Item : String) return Record_Type is
      Result : Record_Type (True);
   begin
      return Result;
   end To_Record;

end Bug;


--  Note: bug box only comes up if Record_Type has a default discriminant, and
one of the sizes is zero, and the return statement returns a variable that
specifies the value of th discriminant.

--  This is on a Fedore Core 3 x86_64 installation, upgraded via RPM to 
gcc-4.0.0

-- 
           Summary: returning record type with a default discriminant causes
                    gnat bug box
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fraser at blancolioni dot org
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: x86_64-redhat-linux
GCC target triplet: x86_64-redhat-linux


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

Reply via email to