Bug 29320 - [Ada] gnat1 segfault related to "use" representation clauses
Summary: [Ada] gnat1 segfault related to "use" representation clauses
Status: RESOLVED DUPLICATE of bug 24880
Alias: None
Product: gcc
Classification: Unclassified
Component: ada (show other bugs)
Version: 4.1.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2006-10-02 12:04 UTC by Markus Heichel
Modified: 2008-04-12 16:25 UTC (History)
3 users (show)

See Also:
Host: i686-pc-linux
Target: i686-pc-linux
Build: i686-pc-linux
Known to work:
Known to fail:
Last reconfirmed: 2006-10-04 17:56:47


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Heichel 2006-10-02 12:04:55 UTC
GCC seems to have more problems with "use" clauses (see also bug #26529).

gcc: Internal error: Segmentation fault (program gnat1)

The compiler has been compiled from source by:
> configure --prefix=/opt/gcc-4.1.1 --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 command.ads

The solution of the problem in this case is to use the correct range 0..6 for INFO_T.COMMAND_NAME, but gcc should have printed an error message instead of crashing, shouldn't it?

The compiler does not crash when size 8 is used for COMMAND_KIND_T, but how are the enum values represented in COMMAND_NAME in this case?

command.ads
=======================================================
package COMMAND is

   type COMMAND_KIND_T is (START, STOP);

   for COMMAND_KIND_T use (START => 80, STOP => 81);

   -- for COMMAND_KIND_T'size use 8; -- not crashing
   for COMMAND_KIND_T'size use 16;   -- crashing

   type SUB_COMMAND_KIND_T is new COMMAND_KIND_T range START..STOP;

   for SUB_COMMAND_KIND_T'size use 7;

   type INFO_T (COMMAND_NAME : SUB_COMMAND_KIND_T := START) is record
      case COMMAND_NAME is
         when others     => null;
      end case;
   end record;

   for INFO_T use record
      COMMAND_NAME       at 0 range 0..4;
   end record;

end COMMAND;
=======================================================
Comment 1 Laurent GUERBY 2006-10-04 17:56:47 UTC
Confirmed on 4.0.3, 4.1.1 and 4.2.0 (20060922) on x86_64-linux.
Comment 2 Samuel Tardieu 2008-04-12 16:25:09 UTC
Looks like it may be similar to bug #24880.

*** This bug has been marked as a duplicate of 24880 ***