Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

builtin attrs on subrutine declarations #7972

Closed
p5pRT opened this issue Jun 15, 2005 · 7 comments
Closed

builtin attrs on subrutine declarations #7972

p5pRT opened this issue Jun 15, 2005 · 7 comments

Comments

@p5pRT
Copy link

p5pRT commented Jun 15, 2005

Migrated from rt.perl.org#36297 (status was 'resolved')

Searchable as RT36297$

@p5pRT
Copy link
Author

p5pRT commented Jun 15, 2005

From @salva

Created by @salva

Builtin attributes are parsed but ignored on subroutine declarations,
for example​:

$ perl -e 'sub foo : lvalue ; foo = 7; sub foo : lvalue { $a }'
Can't modify non-lvalue subroutine call in scalar assignment at -e
line 1, near "7;"
Execution of -e aborted due to compilation errors.

The patch attached solves the problem.

Cheers,

  - Salvador.

Perl Info

Flags:
    category=core
    severity=medium

Site configuration information for perl v5.8.6:

Configured by salva at Mon Dec  6 18:40:54 CET 2004.

Summary of my perl5 (revision 5 version 8 subversion 6)
configuration:
  Platform:
    osname=linux, osvers=2.4.26-1-686,
archname=i686-linux-thread-multi
    uname='linux cabo 2.4.26-1-686 #1 tue aug 24 13:46:05 jst 2004
i686 gnulinux '
    config_args='-Dusethreads'
    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=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS
-fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64',
    optimize='-O2',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS
-fno-strict-aliasing -pipe -I/usr/local/include'
    ccversion='', gccversion='3.3.5 (Debian 1:3.3.5-2)',
gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define,
longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8,
Off_t='off_t', lseeksize=8
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
    libc=/lib/libc-2.3.2.so, so=so, useshrplib=false,
libperl=libperl.a
    gnulibc_version='2.3.2'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:
    


@INC for perl v5.8.6:
    /usr/local/lib/perl5/5.8.6/i686-linux-thread-multi
    /usr/local/lib/perl5/5.8.6
    /usr/local/lib/perl5/site_perl/5.8.6/i686-linux-thread-multi
    /usr/local/lib/perl5/site_perl/5.8.6
    /usr/local/lib/perl5/site_perl/5.8.3
    /usr/local/lib/perl5/site_perl
    .


Environment for perl v5.8.6:
    HOME=/home/salva
    LANG=en_GB
    LANGUAGE (unset)
    LC_COLLATE=es_ES
    LC_CTYPE=es_ES
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=~/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
    PERL_BADLANG (unset)
    SHELL=/bin/bash


		
__________________________________ 
Discover Yahoo! 
Find restaurants, movies, travel and more fun for the weekend. Check it out! 
http://discover.yahoo.com/weekend.html 

@p5pRT
Copy link
Author

p5pRT commented Jun 15, 2005

From @salva

declare_attr-0.01-patch

@p5pRT
Copy link
Author

p5pRT commented Jun 15, 2005

From @rgs

Salvador "FandiXXo" (via RT) wrote​:

Builtin attributes are parsed but ignored on subroutine declarations,
for example​:

$ perl -e 'sub foo : lvalue ; foo = 7; sub foo : lvalue { $a }'
Can't modify non-lvalue subroutine call in scalar assignment at -e
line 1, near "7;"
Execution of -e aborted due to compilation errors.

The patch attached solves the problem.

Thanks, applied as #24851 to bleadperl.

@p5pRT
Copy link
Author

p5pRT commented Jun 15, 2005

The RT System itself - Status changed from 'new' to 'open'

@p5pRT p5pRT closed this as completed Jun 15, 2005
@p5pRT
Copy link
Author

p5pRT commented Jun 15, 2005

@rgs - Status changed from 'open' to 'resolved'

@p5pRT
Copy link
Author

p5pRT commented Jun 15, 2005

From @salva

just another small patch for a related bug​: subs with builtin
attributes shouldn't become constant subs, for instance​:

$ ./perl -e 'sub foo () : assertion { 7 } ; use assertions "1"; print
foo; use assertions "0"; print foo'
77

Inline Patch
--- ../perl-current/op.c        2005-06-15 16:08:47.000000000 +0100
+++ op.c        2005-06-15 15:30:58.000000000 +0100
@@ -4295,7 +4295,7 @@
     }
 #endif

-    if (!block || !ps || *ps || attrs)
+    if (!block || !ps || *ps || attrs || (CvFLAGS(PL_compcv) &
CVf_BUILTIN_ATTRS))   const\_sv = Nullsv;   else   const\_sv = op\_const\_sv\(block\, Nullcv\);

--- Rafael Garcia-Suarez via RT <perlbug-followup@​perl.org> wrote​:

Salvador "FandiXXo" (via RT) wrote​:

Builtin attributes are parsed but ignored on subroutine
declarations,
for example​:

$ perl -e 'sub foo : lvalue ; foo = 7; sub foo : lvalue { $a }'
Can't modify non-lvalue subroutine call in scalar assignment at
-e
line 1, near "7;"
Execution of -e aborted due to compilation errors.

The patch attached solves the problem.

Thanks, applied as #24851 to bleadperl.

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http​://mail.yahoo.com

@p5pRT
Copy link
Author

p5pRT commented Jun 16, 2005

From @rgs

Salvador "FandiXo" wrote​:

just another small patch for a related bug​: subs with builtin
attributes shouldn't become constant subs, for instance​:

Thanks, applied as change #24865 to bleadperl.

$ ./perl -e 'sub foo () : assertion { 7 } ; use assertions "1"; print
foo; use assertions "0"; print foo'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant