issue42.t 789 B

12345678910111213141516171819202122232425262728
  1. #! /usr/bin/env perl
  2. # http://code.google.com/p/perl-compiler/issues/detail?id=42
  3. # B::CC uses value from void context in next list context
  4. use Test::More tests => 1;
  5. use strict;
  6. BEGIN {
  7. unshift @INC, 't';
  8. require TestBC;
  9. }
  10. # Explanation:
  11. # - f1 is called, it puts value 1 on the stack.
  12. # - f2 should discard this value, because f1 is called in void context.
  13. # - But if a block follows, this value is accidently added to the list
  14. # of return values of f2.
  15. my $script = <<'EOF';
  16. sub f1 { 1 }
  17. f1();
  18. print do { 7; 2 }, "\n";
  19. EOF
  20. TODO: {
  21. local $TODO = "broken with 5.24" if $] > 5.023007;
  22. # fixed with r596. remove enter/leave from %no_stack, sp sync.
  23. ctest(1, '^2$', "CC", "ccode42i", $script,
  24. 'CC uses value from void context in next list context, fixed with r596');
  25. }