From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26027 invoked by alias); 5 Jan 2014 01:57:28 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 26005 invoked by uid 48); 5 Jan 2014 01:57:23 -0000 From: "nullnilaki at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/59679] New: gcc version 4.7.3 and gcc version 4.5.3 cause an unaligned access exception on NetBSD/Alpha Date: Sun, 05 Jan 2014 01:57:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 4.7.3 X-Bugzilla-Keywords: X-Bugzilla-Severity: critical X-Bugzilla-Who: nullnilaki at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-01/txt/msg00208.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59679 Bug ID: 59679 Summary: gcc version 4.7.3 and gcc version 4.5.3 cause an unaligned access exception on NetBSD/Alpha Product: gcc Version: 4.7.3 Status: UNCONFIRMED Severity: critical Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: nullnilaki at gmail dot com Using gcc4.7.3 and gcc4.5.3 to compile a Perl v5.18.1. Perl cause an unaligned access exception. ---------------------------------------------------------------- Please read the perl-bug https://rt.perl.org/Public/Bug/Display.html?id=120888 ---------------------------------------------------------------- gcc4.5 and gcc4.7 cause this problem. (I can not compile gcc4.6 and gcc4.8 but I think gcc4.6 and gcc4.8 has some kind of similar bug.) ---------------------------------------------------------------- This problem was caused by compiler's bug. -ftree-ter option makes wrong binary. ---------------------------------------------------------------- -O2 version. (gdb) break scope.c:1217 No source file named scope.c. Make breakpoint pending on future shared library load? (y or [n]) y Breakpoint 1 (scope.c:1217) pending. (gdb) r perl.pl Starting program: /usr/pkg/bin/perl perl.pl [Switching to LWP 1] Breakpoint 1, Perl_leave_scope (my_perl=0x160505000, base=) at scope.c:1217 1217 *(I8*)ARG0_PTR = (I8)(uv >> 8); (gdb) list 1212 1213 case SAVEt_I16: /* I16 reference */ 1214 *(I16*)ARG0_PTR = (I16)(uv >> 8); 1215 break; 1216 case SAVEt_I8: /* I8 reference */ 1217 *(I8*)ARG0_PTR = (I8)(uv >> 8); 1218 break; 1219 case SAVEt_DESTRUCTOR: 1220 (*arg1.any_dptr)(ARG0_PTR); 1221 break; (gdb) x/10i $pc => 0x1601795c0 : extbl t5,0x1,t5 0x1601795c4 : ldl t0,0(s1) 0x1601795c8 : andnot t0,0xff,t0 0x1601795cc : or t5,t0,t5 0x1601795d0 : stl t5,0(s1) 0x1601795d4 : ldl t3,48(s0) 0x1601795d8 : ldl t0,152(s0) 0x1601795dc : br 0x160178800 0x1601795e0 : mov s0,a0 0x1601795e4 : ldq t12,-24984(gp) (gdb) p uv $1 = 2574 (gdb) ptype uv type = long unsigned int (gdb) ptype I8 type = signed char (gdb) print /a uv $2 = 0xa0e (gdb) p arg0 $1 = {any_ptr = 0x1605104ee, any_i32 = 1615922414, any_iv = 5910889710, any_uv = 5910889710, any_long = 5910889710, any_bool = 238, any_dptr = 0x1605104ee, any_dxptr = 0x1605104ee} (gdb) p &arg0 Address requested for identifier "arg0" which is in register $s1 (gdb) n pid 436 (perl): unaligned access: va=0x1605104ee pc=0x1601795c4 ra=0x160179124 sp=0x1ffffc698 op=ldl pid 436 (perl): unaligned access: va=0x1605104ee pc=0x1601795d0 ra=0x160179124 sp=0x1ffffc698 op=stl 1218 break; 1218 break; (gdb) p uv $1 = ------------------------------------------------------------------- -O2 -fno-tree-ter version. (gdb) break scope.c:1217 No source file named scope.c. Make breakpoint pending on future shared library load? (y or [n]) y Breakpoint 1 (scope.c:1217) pending. (gdb) r perl.pl Starting program: /usr/pkg/bin/perl perl.pl [Switching to LWP 1] Breakpoint 1, Perl_leave_scope (my_perl=0x160505000, base=) at scope.c:1217 1217 *(I8*)ARG0_PTR = (I8)(uv >> 8); (gdb) x/10i $pc => 0x160177df0 : extbl t5,0x1,t5 0x160177df4 : ldq_u t0,0(s1) 0x160177df8 : insbl t5,s1,t5 0x160177dfc : mskbl t0,s1,t0 0x160177e00 : or t5,t0,t5 0x160177e04 : stq_u t5,0(s1) 0x160177e08 : ldl t3,48(s0) 0x160177e0c : ldl t0,152(s0) 0x160177e10 : br 0x160177020 0x160177e14 : unop (gdb) p uv $1 = 2574 (gdb) ptype uv type = long unsigned int (gdb) ptype I8 type = signed char (gdb) print /a uv $2 = 0xa0e (gdb) p arg0 $1 = {any_ptr = 0x1605104ee, any_i32 = 1615922414, any_iv = 5910889710, any_uv = 5910889710, any_long = 5910889710, any_bool = 238, any_dptr = 0x1605104ee, any_dxptr = 0x1605104ee} (gdb) n 1218 break;