public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/55999] New: gcc 4.7.2 -O2  -floop-parallelize-all generates incorrect code
@ 2013-01-16  0:27 nfxjfg at gmail dot com
  2013-01-16  0:28 ` [Bug c/55999] " nfxjfg at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: nfxjfg at gmail dot com @ 2013-01-16  0:27 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55999
           Summary: gcc 4.7.2 -O2  -floop-parallelize-all generates
                    incorrect code
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: nfxjfg@gmail.com


struct s {
    int8_t num, c;
    int8_t xs[4], ys[4];
};

void stuff(struct s *desc)
{
    int n;
    for (n = 0; n < desc->num; n++) {
        desc->xs[n] = (n == 1 || n == 2) ? desc->c : 0;
        desc->ys[n] = (n == 1 || n == 2) ? desc->c : 0;
    }
}

desc->xs[0] is not 0 after calling this function, although it should be.

The attached log was generated with gcc -v -save-temps  gcc_issue.c
gcc_issue_main.c -Wall -Wextra -O2  -floop-parallelize-all  > log.txt 2>&1

The assert in gcc_issue_main.c should not be triggered (and is not triggered
when removing -O2 or -floop-parallelize-all).


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

* [Bug c/55999] gcc 4.7.2 -O2  -floop-parallelize-all generates incorrect code
  2013-01-16  0:27 [Bug c/55999] New: gcc 4.7.2 -O2 -floop-parallelize-all generates incorrect code nfxjfg at gmail dot com
@ 2013-01-16  0:28 ` nfxjfg at gmail dot com
  2013-01-16  0:33 ` nfxjfg at gmail dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: nfxjfg at gmail dot com @ 2013-01-16  0:28 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #1 from nfxjfg at gmail dot com 2013-01-16 00:28:15 UTC ---
Created attachment 29174
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29174
source for miscompiled code


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

* [Bug c/55999] gcc 4.7.2 -O2  -floop-parallelize-all generates incorrect code
  2013-01-16  0:27 [Bug c/55999] New: gcc 4.7.2 -O2 -floop-parallelize-all generates incorrect code nfxjfg at gmail dot com
  2013-01-16  0:28 ` [Bug c/55999] " nfxjfg at gmail dot com
@ 2013-01-16  0:33 ` nfxjfg at gmail dot com
  2013-01-16  0:36 ` nfxjfg at gmail dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: nfxjfg at gmail dot com @ 2013-01-16  0:33 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #2 from nfxjfg at gmail dot com 2013-01-16 00:33:23 UTC ---
Created attachment 29175
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29175
source of test program


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

* [Bug c/55999] gcc 4.7.2 -O2  -floop-parallelize-all generates incorrect code
  2013-01-16  0:27 [Bug c/55999] New: gcc 4.7.2 -O2 -floop-parallelize-all generates incorrect code nfxjfg at gmail dot com
  2013-01-16  0:28 ` [Bug c/55999] " nfxjfg at gmail dot com
  2013-01-16  0:33 ` nfxjfg at gmail dot com
@ 2013-01-16  0:36 ` nfxjfg at gmail dot com
  2013-01-16  9:54 ` [Bug tree-optimization/55999] " rguenth at gcc dot gnu.org
  2013-01-16  9:56 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: nfxjfg at gmail dot com @ 2013-01-16  0:36 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #3 from nfxjfg at gmail dot com 2013-01-16 00:35:52 UTC ---
Can't attach log.txt (bugzilla is a POS and says "You already used the form to
file attachment 29175."), so here it's inline:

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i486-linux-gnu/4.7/lto-wrapper
Target: i486-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.2-4'
--with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs
--enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.7 --enable-shared --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object
--enable-plugin --enable-objc-gc --enable-targets=all --with-arch-32=i586
--with-tune=generic --enable-checking=release --build=i486-linux-gnu
--host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.7.2 (Debian 4.7.2-4) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-Wall' '-Wextra' '-O2'
'-floop-parallelize-all' '-mtune=generic' '-march=i586'
 /usr/lib/gcc/i486-linux-gnu/4.7/cc1 -E -quiet -v -imultiarch i386-linux-gnu
