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



             Bug #: 56891

           Summary: Bad static analysis on fread() gives spurious warning

                    on valid code

    Classification: Unclassified

           Product: gcc

           Version: 4.8.0

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: lto

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: gwo...@gmail.com





Created attachment 29838

  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29838

Minimal tarball with makefile



The following code should read 17 bytes into a buffer of size 256.

But the link-time-optimiser assumes that the read size still has its (initial)

massive value, and gives an error



gcc-4.8, GNU/Linux, Ubuntu Lucid with PPA



gcc-4.8 -v gives:

COLLECT_GCC=gcc-4.8

COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper

Target: x86_64-linux-gnu

Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro

4.8.0-2ubuntu2~10.04.1' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs

--enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr

--program-suffix=-4.8 --enable-shared --enable-linker-build-id

--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix

--with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls

--enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes

--enable-gnu-unique-object --enable-plugin --with-system-zlib --enable-objc-gc

--disable-werror --with-arch-32=i586 --with-abi=m64

--with-multilib-list=m32,m64 --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.8.0 (Ubuntu/Linaro 4.8.0-2ubuntu2~10.04.1)

Reply via email to