public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "gcc-bugzilla at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/26144]  New: with -O3 and pointer casts, gcc skips if
Date: Tue, 07 Feb 2006 00:42:00 -0000	[thread overview]
Message-ID: <bug-26144-12145@http.gcc.gnu.org/bugzilla/> (raw)


        When casting a pointer and checking for == NULL, the check is skipped
        when -O3 is enabled.  I found this problem while compiling bind with
uClibc,
        but could reproduce the problem with the debian version of gcc and this
simple
        test file.

Environment:
System: Linux dungeon2 2.6.11-1-k7-smp #1 SMP Mon Jun 20 22:34:51 MDT 2005 i686
GNU/Linux
Architecture: i686


host: i486-pc-linux-gnu
build: i486-pc-linux-gnu
target: i486-pc-linux-gnu
configured with: ../src/configure -v
--enable-languages=c,c++,java,f95,objc,ada,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--program-suffix=-4.0 --enable-__cxa_atexit --enable-clocale=gnu
--enable-libstdcxx-debug --enable-java-awt=gtk-default --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.0-1.4.2.0/jre --enable-mpfr
--disable-werror --with-tune=i686 --enable-checking=release i486-linux-gnu

How-To-Repeat:
        Compile this file:

        #include <stdio.h>
        void foo(char **dee) {  *dee = ""; }
        int main(int argc, char *argv[])
            {
            struct blah *ptr = argv[1];
            if(ptr == NULL)
                foo(&ptr);
            printf("%p", ptr); // output: (nil) expected: 0xADDRESS
            return 0;
            }


-- 
           Summary: with -O3 and pointer casts, gcc skips if
           Product: gcc
           Version: 4.0.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: devin at dungeon2 dot cainetworks dot com
 GCC build triplet: i486-pc-linux-gnu
  GCC host triplet: i486-pc-linux-gnu
GCC target triplet: i486-pc-linux-gnu


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


             reply	other threads:[~2006-02-07  0:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-07  0:42 gcc-bugzilla at gcc dot gnu dot org [this message]
2006-02-07  0:53 ` [Bug tree-optimization/26144] " pinskia at gcc dot gnu dot org
2006-02-07 17:07 ` devin at freeshell dot org
2006-02-09  1:02 ` pinskia at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-26144-12145@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).