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

             Bug #: 50294
           Summary: ICE in output_constructor_regular_field, at
                    varasm.c:4751
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code, wrong-code
          Severity: normal
          Priority: P3
         Component: ada
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: rgue...@gcc.gnu.org
                CC: ebotca...@gcc.gnu.org


A modified gnat.dg/loop_optimization3.adb, like below

-- { dg-do run }
-- { dg-options "-O" }

with Loop_Optimization3_Pkg; use Loop_Optimization3_Pkg;

procedure Loop_Optimization3 is

  type Unsigned_64_T is mod 2 ** 64;
  type Arr is array (Unsigned_64_T range 9223372036854775805 ..
9223372036854775811) of Integer;
  C : constant Arr := (1, others => F(2));

begin
  if C /= (1, 2, 2, 2, 2, 2, 2) then
    raise Program_Error;
  end if;
end;

ICEs like

> ./gnat1 -quiet loop_optimization3.adb 
loop_optimization3.adb:10:03: warning: "Storage_Error" will be raised at run
time
+===========================GNAT BUG DETECTED==============================+
| 4.7.0 20110905 (experimental) (x86_64-unknown-linux-gnu) GCC error:      |
| in output_constructor_regular_field, at varasm.c:4751                    |
| Error detected around loop_optimization3.adb:16:4                        |
| Please submit a bug report; see http://gcc.gnu.org/bugs.html.            |
| Use a subject line meaningful to you and us to track the bug.            |
| 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).                   |
+==========================================================================+


The program should either be rejected or should not ICE.

Emitting Storage_Error at runtime sounds odd as well for an array with
7 elements.  Thus, if the ICE is fixed the program will fail at runtime.


I run into exactly the same situation (well, not the ICE but the
Storage_Error) with the sizetype no-longer sign-extends for the
original loop_optimization3.adb testcase.

Thus the question - what should stor-layout do with domain types
that wrap the wrong way around (i.e. are of wrong type because Ada
turns everything into sizetype instead of [s]sizetype dependent on
the Ada type "signedness")?

Reply via email to