[Bug c++/40658] New: spurious warning array subscript is below array bounds

2009-07-06 Thread gcc at axel-naumann dot de
Compiling the following code snippet with g++ -m32 -S -Wall -O2 t.cc on a
64bit machine issues a warning

t.cc: In static member function 'static void
NewDelFunctionsTT::deleteArray_T(void*) [with T = EcalTPGLut]':
t.cc:12: warning: array subscript is below array bounds

This does not happen with 4.4.

t.cc:
class EcalTPGLut {
 public:
   ~EcalTPGLut() ;

 private:
  unsigned int lut_[1024];
};

template class T
struct NewDelFunctionsT {
   static void
   deleteArray_T(void* p) { delete[] (T*) p; }
};

typedef void (*DelArrFunc_t)(void*);

DelArrFunc_t method_newdel_98() {
   return NewDelFunctionsT ::EcalTPGLut ::deleteArray_T;
}


-- 
   Summary: spurious warning array subscript is below array bounds
   Product: gcc
   Version: 4.3.3
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: gcc at axel-naumann dot de
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: -m32


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



[Bug c++/40658] spurious warning array subscript is below array bounds

2009-07-06 Thread gcc at axel-naumann dot de


--- Comment #3 from gcc at axel-naumann dot de  2009-07-06 10:59 ---
OK, I didn't know that the branch is closed, nor that it involves extensive
changes. Sorry it took me so long to find this! I can of course use #pragma GCC
diagnostic ignored -Warray-bounds if needed.


-- 


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



[Bug c++/36045] New: [4.3 regression] returning result of sqrt() can cause wrong return value, invalid reads

2008-04-25 Thread gcc at axel-naumann dot de
Compile as
  g++ -O2 -m64 h.ii  ./a.out

The code should print 2; it does so with GCC 3.4.6, GCC 4.1.2 and GCC 4.2.1.

It prints 1.27688e-161 (or any other random value) with GCC 4.3; valgrind
complains about
==14214== Invalid read of size 8
==14214==at 0x4007F0: HD::e(int) const (in a.out)
==14214==  Address 0x4D50028 is 8 bytes before a block of size 8 alloc'd
==14214==at 0x4905665: operator new[](unsigned long)
(vg_replace_malloc.c:199)

Output of g++ -v -O2 -m64 h.ii:

Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: /build/LCG/gcc-4.3.0/configure
--prefix=/afs/cern.ch/sw/lcg/contrib/gcc/4.3.0/slc4_amd64_gcc34
--with-mpfr=/afs/cern.ch/sw/lcg/contrib/mpfr/2.3.1/slc4_amd64_gcc34 :
(reconfigured) /build/LCG/gcc-4.3.0/configure
--prefix=/afs/cern.ch/sw/lcg/contrib/gcc/4.3.0/slc4_amd64_gcc34
--with-mpfr=/afs/cern.ch/sw/lcg/contrib/mpfr/2.3.1/slc4_amd64_gcc34
Thread model: posix
gcc version 4.3.0 (GCC) 
COLLECT_GCC_OPTIONS='-v' '-O2' '-m64' '-shared-libgcc' '-mtune=generic'

/afs/cern.ch/sw/lcg/contrib/gcc/4.3.0/slc4_amd64_gcc34/libexec/gcc/x86_64-unknown-linux-gnu/4.3.0/cc1plus
-fpreprocessed h.ii -quiet -dumpbase h.ii -m64 -mtune=generic -auxbase h -O2
-version -o /tmp/axel/ccFq5mLH.s
GNU C++ (GCC) version 4.3.0 (x86_64-unknown-linux-gnu)
compiled by GNU C version 4.3.0, GMP version 4.1.4, MPFR version 2.3.1.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: a1d58d96913e85190a50d3b74e2cfdbe
COLLECT_GCC_OPTIONS='-v' '-O2' '-m64' '-shared-libgcc' '-mtune=generic'
 as -V -Qy --64 -o /tmp/axel/cc6ubWDk.o /tmp/axel/ccFq5mLH.s
GNU assembler version 2.15.92.0.2 (x86_64-redhat-linux) using BFD version
2.15.92.0.2 20040927
COMPILER_PATH=/afs/cern.ch/sw/lcg/contrib/gcc/4.3.0/slc4_amd64_gcc34/libexec/gcc/x86_64-unknown-linux-gnu/4.3.0/:/afs/cern.ch/sw/lcg/contrib/gcc/4.3.0/slc4_amd64_gcc34/libexec/gcc/x86_64-unknown-linux-gnu/4.3.0/:/afs/cern.ch/sw/lcg/contrib/gcc/4.3.0/slc4_amd64_gcc34/libexec/gcc/x86_64-unknown-linux-gnu/:/afs/cern.ch/sw/lcg/contrib/gcc/4.3.0/slc4_amd64_gcc34/lib/gcc/x86_64-unknown-linux-gnu/4.3.0/:/afs/cern.ch/sw/lcg/contrib/gcc/4.3.0/slc4_amd64_gcc34/lib/gcc/x86_64-unknown-linux-gnu/
LIBRARY_PATH=/afs/cern.ch/sw/lcg/contrib/gcc/4.3.0/slc4_amd64_gcc34/lib/gcc/x86_64-unknown-linux-gnu/4.3.0/:/afs/cern.ch/sw/lcg/contrib/gcc/4.3.0/slc4_amd64_gcc34/lib/gcc/x86_64-unknown-linux-gnu/4.3.0/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/afs/cern.ch/sw/lcg/contrib/gcc/4.3.0/slc4_amd64_gcc34/lib/gcc/x86_64-unknown-linux-gnu/4.3.0/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-O2' '-m64' '-shared-libgcc' '-mtune=generic'

