This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

c/3752: gcc 3.0: __builtin_constant_p(ptr==ptr), regression



>Number:         3752
>Category:       c
>Synopsis:       gcc 3.0: __builtin_constant_p(ptr==ptr), regression
>Confidential:   yes
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          pessimizes-code
>Submitter-Id:   net
>Arrival-Date:   Fri Jul 20 14:36:03 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        3.0 (Debian) (Debian testing/unstable)
>Organization:
>Environment:
System: Linux blah 2.2.15 #1 Tue Apr 25 17:13:48 EST 2000 i586 unknown
Architecture: i586
	<machine, os, target, libraries (multiple lines)>
host: i386-pc-linux-gnu
build: i386-pc-linux-gnu
target: i386-pc-linux-gnu
configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,objc --prefix=/usr --infodir=/share/info --mandir=/share/man --enable-shared --with-gnu-as --with-gnu-ld --with-system-zlib --enable-long-long --enable-nls --without-included-gettext --disable-checking --enable-threads=posix --enable-java-gc=boehm --with-cpp-install-dir=bin --enable-objc-gc i386-linux

>Description:
gcc 3 __builtin_constant_p fails to recognise "ptr==ptr" as a
constant, whereas gcc 2.95.x did.

>How-To-Repeat:
A program foo.c

        int
        main (int argc, char **argv)
        {
          printf ("%d\n", __builtin_constant_p (argv == argv));
          return 0;
        }

compiled with

        gcc-3.0 -O9 foo.c

prints "0" whereas I might have hoped it could print "1" since
argv==argv can certainly be known at compile time.

Curiously, using "argc" instead of "argv" gives the hoped-for "1".
Also a gcc 2.95.4 pre-release gives "1" in both cases.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]