public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug driver/21795] New: reordering/aliasing effect on ppc64
@ 2005-05-28  7:50 hvr at gnu dot org
  2005-05-28  7:55 ` [Bug driver/21795] " hvr at gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: hvr at gnu dot org @ 2005-05-28  7:50 UTC (permalink / raw)
  To: gcc-bugs

when compiling the attached gcc4bug.c with

$ gcc -Wall -O2 -fno-strict-aliasing  gcc4bug.c -o gcc4bug;./gcc4bug ;echo $?
39

the assertion in line 39 gets triggered on ppc64, even though
-fno-strict-aliasing is used; looking at the assembler output, the 2 single-byte
stores (together with the assertion-checks before the call to _hexdump() that
got optimized away...) have been moved before the memcpy() 

        /* setting memory... */
#NO_APP
        li 0,-54
        ld 9,.LC3@toc(2)
        stb 0,120(1)     // m_b
        li 0,-2
        nop
        lhz 11,8(9)
        lwz 10,0(9)
        lwz 8,4(9)
        stb 0,121(1)     // m_c
        sth 11,120(1)
        stw 10,112(1)
        stw 8,116(1)
#APP
        /* done setting memory... */


interestingly, when enabling some of the commented out assert's in the .c file,
the code gets reordered to produce the expected result (i.e. all assertions to
hold, and the program to exit with a return code of 0)

(this behaviour wasn't present in gcc-3.4 yet)

$ gcc -v
Using built-in specs.
Target: powerpc64-linux
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f95,objc,ada,treelang --prefix=/usr
--libexecdir=/usr/lib --enable-shared --with-system-zlib --enable-nls
--enable-threads=posix --without-included-gettext --program-suffix=-4.0
--enable-__cxa_atexit --enable-libstdcxx-allocator=mt --enable-clocale=gnu
--enable-libstdcxx-debug --enable-java-gc=boehm --enable-java-awt=gtk
--enable-mpfr --disable-nof --disable-softfloat --disable-werror
--enable-checking=release powerpc64-linux
Thread model: posix
gcc version 4.0.1 20050503 (prerelease) (Debian 4.0.0-2)

-- 
           Summary: reordering/aliasing effect on ppc64
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: driver
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hvr at gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: powerpc64-linux
  GCC host triplet: powerpc64-linux
GCC target triplet: powerpc64-linux


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


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

* [Bug driver/21795] reordering/aliasing effect on ppc64
  2005-05-28  7:50 [Bug driver/21795] New: reordering/aliasing effect on ppc64 hvr at gnu dot org
@ 2005-05-28  7:55 ` hvr at gnu dot org
  2005-05-28  9:54 ` [Bug middle-end/21795] " pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: hvr at gnu dot org @ 2005-05-28  7:55 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From hvr at gnu dot org  2005-05-28 07:50 -------
Created an attachment (id=8983)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=8983&action=view)
C file triggering the issue


-- 


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


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

* [Bug middle-end/21795] reordering/aliasing effect on ppc64
  2005-05-28  7:50 [Bug driver/21795] New: reordering/aliasing effect on ppc64 hvr at gnu dot org
  2005-05-28  7:55 ` [Bug driver/21795] " hvr at gnu dot org
@ 2005-05-28  9:54 ` pinskia at gcc dot gnu dot org
  2005-05-28 14:39 ` [Bug rtl-optimization/21795] " pinskia at gcc dot gnu dot org
  2005-07-01 19:36 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-28  9:54 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-28 08:08 -------
Note there is no C alias rules violating in the code as you can access anything via chars.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|driver                      |middle-end
           Keywords|                            |wrong-code


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


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

* [Bug rtl-optimization/21795] reordering/aliasing effect on ppc64
  2005-05-28  7:50 [Bug driver/21795] New: reordering/aliasing effect on ppc64 hvr at gnu dot org
  2005-05-28  7:55 ` [Bug driver/21795] " hvr at gnu dot org
  2005-05-28  9:54 ` [Bug middle-end/21795] " pinskia at gcc dot gnu dot org
@ 2005-05-28 14:39 ` pinskia at gcc dot gnu dot org
  2005-07-01 19:36 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-28 14:39 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-28 14:01 -------
Note, you are violating not aliasing rules but rule of going over the bounds of the array which is 
undefined by the C standard.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|middle-end                  |rtl-optimization


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


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

* [Bug rtl-optimization/21795] reordering/aliasing effect on ppc64
  2005-05-28  7:50 [Bug driver/21795] New: reordering/aliasing effect on ppc64 hvr at gnu dot org
                   ` (2 preceding siblings ...)
  2005-05-28 14:39 ` [Bug rtl-optimization/21795] " pinskia at gcc dot gnu dot org
@ 2005-07-01 19:36 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-01 19:36 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-01 19:36 -------
This is still invalid as you are going passed the bounds which is undefined.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


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

end of thread, other threads:[~2005-07-01 19:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-28  7:50 [Bug driver/21795] New: reordering/aliasing effect on ppc64 hvr at gnu dot org
2005-05-28  7:55 ` [Bug driver/21795] " hvr at gnu dot org
2005-05-28  9:54 ` [Bug middle-end/21795] " pinskia at gcc dot gnu dot org
2005-05-28 14:39 ` [Bug rtl-optimization/21795] " pinskia at gcc dot gnu dot org
2005-07-01 19:36 ` pinskia at gcc dot gnu dot org

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).