This program, when compiled with Gnat 3.3.2 and run on Fedora Core 1, raises Storage_Error on line 7 (because of a segmentation fault): procedure Null_Slice_Error is -- 1 -- 2 procedure Proc (NullS : String) is -- 3 type SA is access String; -- 4 Point : SA := new String (1 .. 0); -- 5 begin -- 6 Point.all := NullS; -- 7 end Proc; -- 8 -- 9 S : String := "s"; -- 10 begin -- 11 Proc(S(3 .. 1)); -- 12 end Null_Slice_Error; -- 13 If I change 3 to 2 on line 12 there is no error. $ gnatmake null_slice_error gcc -c null_slice_error.adb gnatbind -x null_slice_error.ali gnatlink null_slice_error.ali $ ./null_slice_error raised STORAGE_ERROR : stack overflow (or erroneous memory access) $ gcc -v Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.3.2/specs Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux Thread model: posix gcc version 3.3.2 20031022 (Red Hat Linux 3.3.2-1) I have been told that the same bug occurs in Gnat 3.3.3 on Debian, but not in GCC 3.1 (1252) on Mac OS X and not in Gnat 3.15p on an unspecified OS. I tried to check with the 3.4-20040310 snapshot, but I had to give up on that. Sorry.
Subject: Re: New: Storage_Error on null slice, might be a regression. Forwarded comments from comp.lang.ada: Manuel Collado wrote: > I've reproduced the bug with the DJGPP port of gcc 3.3.3 > > F:\PRUEBAS\ADA>gcc --version > gcc.exe (GCC) 3.3.3 > Copyright (C) 2003 Free Software Foundation, Inc. > This is free software; see the source for copying conditions. There is NO > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. > > F:\PRUEBAS\ADA>gnatmake null_slice_error > gcc -c null_slice_error.adb > null_slice_error.adb:1:11: warning: file name does not match unit name, > should be "nuslierr.adb" > gnatbind -x null_slice_error.ali > gnatlink null_slice_error.ali > > F:\PRUEBAS\ADA>F:\PRUEBAS\ADA\null_slice_error.exe > Exiting due to signal SIGSEGV > General Protection Fault at eip=000018fa > .... Florian Villoing wrote: > It seems to be OK on FreeBSD 5.2 with gcc-3.4 compiled from sources : > > villoing:~/test$ gcc -v > Reading specs from /usr/home/villoing/install/gcc/bin/../lib/gcc/i386-unknown-freebsd5.2/3.4.0/specs > Configured with: ../gcc/configure --prefix=/home/villoing/install/gcc > --disable-shared --with-libiconv-prefix=/usr/local/lib > --disable-werror --enable-languages=c,ada > Thread model: posix > gcc version 3.4.0 20040305 (prerelease) > > > > villoing:~/test$ gnatmake -f -gnatv error.adb > gcc -c -gnatv error.adb > > GNAT 3.4.0 20040305 (prerelease) Copyright 1992-2004 Free Software > Foundation, Inc. > > Compiling: error.adb (source file time stamp: 2004-03-12 16:11:18) > 15 lines: No errors > gnatbind -x error.ali > gnatlink error.ali > > > > villoing:~/test$ ./error > villoing:~/test
Ada bugs which are fixed in 3.4.0 are not going to be fixed in 3.3.4 so closing.