public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mcree at orcon dot net.nz" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/59679] gcc version 4.7.3 and gcc version 4.5.3 cause an unaligned access exception on NetBSD/Alpha
Date: Sun, 26 Jan 2014 22:56:00 -0000	[thread overview]
Message-ID: <bug-59679-4-veTug2fxLH@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-59679-4@http.gcc.gnu.org/bugzilla/>

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

Michael Cree <mcree at orcon dot net.nz> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mcree at orcon dot net.nz

--- Comment #10 from Michael Cree <mcree at orcon dot net.nz> ---
This misaligned access in perl is also seen on Debian Alpha Linux. I have been
able to reduce the scope.c file substantially while maintaining the misaligned
access.  I will attach that as scope-reduced.c.

The misaligned access occurs in line 60, being the case SAVEt_I8 of the switch
statement, and with -O2 compiles to:

        extbl $4,1,$4
$LVL18:
        ldl $1,0($6)
        bic $1,255,$1
        bis $4,$1,$4
        stl $4,0($6)

Thus there is an assumption that ARG0_PTR (which expands to arg0.any_ptr)
points to an address at least divisible by four.

If one compiles with -fno-tree-ter as mentioned in the initial bug report then
one gets:

        sll $5,48,$5
$LVL18:
        ldq_u $1,0($4)
        sra $5,56,$5
        mskbl $1,$4,$1
        insbl $5,$4,$5
        bis $5,$1,$5
        stq_u $5,0($4)

which copes with any alignment.

If either of the cases SAVEt_SAVESWITCHSTACK or SAVEt_SET_SVFLAGS is removed
from the switch statement then the ldq_u/mskbl/insbl sequence results. Thus
there appears to be some interaction between those two cases and the code at
the top of the while statement that the compiler is using to determine that
ARG0_PTR points to an address at least divisible by four.  I admit that I have
so far failed to see how such an inference can be made but look forward to
being educated by the erudite gcc maintainers.

Compilation was done with:

cc -DPERL_CORE  -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -D_FORTIFY_SOURCE=2 -g -O2
-v -S scope-reduced.c
Using built-in specs.
COLLECT_GCC=cc
Target: alpha-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.8.2-13'
--with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs
--enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.8 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls
--with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libssp
--disable-libmudflap --disable-libitm --disable-libsanitizer
--disable-libquadmath --enable-plugin --with-system-zlib
--disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-alpha/jre --enable-java-home
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-alpha
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-alpha
--with-arch-directory=alpha --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --enable-multiarch --with-long-double-128
--enable-checking=release --build=alpha-linux-gnu --host=alpha-linux-gnu
--target=alpha-linux-gnu
Thread model: posix
gcc version 4.8.2 (Debian 4.8.2-13) 
COLLECT_GCC_OPTIONS='-D' 'PERL_CORE' '-D' '_REENTRANT' '-D' '_GNU_SOURCE' '-D'
'DEBIAN' '-D' '_FORTIFY_SOURCE=2' '-g' '-O2' '-v' '-S'
 /usr/lib/gcc/alpha-linux-gnu/4.8/cc1 -quiet -v -imultilib . -imultiarch
alpha-linux-gnu -D PERL_CORE -D _REENTRANT -D _GNU_SOURCE -D DEBIAN -D
_FORTIFY_SOURCE=2 scope-reduced.c -quiet -dumpbase scope-reduced.c -auxbase
scope-reduced -g -O2 -version -o scope-reduced.s
GNU C (Debian 4.8.2-13) version 4.8.2 (alpha-linux-gnu)
    compiled by GNU C version 4.8.2, GMP version 5.1.3, MPFR version 3.1.2-p3,
MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/local/include/alpha-linux-gnu"
ignoring nonexistent directory
"/usr/lib/gcc/alpha-linux-gnu/4.8/../../../../alpha-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/alpha-linux-gnu/4.8/include
 /usr/local/include
 /usr/lib/gcc/alpha-linux-gnu/4.8/include-fixed
 /usr/include/alpha-linux-gnu
 /usr/include
End of search list.
GNU C (Debian 4.8.2-13) version 4.8.2 (alpha-linux-gnu)
    compiled by GNU C version 4.8.2, GMP version 5.1.3, MPFR version 3.1.2-p3,
MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 503630c10eca9d1ddabc1e36fce68a5f
COMPILER_PATH=/usr/lib/gcc/alpha-linux-gnu/4.8/:/usr/lib/gcc/alpha-linux-gnu/4.8/:/usr/lib/gcc/alpha-linux-gnu/:/usr/lib/gcc/alpha-linux-gnu/4.8/:/usr/lib/gcc/alpha-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/alpha-linux-gnu/4.8/:/usr/lib/gcc/alpha-linux-gnu/4.8/../../../alpha-linux-gnu/:/usr/lib/gcc/alpha-linux-gnu/4.8/../../../:/lib/alpha-linux-gnu/:/lib/:/usr/lib/alpha-linux-gnu/:/usr/lib/
COLLECT_GCC_OPTIONS='-D' 'PERL_CORE' '-D' '_REENTRANT' '-D' '_GNU_SOURCE' '-D'
'DEBIAN' '-D' '_FORTIFY_SOURCE=2' '-g' '-O2' '-v' '-S'

I will also attach preprocessed source.


  parent reply	other threads:[~2014-01-26 22:56 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-05  1:57 [Bug c/59679] New: " nullnilaki at gmail dot com
2014-01-05 20:57 ` [Bug target/59679] " nullnilaki at gmail dot com
2014-01-05 20:57 ` nullnilaki at gmail dot com
2014-01-05 21:02 ` nullnilaki at gmail dot com
2014-01-05 23:08 ` pinskia at gcc dot gnu.org
2014-01-06 16:01 ` nullnilaki at gmail dot com
2014-01-06 16:32 ` nullnilaki at gmail dot com
2014-01-06 16:56 ` nullnilaki at gmail dot com
2014-01-06 16:57 ` nullnilaki at gmail dot com
2014-01-26 22:56 ` mcree at orcon dot net.nz [this message]
2014-01-26 23:00 ` mcree at orcon dot net.nz
2014-01-26 23:01 ` mcree at orcon dot net.nz
2014-01-28 16:54 ` [Bug tree-optimization/59679] " ubizjak at gmail dot com
2014-01-28 17:17 ` ubizjak at gmail dot com
2014-01-28 18:25 ` [Bug middle-end/59679] " ubizjak at gmail dot com
2014-01-29 16:39 ` ubizjak at gmail dot com
2014-06-12 13:53 ` rguenth at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-59679-4-veTug2fxLH@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).