/afs/cern.ch/sw/lcg/contrib/gcc/4.3.0/slc4_amd64_gcc34/libexec/gcc/x86_64-unknown-linux-gnu/4.3.0/collect2
--eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2
/usr/lib/../lib64/crt1.o /usr/lib/../lib64/crti.o
/afs/cern.ch/sw/lcg/contrib/gcc/4.3.0/slc4_amd64_gcc34/lib/gcc/x86_64-unknown-linux-gnu/4.3.0/crtbegin.o
-L/afs/cern.ch/sw/lcg/contrib/gcc/4.3.0/slc4_amd64_gcc34/lib/gcc/x86_64-unknown-linux-gnu/4.3.0
-L/afs/cern.ch/sw/lcg/contrib/gcc/4.3.0/slc4_amd64_gcc34/lib/gcc/x86_64-unknown-linux-gnu/4.3.0/../../../../lib64
-L/lib/../lib64 -L/usr/lib/../lib64
-L/afs/cern.ch/sw/lcg/contrib/gcc/4.3.0/slc4_amd64_gcc34/lib/gcc/x86_64-unknown-linux-gnu/4.3.0/../../..
/tmp/axel/cc6ubWDk.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc
/afs/cern.ch/sw/lcg/contrib/gcc/4.3.0/slc4_amd64_gcc34/lib/gcc/x86_64-unknown-linux-gnu/4.3.0/crtend.o
/usr/lib/../lib64/crtn.o

Please change the summary if you can think of anything more appropriate.


-- 
   Summary: [4.3 regression] returning result of sqrt() can cause
wrong return value, invalid reads
   Product: gcc
   Version: 4.3.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: gcc at axel-naumann dot de
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


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



[Bug c++/36045] [4.3 regression] returning result of sqrt() can cause wrong return value, invalid reads

2008-04-25 Thread gcc at axel-naumann dot de


--- Comment #1 from gcc at axel-naumann dot de  2008-04-25 13:41 ---
Created an attachment (id=15530)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15530action=view)
test case


-- 


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



[Bug c/32324] New: unsigned long long operator and integer literals

2007-06-13 Thread gcc at axel-naumann dot de
The result of the division of 18446744065119617024llu by the result of (131)
is wrong on a 32bit platform.

Reproduce:  gcc s.c  ./a.out
should have exit code 0 but doesn't.

Expected:   gcc -DEXPECTED s.c  ./a.out
has exit code 0 as expected.


gcc -v
Reading specs from /usr/lib/gcc/i386-redhat-linux/3.4.6/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-java-awt=gtk --host=i386-redhat-linux
Thread model: posix
gcc version 3.4.6 20060404 (Red Hat 3.4.6-8)
[lxbuild021] /afs/cern.ch/user/a/axel/tmp/gccconv 
/afs/cern.ch/sw/lcg/contrib/gcc/4.1.2/slc4_ia32_gcc34/bin/gcc -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: /build/LCG/gcc-4.1.2/configure
--prefix=/afs/cern.ch/sw/lcg/contrib/gcc/4.1.2/slc4_ia32_gcc34
Thread model: posix
gcc version 4.1.2


uname -a
Linux lxbuild021.cern.ch 2.6.9-42.0.10.EL.cernsmp #1 SMP Thu Mar 1 15:11:46 CET
2007 i686 i686 i386 GNU/Linux


I'll give the .c instead of .i because it shows the expected result and has no
#includes:

int main (){
   unsigned long long a = 18446744065119617024llu;
   /* results expected to be identical */
#ifdef EXPECTED
   int b = ((int)(131));
   a = a / b;
#else
   a = a / ((int)(131));
#endif
   return a;
}


-- 
   Summary: unsigned long long operator  and integer literals
   Product: gcc
   Version: 4.1.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: gcc at axel-naumann dot de
 GCC build triplet: i386-redhat-linux
  GCC host triplet: i386-redhat-linux
GCC target triplet: i386-redhat-linux


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



[Bug c/32324] unsigned long long operator and integer literals

2007-06-13 Thread gcc at axel-naumann dot de


--- Comment #1 from gcc at axel-naumann dot de  2007-06-13 16:50 ---
Created an attachment (id=13699)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13699action=view)
Test case as stated in the report.


-- 


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