최근 GCC 버전 (4.8.2 - 5.3.0)을 업데이트하고 일부 Ada 응용 프로그램에서 예상치 못한 제약 조건 오류가 발생하기 시작했습니다. 나는 다음에 감소했습니다GCC 업데이트 후 예기치 않은 CONSTRAINT_ERROR
-- moo.adb
with text_io;
procedure moo is
type thing_type is (something1,something2,something3,something4,something5,something6);
for thing_type use (something1 => 1,something2 => 2,something3 =>
3,something4 => 4,something5 => 5,something6 => 6);
for thing_type'size use 32;
type thing_array_t is array (0 .. 5) of thing_type;
thing_array : thing_array_t := (others => something1);
begin
text_io.put_line("item 0 = " & thing_type'image(thing_array(0)));
end moo;
이 프로그램은 4.8.2로 구축 할 때, 출력이 예상대로 (. 단순히 "gnatmake moo.adb"컴파일) GCC 버전 중 하나에 잘 컴파일 : 5.0.3 빌드 할 때
item 0 = SOMETHING1
, 우리는 대신 32 비트 및 64 비트 컴파일 할 때
raised CONSTRAINT_ERROR : moo.adb:13 invalid data
는 흥미롭게도, 결과는 정확히 동일받을 수 있습니다. thing_type'size 절을 제거하거나, 열거 자에 값을 추가하거나 제거하거나, 배열의 항목 수를 변경하거나, 배열을 초기화하는 데 다른 값을 사용하는 등 많은 것들이 변경 될 수 있습니다. 이 문제를 설명 할 수있는이 코드에 명백한 문제가 있습니까?
입니까? (귀하의 목록에만 12 행만 있습니다.) –
죄송합니다. 붙여 넣을 때 원본에서 빈 줄을 제거했습니다. 13 행은 text_io 행입니다. – Kevin