public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* target/9082: [alpha,ia64] memcpy makes unaligned access
@ 2002-12-28 10:26 Matthias Klose
  0 siblings, 0 replies; 3+ messages in thread
From: Matthias Klose @ 2002-12-28 10:26 UTC (permalink / raw)
  To: gcc-gnats, debian-gcc; +Cc: Herbert Xu


>Number:         9082
>Category:       target
>Synopsis:       [alpha,ia64] memcpy makes unaligned access
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Sat Dec 28 10:26:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Herbert Xu <herbert@gondor.apana.org.au>
>Release:        3.2.1 (Debian) (Debian unstable)
>Organization:
The Debian Project
>Environment:
System: Debian GNU/Linux (unstable)
Architecture: alpha-linux, ia64-linux
host: alpha-linux
Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,pascal,objc,ada --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.2 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --enable-java-gc=boehm --enable-objc-gc i386-linux
Thread model: posix
gcc version 3.2.2 20021212 (Debian prerelease)
>Description:
[ Reported to the Debian BTS as report #85468, #169004
  Please CC 85468@bugs.debian.org on replies.
  Log of report can be found at

  http://bugs.debian.org/85468   for alpha
  http://bugs.debian.org/169004  for ia64
]

[ reported for 2.95.2, rechecked with gcc-3_2-branch 20021212, Debian
  source code found at http://packages.debian.org/unstable/net/fping.html ]

Herbert Xu writes:

I attempted to make a minimal test case but failed as the stripped down
version actually produced the correct code.

The problem arose in fping.  The relevant code is in fping.c:wait_for_reply(),

  memcpy(&sent_time, icp->icmp_data + offsetof(PING_DATA, ping_ts),
	 sizeof(sent_time));
  memcpy(&this_count, icp->icmp_data, sizeof(this_count));

Since icp->icmp_data is 4-byte aligned, one would expect the memcpys to do
five 4-byte loads.  However, the actual assembly produced with
gcc -S -g -O2 is

$LM490:
	.stabn 68,0,1157,$LM490
	lds $f11,8($10)
$LM491:
	.stabn 68,0,1155,$LM491
	ldt $f10,16($10)
	ldt $f12,24($10)
$LM492:
	.stabn 68,0,1157,$LM492
	sts $f11,80($30)
$LM493:
	.stabn 68,0,1155,$LM493
	stt $f10,88($30)
	stt $f12,96($30)

Which causes two unaligned traps.


The followup for gcc-3.2:

It still happens with 3.2 branch 20021212 on alpha.  This is the assembly:

    26bc:       08 00 2a a0     ldl     t0,8(s1)
    26c0:       10 00 4a a4     ldq     t1,16(s1)
    26c4:       18 00 6a a4     ldq     t2,24(s1)
    26c8:       40 00 3e b0     stl     t0,64(sp)
    26cc:       48 00 5e b4     stq     t1,72(sp)
    26d0:       50 00 7e b4     stq     t2,80(sp)


>How-To-Repeat:
	
>Fix:
	
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: target/9082: [alpha,ia64] memcpy makes unaligned access
@ 2003-01-26 10:46 Herbert Xu
  0 siblings, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2003-01-26 10:46 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR target/9082; it has been noted by GNATS.

From: Herbert Xu <herbert@gondor.apana.org.au>
To: rth@gcc.gnu.org, 169004@bugs.debian.org, 85468@bugs.debian.org,
	gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org,
	gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: target/9082: [alpha,ia64] memcpy makes unaligned access
Date: Sun, 26 Jan 2003 21:45:30 +1100

 On Sun, Jan 26, 2003 at 10:22:31AM -0000, rth@gcc.gnu.org wrote:
 > Synopsis: [alpha,ia64] memcpy makes unaligned access
 > 
 > State-Changed-From-To: open->closed
 > State-Changed-By: rth
 > State-Changed-When: Sun Jan 26 10:22:31 2003
 > State-Changed-Why:
 >     When submitting bugs to gcc, one must include the test case,
 >     not reference it in some package elsewhere.  This reduces the
 >     possibility that the bug requires specific system headers to
 >     be reproduced.
 
 I'm sorry about that, I'll get the preprocessed program sent to you.
 
 >     That said, it's obvious this is a duplicate of PR 9080,
 >     which is closed due to the input program being invalid.
 
 I'm afraid I don't see the connection between the two reports.
 In my case, memcpy is correct programmatically but it's triggering
 an alignment error as it's performing 8-byte loads when the source
 argument is 4-byte aligned (the destination is 8-byte aligned though).
 -- 
 Debian GNU/Linux 3.0 is out! ( http://www.debian.org/ )
 Email:  Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
 Home Page: http://gondor.apana.org.au/~herbert/
 PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: target/9082: [alpha,ia64] memcpy makes unaligned access
@ 2003-01-26 10:22 rth
  0 siblings, 0 replies; 3+ messages in thread
From: rth @ 2003-01-26 10:22 UTC (permalink / raw)
  To: 169004, 85468, gcc-bugs, gcc-prs, herbert, nobody

Synopsis: [alpha,ia64] memcpy makes unaligned access

State-Changed-From-To: open->closed
State-Changed-By: rth
State-Changed-When: Sun Jan 26 10:22:31 2003
State-Changed-Why:
    When submitting bugs to gcc, one must include the test case,
    not reference it in some package elsewhere.  This reduces the
    possibility that the bug requires specific system headers to
    be reproduced.
    
    That said, it's obvious this is a duplicate of PR 9080,
    which is closed due to the input program being invalid.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9082


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-01-26 10:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-28 10:26 target/9082: [alpha,ia64] memcpy makes unaligned access Matthias Klose
2003-01-26 10:22 rth
2003-01-26 10:46 Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).