[Bug ada/26317] New: Accessing array embedded in a record with representation clause

ben dot midgley at ultra-datel dot com gcc-bugzilla@gcc.gnu.org
Thu Feb 16 12:29:00 GMT 2006


Bellow is the source code, command line and error report which I have come
accross. Tester is a nonsense package to demonstrate the problem, it appears
only to fail when reading the array value but when assigning to the array it
works fine. 

I have also seen this failure in version 3.4.2 (GNAT release) which is
considerably older. 

-- command line instructions and error report 

$ gcc -c tester.adb
+===========================GNAT BUG DETECTED==============================+
| 4.0.2 (i686-pc-cygwin) in expand_expr_addr_expr_1, at expr.c:6222        |
| Error detected at tester.adb:17:21                                       |
| 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.

tester.adb
tester.ads

compilation abandoned

-- tester.ads 

package tester is 

        -- declare a small array 

    subtype small_string_type is String (1 .. 3);           

    -- which becomes the componenet of a record 

    type some_string is                                     

        record                                              

            Trigram : small_string_type;                    

        end record;                                         

        -- add representation clause        

    for some_string use                                     

        record                                              

            Trigram at 0 range 20 .. 43;                    

        end record;                                         

        -- and define a constant                                                

                Null_Trigram : constant small_string_type := "   ";        

        -- obviously this code is a nonesense

        procedure scratch( some_string_instance : some_string );

end tester;

-- tester.adb

package body tester is 

        -- obviously this code is a nones

        procedure scratch( some_string_instance : some_string ) is

                Valid : Boolean ;                                          

                begin                                                      

            if some_string_instance.Trigram /= Null_Trigram then -- "   " 

                        Valid := true;                                          

                end if ; 

                end scratch;                                                 

end tester;                                               

-- gcc version information 

Using built-in specs.
Target: i686-pc-cygwin
Configured with: ../gcc-4.0.2/configure --enable-languages=ada
--disable-win32-registry
Thread model: single
gcc version 4.0.2


-- 
           Summary: Accessing array embedded in a record with representation
                    clause
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ben dot midgley at ultra-datel dot com
  GCC host triplet: i686-pc-cygwin


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



More information about the Gcc-bugs mailing list