gcc_issue.c -mtune=generic -march=i586 -Wall -Wextra -floop-parallelize-all -O2
-fpch-preprocess -o gcc_issue.i
ignoring nonexistent directory "/usr/local/include/i386-linux-gnu"
ignoring nonexistent directory
"/usr/lib/gcc/i486-linux-gnu/4.7/../../../../i486-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/i486-linux-gnu/4.7/include
 /usr/local/include
 /usr/lib/gcc/i486-linux-gnu/4.7/include-fixed
 /usr/include/i386-linux-gnu
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-Wall' '-Wextra' '-O2'
'-floop-parallelize-all' '-mtune=generic' '-march=i586'
 /usr/lib/gcc/i486-linux-gnu/4.7/cc1 -fpreprocessed gcc_issue.i -quiet
-dumpbase gcc_issue.c -mtune=generic -march=i586 -auxbase gcc_issue -O2 -Wall
-Wextra -version -floop-parallelize-all -o gcc_issue.s
GNU C (Debian 4.7.2-4) version 4.7.2 (i486-linux-gnu)
    compiled by GNU C version 4.7.2, GMP version 5.0.5, MPFR version 3.1.0-p10,
MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C (Debian 4.7.2-4) version 4.7.2 (i486-linux-gnu)
    compiled by GNU C version 4.7.2, GMP version 5.0.5, MPFR version 3.1.0-p10,
MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 95cc1ede9130ac2ce2c907b3fbc1c186
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-Wall' '-Wextra' '-O2'
'-floop-parallelize-all' '-mtune=generic' '-march=i586'
 as -v --32 -o gcc_issue.o gcc_issue.s
GNU assembler version 2.22 (i486-linux-gnu) using BFD version (GNU Binutils for
Debian) 2.22
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-Wall' '-Wextra' '-O2'
'-floop-parallelize-all' '-mtune=generic' '-march=i586'
 /usr/lib/gcc/i486-linux-gnu/4.7/cc1 -E -quiet -v -imultiarch i386-linux-gnu
gcc_issue_main.c -mtune=generic -march=i586 -Wall -Wextra
-floop-parallelize-all -O2 -fpch-preprocess -o gcc_issue_main.i
ignoring nonexistent directory "/usr/local/include/i386-linux-gnu"
ignoring nonexistent directory
"/usr/lib/gcc/i486-linux-gnu/4.7/../../../../i486-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/i486-linux-gnu/4.7/include
 /usr/local/include
 /usr/lib/gcc/i486-linux-gnu/4.7/include-fixed
 /usr/include/i386-linux-gnu
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-Wall' '-Wextra' '-O2'
'-floop-parallelize-all' '-mtune=generic' '-march=i586'
 /usr/lib/gcc/i486-linux-gnu/4.7/cc1 -fpreprocessed gcc_issue_main.i -quiet
-dumpbase gcc_issue_main.c -mtune=generic -march=i586 -auxbase gcc_issue_main
-O2 -Wall -Wextra -version -floop-parallelize-all -o gcc_issue_main.s
GNU C (Debian 4.7.2-4) version 4.7.2 (i486-linux-gnu)
    compiled by GNU C version 4.7.2, GMP version 5.0.5, MPFR version 3.1.0-p10,
MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C (Debian 4.7.2-4) version 4.7.2 (i486-linux-gnu)
    compiled by GNU C version 4.7.2, GMP version 5.0.5, MPFR version 3.1.0-p10,
MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 95cc1ede9130ac2ce2c907b3fbc1c186
gcc_issue_main.c: In function ‘main’:
gcc_issue_main.c:4:14: warning: unused parameter ‘argc’ [-Wunused-parameter]
gcc_issue_main.c:4:27: warning: unused parameter ‘argv’ [-Wunused-parameter]
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-Wall' '-Wextra' '-O2'
'-floop-parallelize-all' '-mtune=generic' '-march=i586'
 as -v --32 -o gcc_issue_main.o gcc_issue_main.s
