public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/43197] Endianness and Optimization
Date: Sat, 27 Feb 2010 13:06:00 -0000	[thread overview]
Message-ID: <20100227130633.27461.qmail@sourceware.org> (raw)
In-Reply-To: <bug-43197-17842@http.gcc.gnu.org/bugzilla/>



------- Comment #3 from pinskia at gmail dot com  2010-02-27 13:06 -------
Subject: Re:   New: Endianness and Optimization



Sent from my iPhone

On Feb 27, 2010, at 2:56 AM, "kai dot extern at googlemail dot com"
<gcc-bugzilla@gcc.gnu.org 
 > wrote:

> The attached code (which tries to generically load given-endianness  
> values of
> varying width from memory) shows some interesting optimization  
> quirks. It's
> especially pussling why optimization quality varies so greatly with  
> width, and
> is actually worst for the native word width.


You are violating c++ aliasing rules. You access a uint8_t via  
different types.


>
> For example:
>
> $ gcc -Wall -Wextra bad.cc -lstdc++ -O3 -###
> Using built-in specs.
> Target: x86_64-linux-gnu
> Configured with: ../src/configure -v --with-pkgversion='Ubuntu  
> 4.4.1-4ubuntu9'
> --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
> --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable- 
> shared
> --enable-multiarch --enable-linker-build-id --with-system-zlib
> --libexecdir=/usr/lib --without-included-gettext --enable- 
> threads=posix
> --with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 -- 
> enable-nls
> --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc -- 
> disable-werror
> --with-arch-32=i486 --with-tune=generic --enable-checking=release
> --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64- 
> linux-gnu
> Thread model: posix
> gcc version 4.4.1 (Ubuntu 4.4.1-4ubuntu9)
> COLLECT_GCC_OPTIONS='-Wall' '-Wextra' '-O3' '-mtune=generic'
> "/usr/lib/gcc/x86_64-linux-gnu/4.4.1/cc1plus" "-quiet" "-D_GNU_SOURCE"
> "bad.cc" "-D_FORTIFY_SOURCE=2" "-quiet" "-dumpbase" "bad.cc" "- 
> mtune=generic"
> "-auxbase" "bad" "-O3" "-Wall" "-Wextra" "-fstack-protector" "-o"
> "/tmp/ccnHgEb9.s"
> COLLECT_GCC_OPTIONS='-Wall' '-Wextra' '-O3' '-mtune=generic'
> "as" "-Qy" "-o" "/tmp/cceJWVC8.o" "/tmp/ccnHgEb9.s"
> COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.4.1/:/usr/lib/gcc/ 
> x86_64-linux-gnu/4.4.1/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/ 
> x86_64-linux-gnu/4.4.1/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/ 
> x86_64-linux-gnu/4.4.1/:/usr/lib/gcc/x86_64-linux-gnu/
> LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.4.1/:/usr/lib/gcc/ 
> x86_64-linux-gnu/4.4.1/:/usr/lib/gcc/x86_64-linux-gnu/ 
> 4.4.1/../../../../lib/:/lib/../lib/:/usr/lib/../lib/:/usr/lib/gcc/ 
> x86_64-linux-gnu/4.4.1/../../../:/lib/:/usr/lib/:/usr/lib/x86_64- 
> linux-gnu/
> COLLECT_GCC_OPTIONS='-Wall' '-Wextra' '-O3' '-mtune=generic'
> "/usr/lib/gcc/x86_64-linux-gnu/4.4.1/collect2" "--build-id" "--eh- 
> frame-hdr"
> "-m" "elf_x86_64" "--hash-style=both" "-dynamic-linker"
> "/lib64/ld-linux-x86-64.so.2" "-z" "relro"
> "/usr/lib/gcc/x86_64-linux-gnu/4.4.1/../../../../lib/crt1.o"
> "/usr/lib/gcc/x86_64-linux-gnu/4.4.1/../../../../lib/crti.o"
> "/usr/lib/gcc/x86_64-linux-gnu/4.4.1/crtbegin.o"
> "-L/usr/lib/gcc/x86_64-linux-gnu/4.4.1" "-L/usr/lib/gcc/x86_64-linux- 
> gnu/4.4.1"
> "-L/usr/lib/gcc/x86_64-linux-gnu/4.4.1/../../../../lib" "-L/lib/../ 
> lib"
> "-L/usr/lib/../lib" "-L/usr/lib/gcc/x86_64-linux-gnu/4.4.1/../../.."
> "-L/usr/lib/x86_64-linux-gnu" "/tmp/cceJWVC8.o" "-lstdc++" "-lgcc"
> "--as-needed" "-lgcc_s" "--no-as-needed" "-lc" "-lgcc" "--as-needed"  
> "-lgcc_s"
> "--no-as-needed" "/usr/lib/gcc/x86_64-linux-gnu/4.4.1/crtend.o"
> "/usr/lib/gcc/x86_64-linux-gnu/4.4.1/../../../../lib/crtn.o"
> $ objdump -d a.out | c++filt | sed -n '/Test_/,/constructors/ p' > out
>
> (See attachments for source and output.)
>
>
> -- 
>           Summary: Endianness and Optimization
>           Product: gcc
>           Version: 4.4.1
>            Status: UNCONFIRMED
>          Severity: normal
>          Priority: P3
>         Component: tree-optimization
>        AssignedTo: unassigned at gcc dot gnu dot org
>        ReportedBy: kai dot extern at googlemail dot com
> GCC build triplet: x86_64-linux-gnu
>  GCC host triplet: x86_64-linux-gnu
> GCC target triplet: x86_64-linux-gnu
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43197
>


-- 


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


  parent reply	other threads:[~2010-02-27 13:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-27 10:57 [Bug tree-optimization/43197] New: " kai dot extern at googlemail dot com
2010-02-27 10:59 ` [Bug tree-optimization/43197] " kai dot extern at googlemail dot com
2010-02-27 11:01 ` kai dot extern at googlemail dot com
2010-02-27 13:06 ` [Bug tree-optimization/43197] New: " Andrew Pinski
2010-02-27 13:06 ` pinskia at gmail dot com [this message]
2010-02-27 13:46 ` [Bug tree-optimization/43197] " kai dot extern at googlemail dot com
2010-02-27 17:26 ` pinskia at gcc dot gnu dot org
2010-02-27 20:04 ` rguenth at gcc dot gnu dot org
2010-02-27 20:34 ` kai dot extern at googlemail dot com

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=20100227130633.27461.qmail@sourceware.org \
    --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).