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/26529] New: Compiler crash when 'use' clause for ADA record is defined


When moving from gcc 3.4.3 to 4.1.0, I found a record definition, that causes a
compiler crash:

4.1.0 (i686-pc-linux-gnu) in get_memory_rtx, at builtins.c:1086
raised TYPES.UNRECOVERABLE_ERROR : comperr.adb:380

The compiler has been compiled from source without any special settings, i.e.

> configure --prefix=/opt/gcc-4.1.0 --enable-languages=ada,c
> make bootstrap
> make install

The problem can be reproduced by compiling the source file below, using the
following command line:

gcc -c -O data.ads

When the marked use clause is removed, gcc 4.1.0 does not crash. This
simplified example is also compiling, when the -O is omitted, however this did
not help in the original context.

data.ads:
==========================================================================
package DATA is

   type UNSIGNED_8  is new INTEGER range 0 .. (2 ** 8)  - 1;
   for  UNSIGNED_8'SIZE use 8;

   type UNSIGNED_16 is new INTEGER range 0 .. (2 ** 16) - 1;
   for  UNSIGNED_16'SIZE use 16;

   type ADDRESS_T is array (1 .. 4) of UNSIGNED_8;

   type IPM_PROTOCOL_CHARACTERISTICS_T is record
      IPM_SOCKET_1_AVAILABLE           : BOOLEAN;
      IPM_SOCKET_2_AVAILABLE           : BOOLEAN;
      IPM_SOCKET_3_AVAILABLE           : BOOLEAN;
      IPM_SOCKET_4_AVAILABLE           : BOOLEAN;
      IPM_PORT_1                       : UNSIGNED_16;
      IPM_PORT_2                       : UNSIGNED_16;
      IPM_PORT_3                       : UNSIGNED_16;
      IPM_PORT_4                       : UNSIGNED_16;
      IPM_ADDRESS_1                    : ADDRESS_T;
      IPM_ADDRESS_2                    : ADDRESS_T;
      IPM_ADDRESS_3                    : ADDRESS_T;
      IPM_ADDRESS_4                    : ADDRESS_T;
   end record;

   for IPM_PROTOCOL_CHARACTERISTICS_T use record
      IPM_ADDRESS_1          at  0 range 0 .. 4 * 8 - 1;
      IPM_ADDRESS_2          at  4 range 0 .. 4 * 8 - 1;
      IPM_ADDRESS_3          at  8 range 0 .. 4 * 8 - 1;
      IPM_ADDRESS_4          at 12 range 0 .. 4 * 8 - 1;
      IPM_PORT_1             at 16 range 0 .. 2 * 8 - 1;
      IPM_PORT_2             at 18 range 0 .. 2 * 8 - 1;
      IPM_PORT_3             at 20 range 0 .. 2 * 8 - 1;
      IPM_PORT_4             at 22 range 0 .. 2 * 8 - 1;
      IPM_SOCKET_1_AVAILABLE at 24 range 0 .. 1 * 8 - 1;
      IPM_SOCKET_2_AVAILABLE at 25 range 0 .. 1 * 8 - 1;
      IPM_SOCKET_3_AVAILABLE at 26 range 0 .. 1 * 8 - 1;
      IPM_SOCKET_4_AVAILABLE at 27 range 0 .. 1 * 8 - 1;
   end record;

   for IPM_PROTOCOL_CHARACTERISTICS_T'Size use 28 * 8;

   type PROTOCOL_T is (LLC, IPM);

   for PROTOCOL_T use ( LLC  => 1, IPM  => 2 );

   type PROTOCOL_CHARACTERISTICS_T (PROTOCOL : PROTOCOL_T := IPM) is record
      case PROTOCOL is
         when LLC =>
            SAP_NUMBER          : STRING(1 .. 3);
            MULTICAST_ADDRESS_1 : STRING(1 .. 14);
            MULTICAST_ADDRESS_2 : STRING(1 .. 14);
         when IPM      =>
            IPM_PROTOCOL_CHARACTERISTICS : IPM_PROTOCOL_CHARACTERISTICS_T;
      end case;
   end record;

   for PROTOCOL_CHARACTERISTICS_T use record
      PROTOCOL                          at 0          range 0 ..  7;
      SAP_NUMBER                        at 2          range 0 ..  3 * 8 - 1;
      MULTICAST_ADDRESS_1               at 2 + 3      range 0 .. 14 * 8 - 1;
      MULTICAST_ADDRESS_2               at 2 + 3 + 14 range 0 .. 14 * 8 - 1;
      IPM_PROTOCOL_CHARACTERISTICS      at 2          range 0 .. 28 * 8 - 1;
   end record;

   type DATA_T is record
      PROTOCOL_CHARACTERISTICS : PROTOCOL_CHARACTERISTICS_T;
   end record;

   -- Disable this use clause to get it compiled
   for DATA_T use record
      PROTOCOL_CHARACTERISTICS at 0 range 0 .. 33 * 8 - 1;
   end record;

end DATA;
==========================================================================


-- 
           Summary: Compiler crash when 'use' clause for ADA record is
                    defined
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: markus dot heichel at comsoft dot de
  GCC host triplet: i686-pc-linux-gnu


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


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