GNU assembler version 2.22 (i486-linux-gnu) using BFD version (GNU Binutils for
Debian) 2.22
COMPILER_PATH=/usr/lib/gcc/i486-linux-gnu/4.7/:/usr/lib/gcc/i486-linux-gnu/4.7/:/usr/lib/gcc/i486-linux-gnu/:/usr/lib/gcc/i486-linux-gnu/4.7/:/usr/lib/gcc/i486-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/i486-linux-gnu/4.7/:/usr/lib/gcc/i486-linux-gnu/4.7/../../../i386-linux-gnu/:/usr/lib/gcc/i486-linux-gnu/4.7/../../../../lib/:/lib/i386-linux-gnu/:/lib/../lib/:/usr/lib/i386-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/i486-linux-gnu/4.7/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-Wall' '-Wextra' '-O2'
'-floop-parallelize-all' '-mtune=generic' '-march=i586'
 /usr/lib/gcc/i486-linux-gnu/4.7/collect2 --sysroot=/ --build-id
--no-add-needed --eh-frame-hdr -m elf_i386 --hash-style=both -dynamic-linker
/lib/ld-linux.so.2
/usr/lib/gcc/i486-linux-gnu/4.7/../../../i386-linux-gnu/crt1.o
/usr/lib/gcc/i486-linux-gnu/4.7/../../../i386-linux-gnu/crti.o
/usr/lib/gcc/i486-linux-gnu/4.7/crtbegin.o -L/usr/lib/gcc/i486-linux-gnu/4.7
-L/usr/lib/gcc/i486-linux-gnu/4.7/../../../i386-linux-gnu
-L/usr/lib/gcc/i486-linux-gnu/4.7/../../../../lib -L/lib/i386-linux-gnu
-L/lib/../lib -L/usr/lib/i386-linux-gnu -L/usr/lib/../lib
-L/usr/lib/gcc/i486-linux-gnu/4.7/../../.. gcc_issue.o gcc_issue_main.o -lgcc
--as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed
/usr/lib/gcc/i486-linux-gnu/4.7/crtend.o
/usr/lib/gcc/i486-linux-gnu/4.7/../../../i386-linux-gnu/crtn.o


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

* [Bug tree-optimization/55999] gcc 4.7.2 -O2  -floop-parallelize-all generates incorrect code
  2013-01-16  0:27 [Bug c/55999] New: gcc 4.7.2 -O2 -floop-parallelize-all generates incorrect code nfxjfg at gmail dot com
                   ` (2 preceding siblings ...)
  2013-01-16  0:36 ` nfxjfg at gmail dot com
@ 2013-01-16  9:54 ` rguenth at gcc dot gnu.org
  2013-01-16  9:56 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-01-16  9:54 UTC (permalink / raw)
  To: gcc-bugs


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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-01-16
      Known to work|                            |4.8.0
     Ever Confirmed|0                           |1
      Known to fail|                            |4.6.3, 4.7.2

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> 2013-01-16 09:53:52 UTC ---
Confirmed on the 4.7/4.6 branches.


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

* [Bug tree-optimization/55999] gcc 4.7.2 -O2  -floop-parallelize-all generates incorrect code
  2013-01-16  0:27 [Bug c/55999] New: gcc 4.7.2 -O2 -floop-parallelize-all generates incorrect code nfxjfg at gmail dot com
                   ` (3 preceding siblings ...)
  2013-01-16  9:54 ` [Bug tree-optimization/55999] " rguenth at gcc dot gnu.org
@ 2013-01-16  9:56 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-01-16  9:56 UTC (permalink / raw)
  To: gcc-bugs


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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.8.0

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> 2013-01-16 09:56:22 UTC ---
Fixed by using ISL which properly handles overflow.


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

end of thread, other threads:[~2013-01-16  9:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-16  0:27 [Bug c/55999] New: gcc 4.7.2 -O2 -floop-parallelize-all generates incorrect code nfxjfg at gmail dot com
2013-01-16  0:28 ` [Bug c/55999] " nfxjfg at gmail dot com
2013-01-16  0:33 ` nfxjfg at gmail dot com
2013-01-16  0:36 ` nfxjfg at gmail dot com
2013-01-16  9:54 ` [Bug tree-optimization/55999] " rguenth at gcc dot gnu.org
2013-01-16  9:56 ` rguenth at gcc dot gnu.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).