zen% /opt/gcc-4.5.0/bin/gcc -v
Using built-in specs.
COLLECT_GCC=/opt/gcc-4.5.0/bin/gcc
COLLECT_LTO_WRAPPER=/opt/gcc-4.5.0/libexec/gcc/i686-pc-linux-gnu/4.5.0/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: /src/package/lang/other/gcc-4.5.0/configure
--prefix=/opt/gcc-4.5.0 --with-gmp=/opt/gmp-4.2.2 --with-mpfr=/opt/mpfr-2.4.1
--with-mpc=/opt/mpc-0.8.1
Thread model: posix
gcc version 4.5.0 (GCC) 
zen% 

test.S is generated from 'gcc -S -O2 -fno-inline -Wall gcctest2.c -o
gcctest2.S' using gcc-4.5.0. The assembler shows that the function test() does
not check if its third parameter o2 is NULL, but one path in the calling
function peep() does not guarantee that it is nonnull.

I was unable to reproduce this with gcc-4.4.3; I was also unable to reproduce
it without the '__attribute__((nonnull(2)))' declaration - it seems possible
that in some circumstances the nonnull may be getting applied to the wrong
parameter, but that may be a red herring.

This is cut down from a problem found by Alex Hunsaker compiling perl-5.12.1,
where the erroneous generated code caused a segfault
<http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2010-05/msg00316.html>.


-- 
           Summary: Incorrect nonnull assumed in code generation
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hv at crypt dot org


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

Reply via email to