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

possible constant sub optimizer bug?

Thread Next
From:
John L. Allen
Date:
February 25, 2006 15:42
Subject:
possible constant sub optimizer bug?
Message ID:
Pine.GSO.4.53.0602251553520.13443@gateway.northropgrumman.com

I've built perl 588 on AIX 5.1 with 64 bits and threads.  Attempting to
build IO::Tty 1.02, and during make test, I get a strange message:

  trying to open /dev/pts/11...
  Use of uninitialized value in ioctl at \
        /tmp/perlbuild/IO-Tty-1.02/blib/lib/IO/Pty.pm line 119.
  warning: TIOCSCTTY failed, slave might not be set as controlling terminal:
        A system call received a parameter that is not valid. at
        /tmp/perlbuild/IO-Tty-1.02/blib/lib/IO/Pty.pm line 120.

Now, line 119 of Pty.pm is below:

118:  if (defined TIOCSCTTY) {
119:    if (not defined ioctl( ${*$self}{'io_pty_slave'}, TIOCSCTTY, 0 )) {
120:      warn "warning: TIOCSCTTY failed, slave might not be set as
		controlling terminal: $!" if $^W;
121:    }
122:  }

So the TIOCSCTTY being passed to ioctl() is not defined, but we just
checked for that on line 118!  The odd thing is that the constant sub
TIOCSCTTY really is undef on AIX, and perl know it in simpler test cases.
It was declared via this code during build time:

  newCONSTSUB(stash, "TIOCSCTTY", &PL_sv_undef);

It turns out that I can prevent the problem by inserting this line in
Pty.pm:

  BEGIN { TIOCSCTTY; }

So, does doing this somehow make the optimizer not eliminate the constant
sub TIOCSCTTY?  Could that be what is going on here?

Unfortunately, I can't devise a simpler test case...yet.

John.

$ perl588 -V
Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
  Platform:
    osname=aix, osvers=5.1.0.0, archname=aix-thread-multi-64int-ld
    uname='aix baewi168 1 5 0001542a4c00 '
    config_args='-des -Dprefix=/prod/free/perl588 -Dusemorebits
-Dusethreads -Dcc=xlc -Accflags=-DAPPLLIB_EXP=\"/prod/libperl\"'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=define use5005threads=undef useithreads=define
usemultiplicity=define
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=define use64bitall=undef uselongdouble=define
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc_r', ccflags ='-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE
-qmaxmem=-1 -qnoansialias -qlongdouble -DUSE_NAT
IVE_DLOPEN -DAPPLLIB_EXP="/prod/libperl" -DNEED_PTHREAD_INIT -q32
-D_LARGE_FILES -qlonglong',
    optimize='-O',
    cppflags='-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE -qmaxmem=-1
-qnoansialias -qlongdouble -DUSE_NATIVE_DLOPEN
-DAPPLLIB_EXP="/prod/libperl" -DNEED_PTHREAD_INIT'
    ccversion='5.0.2.8', gccversion='', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=87654321
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long long', ivsize=8, nvtype='long double', nvsize=16,
Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='ld', ldflags =' -brtl -bdynamic -bmaxdata:0x80000000 -b32'
    libpth=/lib /usr/lib /usr/ccs/lib
    libs=-lc128 -lbind -lnsl -ldbm -ldl -lld -lm -lcrypt -lpthreads -lc
-lbsd
    perllibs=-lc128 -lbind -lnsl -ldl -lld -lm -lcrypt -lpthreads -lc
-lbsd
    libc=/lib/libc.a, so=a, useshrplib=false, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_aix.xs, dlext=so, d_dlsymun=undef, ccdlflags='
-bE:/prod/free/perl588/lib/5.8.8/aix-thread-multi-64int-ld/CORE/perl.exp'
    cccdlflags=' ', lddlflags='-bhalt:4 -bexpall -G -bnoentry -lc128
-lpthreads -lc'


Characteristics of this binary (from libperl):
  Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT USE_64_BIT_INT
                        USE_ITHREADS USE_LARGE_FILES USE_LONG_DOUBLE
                        USE_PERLIO USE_REENTRANT_API
  Built under aix
  Compiled at Feb 24 2006 14:26:24
  @INC:
    /prod/libperl/5.8.8
    /prod/libperl
    /prod/free/perl588/lib/5.8.8/aix-thread-multi-64int-ld
    /prod/free/perl588/lib/5.8.8
    /prod/free/perl588/lib/site_perl/5.8.8/aix-thread-multi-64int-ld
    /prod/free/perl588/lib/site_perl/5.8.8
    /prod/free/perl588/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