develooper Front page | perl.perl5.porters | Postings from February 2013

[perl #116989] S_croak_memory_wrap breaks gcc warning flags detection

Thread Next
From:
Andy Dougherty
Date:
February 28, 2013 13:41
Subject:
[perl #116989] S_croak_memory_wrap breaks gcc warning flags detection
Message ID:
rt-3.6.HEAD-31961-1362058874-1863.116989-75-0@perl.org
# New Ticket Created by  Andy Dougherty 
# Please include the string:  [perl #116989]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=116989 >


This is a bug report for perl from doughera@lafayette.edu,
generated with the help of perlbug 1.39 running under perl 5.17.10


-----------------------------------------------------------------
[Please describe your issue here]

This commit:

commit f019c49e380f764c1ead36fe3602184804292711
Author: Daniel Dragan <bulk88@hotmail.com>
Date:   Wed Oct 24 16:15:51 2012 -0400

    optimize memory wrap croaks, often used in MEM_WRAP_CHECK

breaks the detection of gcc warning flags by cflags.SH to break.
The cflags.SH script tries to build a simple program that includes the
perl headers and compiles them with various gcc flags.  
All those tests now fail with the error message:

/tmp/cc2FFrOt.o: In function `S_croak_memory_wrap':
_cflags.c:(.text+0x5): undefined reference to `PL_memory_wrap'
_cflags.c:(.text+0x14): undefined reference to `Perl_croak'
collect2: error: ld returned 1 exit status

Prior to this patch, the typical command line used with gcc is something
like this:

	  CCCMD =  cc -DPERL_CORE -c -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64  -std=c89 -O2  -Wall -ansi -W -Wextra -Wdeclaration-after-statement -Wendif-labels -Wc++-compat -Wwrite-strings 

Now, it is something like

	  CCCMD =  cc -DPERL_CORE -c -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64  -O2  -Wall 

Note that all the extra warnings are missing.

The new function S_croak_memory_wrap in inline.h is the culprit.
Only static inline functions are supposed to be in inline.h.  Making
S_croak_memory_wrap a PERL_STATIC_INLINE function fixes the immediate
problem, but defeats the purpose of the original patch.  (croaking is
definitely not something that normally needs to be inlined.)


[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=install
    severity=medium
---
Site configuration information for perl 5.17.10:

Configured by doughera at Thu Feb 28 08:20:41 EST 2013

Summary of my perl5 (revision 5 version 17 subversion 10) configuration:
  Commit id: 41191e557c536be3754384dee54e7700ca3df256
  Platform:
    osname=linux, osvers=3.2.0-4-amd64, archname=x86_64-linux
    uname='linux ooo 3.2.0-4-amd64 #1 smp debian 3.2.35-2 x86_64 gnulinux '
    config_args='-Dusedevel -Dprefix=/opt/perl -des'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2',
    cppflags='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
    ccversion='', gccversion='4.7.2', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -fstack-protector -L/usr/local/lib'
    libpth=/usr/local/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib /usr/lib
    libs=-lnsl -ldl -lm -lcrypt -lutil -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
    libc=, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.13'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector'


Characteristics of this binary (from libperl): 
  Compile-time options: HAS_TIMES PERLIO_LAYERS PERL_DONT_CREATE_GVSV
                        PERL_MALLOC_WRAP PERL_NEW_COPY_ON_WRITE
                        PERL_PRESERVE_IVUV PERL_USE_DEVEL USE_64_BIT_ALL
                        USE_64_BIT_INT USE_LARGE_FILES USE_LOCALE
                        USE_LOCALE_COLLATE USE_LOCALE_CTYPE
                        USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF
  Built under linux
  Compiled at Feb 28 2013 08:18:50
  @INC:
    lib
    /opt/perl/lib/site_perl/5.17.10/x86_64-linux
    /opt/perl/lib/site_perl/5.17.10
    /opt/perl/lib/5.17.10/x86_64-linux
    /opt/perl/lib/5.17.10
    /opt/perl/lib/site_perl
    .


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About