-----Message d'origine----- De : gpc-owner@gnu.de [mailto:gpc-owner@gnu.de] De la part de Waldek Hebisch Envoyé : December 5, 2005 13:40 À : gpc@gnu.de Objet : Re: Crash with sets under Solaris
I gathered all the details I could. The versions of the components: ------------------------------- gpc -v Reading specs from /usr/local/lib/gcc/sparc-sun-solaris2.6/3.4.3/specs Configured with: ../gcc-3.4.3/configure --with-as=/usr/ccs/bin/as --with-ld=/usr/ccs/bin/ld --disable-nls --disable-libgcj --enable-languages=pascal,c,c++ Thread model: posix gpc version 20050331, based on gcc-3.4.3
as -V as: WorkShop Compilers 4.X dev 18 Sep 1996
ld -V ld: Software Generation Utilities - Solaris-ELF (4.0)
The test program: ----------------- It is a variation on the adam3k program from the gpc test suite:
program adam3k2; const sconst = [3,5]; var s : set of 1..10; s2 : set of 1..10 = [3,5]; begin s := [3,5]; if s = s2 then WriteLn ('OK') else WriteLn ('failed'); if s = sconst then WriteLn ('OK') else WriteLn ('failed'); end.
I compile it with: gpc -g -O0 --automake -o adam3k2 adam3k2.pas
Results: -------- There are four interesting points here: 1- If I execute it as it is, there is no core dump but both tests display "failed" instead of "OK" 2- If I swap the two tests (put "if s = s2..." after "if s = sconst...") the test crashes on the first comparison in _p_Set_Equal. 3- The optimization level at the gpc command-line (-O0) has no impact on the result 4- (Perhaps useless) Swapping the operands of the tests has no impact on the result.
What gdb says: Starting program: /data1/Pascal/p/test/adam3k2
Program received signal SIGSEGV, Segmentation fault. $00029134 in _p_Set_Equal (Seta=$55d84, Lowa=0, Higha=1312, Setb=$41c62, Lowb=3, Highb=0) at /data1/Pascal/gcc-3.4.3/gcc/p/rts/sets.pas:215 215 if SetA^[i + a] <> SetB^[i] then Exit; (gdb) list 210 wa := WordNumber (HighA, LowA); 211 wb := WordNumber (HighB, LowB); 212 for i := 0 to a - 1 do 213 if SetA^[i] <> 0 then Exit; 214 for i := 0 to Min (wa - a, wb) do 215 if SetA^[i + a] <> SetB^[i] then Exit; 216 for i := wa - a + 1 to wb do 217 if SetB^[i] <> 0 then Exit; 218 SetEqual := True 219 end (gdb) info registers g0 $0 0 g1 $0 0 g2 $effff730 -268437712 g3 $0 0 g4 $0 0 g5 $0 0 g6 $0 0 g7 $0 0 o0 $55d84 351620 o1 $0 0 o2 $0 0 o3 $0 0 o4 $ffffffff -1 o5 $520 1312 sp $effff890 4026529936 o7 $18058 98392 l0 $0 0 l1 $0 0 l2 $22 34 l3 $56400 353280 l4 $3fffffe 67108862 l5 $23 35 l6 $0 0 l7 $0 0 i0 $0 0 i1 $1 1 i2 $0 0 i3 $41c62 269410 i4 $3 3 i5 $0 0 fp $effff900 4026530048 i7 $180c4 98500 y $0 0 psr $fe400005 -29360123 icc:-Z--, pil:0, s:0, ps:0, et:0, cwp:5 wim $0 0 tbr $0 0 pc $29134 168244 npc $29138 168248 fpsr $0 0 rd:N, tem:0, ns:0, ver:0, ftt:0, qne:0, fcc:=, aexc:0, cexc:0 cpsr $0 0 (gdb) disassemble Dump of assembler code for function _p_Set_Equal: $00029084 <_p_Set_Equal+0>: save %sp, -112, %sp $00029088 <_p_Set_Equal+4>: mov %i1, %o1 $0002908c <_p_Set_Equal+8>: mov %i0, %o0 $00029090 <_p_Set_Equal+12>: mov %i2, %o5 $00029094 <_p_Set_Equal+16>: cmp %i1, %i5 $00029098 <_p_Set_Equal+20>: bg $290a4 <_p_Set_Equal+32> $0002909c <_p_Set_Equal+24>: mov 1, %g1 $000290a0 <_p_Set_Equal+28>: clr %g1 $000290a4 <_p_Set_Equal+32>: btst 0xff, %g1 $000290a8 <_p_Set_Equal+36>: bne $29188 <_p_Set_Equal+260> $000290ac <_p_Set_Equal+40>: cmp %i4, %o5 $000290b0 <_p_Set_Equal+44>: bg $29188 <_p_Set_Equal+260> $000290b4 <_p_Set_Equal+48>: sra %o1, 5, %i2 $000290b8 <_p_Set_Equal+52>: sra %i4, 5, %o2 $000290bc <_p_Set_Equal+56>: cmp %i2, %o2 $000290c0 <_p_Set_Equal+60>: bg $291b8 <_p_Set_Equal+308> $000290c4 <_p_Set_Equal+64>: clr %i0 $000290c8 <_p_Set_Equal+68>: sra %o5, 5, %g1 $000290cc <_p_Set_Equal+72>: sub %o2, %i2, %o1 $000290d0 <_p_Set_Equal+76>: sra %i5, 5, %o5 $000290d4 <_p_Set_Equal+80>: sub %g1, %i2, %i2 $000290d8 <_p_Set_Equal+84>: addcc %o1, -1, %o4 $000290dc <_p_Set_Equal+88>: bneg $29104 <_p_Set_Equal+128> $000290e0 <_p_Set_Equal+92>: sub %o5, %o2, %i5 $000290e4 <_p_Set_Equal+96>: clr %o2 $000290e8 <_p_Set_Equal+100>: sll %o2, 2, %g1 $000290ec <_p_Set_Equal+104>: ld [ %o0 + %g1 ], %o5 $000290f0 <_p_Set_Equal+108>: cmp %o5, 0 $000290f4 <_p_Set_Equal+112>: bne $291dc <_p_Set_Equal+344> $000290f8 <_p_Set_Equal+116>: cmp %o2, %o4 $000290fc <_p_Set_Equal+120>: bl $290e8 <_p_Set_Equal+100> $00029100 <_p_Set_Equal+124>: inc %o2 $00029104 <_p_Set_Equal+128>: sub %i2, %o1, %i2 $00029108 <_p_Set_Equal+132>: cmp %i2, %i5 $0002910c <_p_Set_Equal+136>: ble $29118 <_p_Set_Equal+148> $00029110 <_p_Set_Equal+140>: mov %i2, %o3 $00029114 <_p_Set_Equal+144>: mov %i5, %o3 $00029118 <_p_Set_Equal+148>: cmp %o3, 0 $0002911c <_p_Set_Equal+152>: bl $29150 <_p_Set_Equal+204> $00029120 <_p_Set_Equal+156>: sll %o1, 2, %g1 $00029124 <_p_Set_Equal+160>: add %g1, %o0, %o0 $00029128 <_p_Set_Equal+164>: clr %o2 $0002912c <_p_Set_Equal+168>: sll %o2, 2, %g1 $00029130 <_p_Set_Equal+172>: ld [ %o0 ], %o5 $00029134 <_p_Set_Equal+176>: ld [ %i3 + %g1 ], %o4 $00029138 <_p_Set_Equal+180>: cmp %o5, %o4 $0002913c <_p_Set_Equal+184>: bne $291dc <_p_Set_Equal+344> $00029140 <_p_Set_Equal+188>: add %o0, 4, %o0 $00029144 <_p_Set_Equal+192>: cmp %o2, %o3 $00029148 <_p_Set_Equal+196>: bl $2912c <_p_Set_Equal+168> $0002914c <_p_Set_Equal+200>: inc %o2 $00029150 <_p_Set_Equal+204>: add %i2, 1, %g1 $00029154 <_p_Set_Equal+208>: cmp %g1, %i5 $00029158 <_p_Set_Equal+212>: bg,a $291dc <_p_Set_Equal+344> $0002915c <_p_Set_Equal+216>: mov 1, %i0 $00029160 <_p_Set_Equal+220>: mov %g1, %o2 $00029164 <_p_Set_Equal+224>: sll %o2, 2, %g1 $00029168 <_p_Set_Equal+228>: ld [ %i3 + %g1 ], %o5 $0002916c <_p_Set_Equal+232>: cmp %o5, 0 $00029170 <_p_Set_Equal+236>: bne $291dc <_p_Set_Equal+344> $00029174 <_p_Set_Equal+240>: cmp %o2, %i5 $00029178 <_p_Set_Equal+244>: bl $29164 <_p_Set_Equal+224> $0002917c <_p_Set_Equal+248>: inc %o2 $00029180 <_p_Set_Equal+252>: b $291dc <_p_Set_Equal+344> $00029184 <_p_Set_Equal+256>: mov 1, %i0 $00029188 <_p_Set_Equal+260>: call $29038 <_p_Set_IsEmpty> $0002918c <_p_Set_Equal+264>: mov %o5, %o2 $00029190 <_p_Set_Equal+268>: btst 0xff, %o0 $00029194 <_p_Set_Equal+272>: bne,a $291a4 <_p_Set_Equal+288> $00029198 <_p_Set_Equal+276>: mov %i3, %o0 $0002919c <_p_Set_Equal+280>: b $291dc <_p_Set_Equal+344> $000291a0 <_p_Set_Equal+284>: mov %o0, %i0 $000291a4 <_p_Set_Equal+288>: mov %i4, %o1 $000291a8 <_p_Set_Equal+292>: call $29038 <_p_Set_IsEmpty> $000291ac <_p_Set_Equal+296>: mov %i5, %o2 $000291b0 <_p_Set_Equal+300>: b $291dc <_p_Set_Equal+344> $000291b4 <_p_Set_Equal+304>: mov %o0, %i0 $000291b8 <_p_Set_Equal+308>: mov %o5, %o4 $000291bc <_p_Set_Equal+312>: mov %o0, %g1 $000291c0 <_p_Set_Equal+316>: mov %i5, %o5 $000291c4 <_p_Set_Equal+320>: mov %i3, %o0 $000291c8 <_p_Set_Equal+324>: mov %o2, %i2 $000291cc <_p_Set_Equal+328>: mov %o4, %i5 $000291d0 <_p_Set_Equal+332>: mov %g1, %i3 $000291d4 <_p_Set_Equal+336>: b $290c8 <_p_Set_Equal+68> $000291d8 <_p_Set_Equal+340>: sra %o1, 5, %o2 $000291dc <_p_Set_Equal+344>: ret $000291e0 <_p_Set_Equal+348>: restore End of assembler dump. (gdb)
Regards
Pascal Viandier pascal@accovia.com