[Bug c++/40764] -O3 gives wrong behaviour, no opt. OK

2009-07-16 Thread vielhaber at gmail dot com


--- Comment #4 from vielhaber at gmail dot com  2009-07-16 09:59 ---
Created an attachment (id=18204)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18204action=view)
g++ -version


-- 

vielhaber at gmail dot com changed:

   What|Removed |Added

  Attachment #18198|0   |1
is obsolete||
  Attachment #18199|0   |1
is obsolete||
  Attachment #18200|0   |1
is obsolete||


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



[Bug c++/40764] -O3 gives wrong behaviour, no opt. OK

2009-07-16 Thread vielhaber at gmail dot com


--- Comment #5 from vielhaber at gmail dot com  2009-07-16 10:01 ---
It was an index out of range error. Now, -O0 and -O3 both work as expected.


-- 

vielhaber at gmail dot com changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution||INVALID


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



[Bug c++/40764] New: -O3 gives wrong behaviour, no opt. OK

2009-07-15 Thread vielhaber at gmail dot com
Without -O3, code works as expected.
With -O3, varible is reset to 0.
Also, probably index overflow.

Where goes the .cc or .i ??

Bugzilla: Horribly scarce user interface!


g++ -v outputs:
Es werden eingebaute Spezifikationen verwendet.
Ziel: i486-linux-gnu
Konfiguriert mit: ../src/configure -v --with-pkgversion='Ubuntu 4.3.3-5ubuntu4'
--with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3
--program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug
--enable-objc-gc --enable-mpfr --enable-targets=all --with-tune=generic
--enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu
--target=i486-linux-gnu
Thread-Modell: posix
gcc-Version 4.3.3 (Ubuntu 4.3.3-5ubuntu4)


-- 
   Summary: -O3 gives wrong behaviour, no opt. OK
   Product: gcc
   Version: 4.3.3
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: vielhaber at gmail dot com
  GCC host triplet: ??? intel x86 (AMD), Ubuntu 9.04, What do you want me to
enter h


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



[Bug c++/40764] -O3 gives wrong behaviour, no opt. OK

2009-07-15 Thread vielhaber at gmail dot com


--- Comment #1 from vielhaber at gmail dot com  2009-07-15 11:31 ---
Created an attachment (id=18198)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18198action=view)
The .i with -O3 on.


-- 


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



[Bug c++/40764] -O3 gives wrong behaviour, no opt. OK

2009-07-15 Thread vielhaber at gmail dot com


--- Comment #2 from vielhaber at gmail dot com  2009-07-15 11:32 ---
Created an attachment (id=18199)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18199action=view)
The .i file without optimization


-- 


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



[Bug c++/40764] -O3 gives wrong behaviour, no opt. OK

2009-07-15 Thread vielhaber at gmail dot com


--- Comment #3 from vielhaber at gmail dot com  2009-07-15 11:43 ---
Created an attachment (id=18200)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18200action=view)
The C++ source with comments.

Comments in lines 180 describe the erroneous behaviour.
Output line starting with 1356 and following has 
resB[1]=0 (wrong!) with -O3 , but maintains previous value
0x2178... without optimization, which is the correct behaviour.
lines 79 and 150 ff. concerning array ix_check must be commented out.


Comment in l. 150 gives another error, apparently overwriting the
array ix_check[100]. If this array is in use, both with and without -O3,
things are the same. I checked all indices and do not see the culprit.

Guess I will turn to a high-level language like F77 in the near future...


-- 


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