------- Comment #1 from laurent at guerby dot net  2008-11-17 19:17 -------
Reduced testcase from cxa4016 at rev 141913:

$ gnatmake -f -g t1
gcc -c -g t1.adb
gnatbind -x t1.ali
gnatlink t1.ali -g
$ ./t1
Erreur de segmentation
$ gdb ./t1
(gdb) r
Starting program: /home/guerby/tmp/t1 

Program received signal SIGSEGV, Segmentation fault.
uw_update_context_1 (context=0xff8e8fc8, fs=0xff8e8c60) at
../../../trunk/libgcc/../gcc/unwind-dw2.c:177
177         return * (_Unwind_Ptr *) ptr;
Current language:  auto; currently c
(gdb) bt
#0  uw_update_context_1 (context=0xff8e8fc8, fs=0xff8e8c60) at
../../../trunk/libgcc/../gcc/unwind-dw2.c:177
#1  0x00026310 in uw_update_context (context=0xff8e8fc8, fs=0xff8e8c60) at
../../../trunk/libgcc/../gcc/unwind-dw2.c:1388
#2  0x00027378 in _Unwind_RaiseException (exc=0x48010) at
../../../trunk/libgcc/../gcc/unwind.inc:127
#3  0x00020450 in ada.exceptions.exception_propagation.propagate_exception
(e=0x4276c, from_signal_handler=false) at a-exexpr.adb:589
#4  0x000211c0 in <__gnat_raise_nodefer_with_msg> (e=0x4276c) at
a-except.adb:829
#5  0x0002125c in <__gnat_raise_exception> (e=0x4276c, message={P_ARRAY =
0xff8e8b80, P_BOUNDS = 0x29778}) at a-except.adb:868
#6  0x0001352c in ada.strings.wide_fixed.replace_slice (source={P_ARRAY =
0xff8e9774, P_BOUNDS = 0xff8e96e0}, low=12, high=10, by={P_ARRAY = 0x292f0,
P_BOUNDS = 0xff8e96d8}) at a-stwifi.adb:447
#7  0x000142d8 in ada.strings.wide_fixed.replace_slice (source={P_ARRAY =
0xff8e9774, P_BOUNDS = 0x292e8}, low=12, high=10, by={P_ARRAY = 0x292f0,
P_BOUNDS = 0x29300}, drop=ada__strings__error, 
    justify=ada__strings__left, pad=32 ' ') at a-stwifi.adb:480
#8  0x00011648 in t1 () at t1.adb:5
(gdb) info local
orig_context = {reg = {0x0 <repeats 14 times>, 0xff8e8b7c, 0xff8e954c, 0x0,
0x4, 0x8, 0xc, 0x10, 0x14, 0x18, 0x1c, 0x20, 0x24, 0x28, 0x2c, 0x30, 0x34,
0x38, 0x3c, 0x0 <repeats 71 times>}, cfa = 0x0, 
  ra = 0x1352c, lsda = 0x315cf, bases = {tbase = 0x0, dbase = 0x0, func =
0x1330c}, flags = 1073741824, version = 0, args_size = 0, by_value = '\0'
<repeats 102 times>}
cfa = <value optimized out>
tmp_sp = {ptr = 0, word = 0}
(gdb) quit
The program is running.  Exit anyway? (y or n) y
$ cat t1.adb
with Ada.Strings.Wide_Fixed;
procedure T1 is
  Result_String : Wide_String(1..10) := (others => Ada.Strings.Wide_Space);
begin
  Ada.Strings.Wide_Fixed.Replace_Slice(Result_String,
                           Result_String'Last + 2, -- should raise exception
                           Result_String'Last,
                           "xxxxxxx");
end T1;

Note: If a-stwifi.adb is recompiled at -O0 or -O1 the test pass (both reduced
and full), at -O2 it fails so the issue is likely a miscompilation of
a-stwifi.adb


-- 


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

Reply via email to