This looks similar to bug 19449, but with just __builtin_constant_p not
__builtin_choose_expr so I'm opening a new bug for this.


The following code works with 3.3.6, but with 3.4.4 it fails to resolve
__builtin_constant_p leading to link errors of unresolved symbols.

Code I'm seeing this in is linux 2.6.12 built for arm.  The occurance gcc is
having problems with is alloc_skb()'s call to kmalloc().  That call is for a
non-constant variable (size) so __builtin_constant_p() should result in zero.

Problem is present with -O2, however -O1 is resolving __builtin_constant_p
correctly.

I'll attach full preprocessed output as well as compiled output.

Compile line is:

arm-linux-gcc -Wp,-MD,net/core/.skbuff.o.d  -nostdinc -isystem
/net/gia/djohnson/tools/usr/local/starent/bintools/linux-arm/gcc/200510261510/lib/gcc/arm-linux/3.4.4/include
-D__KERNEL__ -Iinclude  -mbig-endian -Wall -Wstrict-prototypes -Wno-trigraphs
-fno-strict-aliasing -fno-common -ffreestanding -O2     -fno-omit-frame-pointer
-g -fno-omit-frame-pointer -mapcs -mno-sched-prolog -mapcs-32
-D__LINUX_ARM_ARCH__=5 -march=armv5te -mtune=xscale -Wa,-mcpu=xscale
-malignment-traps -msoft-float -Uarm -Wdeclaration-after-statement    
-DKBUILD_BASENAME=skbuff -DKBUILD_MODNAME=skbuff -c -o net/core/.tmp_skbuff.o
net/core/skbuff.c

arm-linux-nm net/core/.tmp_skbuff.o |grep that_much
         U __you_cannot_kmalloc_that_much


-- 
           Summary: 3.4 regression: __builtin_constant_p not resolved with -
                    O2
           Product: gcc
           Version: 3.4.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: djohnson+gcc at sw dot starentnetworks dot com
 GCC build triplet: i686-linux
  GCC host triplet: i686-linux
GCC target triplet: arm-linux


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

Reply via email to