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
print(do {} . "foo") gives unexpected result #6186
Comments
From b.wage@xs4all.nlCreated by b.wage@xs4all.nlThe following line of code prints one line on standard output: print($x = (do {} . "This should be printed twice.\n")); print $x; I would have expected that it prints the line twice, as the value The documentation says do BLOCK in this case there *is* no last command in the sequence of commands Thanks, Bart Wage Perl Info
|
From perlbug-followup@perl.org[resent by popular demand -rs] The following line of code prints one line on standard output: print($x = (do {} . "This should be printed twice.\n")); print $x; I would have expected that it prints the line twice, as the value The documentation says do BLOCK in this case there *is* no last command in the sequence of commands Thanks, Bart Wage |
From perl5-porters@ton.iguana.beIn article <m3k7h8ky6q.wl_rspier@pobox.com>,
Can in fact easily be transformed into a coredump: |
From @audreytOn Tue, Jan 14, 2003 at 10:54:43PM +0000, Ton Hospel wrote:
Here in maintperl (MAINT18448), the first example prints two lines /Autrijus/ |
From @rgsAutrijus Tang <autrijus@autrijus.org> wrote:
Seems to be fixed in blead too. Here's a test case : Index: t/op/do.t--- t/op/do.t (revision 581) -print "1..21\n"; # Test do &sub and proper @_ handling. # 6 must be interpreted as a file name here END { |
From @nwc10On Wed, Jan 15, 2003 at 10:39:29AM +0100, Rafael Garcia-Suarez wrote:
It's "fixed" in 5.8.0 if you run it under valgrind: $ /usr/local/bin/perl5.8.0 -wle '$z=5+($x = do {} . 2)' Notice that it now thinks that there is a syntax error. Also. 5.6.1 doesn't give the use of unitialised value warning, whereas 5.8 perl5.6.1 -wle '$z=5+($x = do {} . 2)' and the coredump from 5.8? Program received signal SIGSEGV, Segmentation fault. (gdb) print *sp[-1] I believe there's more to this one than meets the eye. Can anyone run purify, Nicholas Clark |
From @nwc10On Wed, Jan 15, 2003 at 10:39:05AM +0000, Nicholas Clark wrote:
Oops. Maybe I was premature: $ perl5.8.0 -wle 'print 1, 2, 3, 4' It looks like do {} was doing something evil to the stack, but it is fixed $ perl5.6.1 -Ilib -wle 'print 1, 2, 3, do {}, 4' although there's a bug introduced between 5.6.0 and 5.6.1: $ perl5.6.0 -wle 'print do {} . 4' Hmm: (doesn't print 4) Nicholas Clark |
@rspier - Status changed from 'new' to 'resolved' |
Migrated from rt.perl.org#19545 (status was 'resolved')
Searchable as RT19545$
The text was updated successfully, but these errors were encountered: