Skip to content

Commit

Permalink
Correct stupidities in 4c3ac4b
Browse files Browse the repository at this point in the history
Allocating an extra SV for rare edge cases...er...only needs to be
done in those rare edge cases.

Uninitialized warnings are only supposed to be enabled when they are.
  • Loading branch information
Father Chrysostomos committed Apr 7, 2011
1 parent 4c3ac4b commit 837c879
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pp_hot.c
Expand Up @@ -501,10 +501,13 @@ PP(pp_add)
svl = TOPm1s;

useleft = USE_LEFT(svl);
if(useleft && svr == svl) {
if(useleft && svr == svl && SvGMAGICAL(svl)) {
/* Print the uninitialized warning now, so it includes the vari-
able name. */
if (!SvOK(svl)) report_uninit(svl), useleft = 0;
if (!SvOK(svl)) {
if (ckWARN(WARN_UNINITIALIZED)) report_uninit(svl);
useleft = 0;
}
/* Non-magical sv_mortalcopy */
svl = sv_newmortal();
sv_setsv_flags(svl, svr, 0);
Expand Down
2 changes: 2 additions & 0 deletions t/lib/warnings/9uninit
Expand Up @@ -694,6 +694,8 @@ sub FETCH { undef }

tie my $m1, "";
my $v = $m1 + $m1;
no warnings;
$v = $m1 + $m1;
EXPECT
Use of uninitialized value $m1 in addition (+) at - line 6.
Use of uninitialized value $m1 in addition (+) at - line 6.
Expand Down

0 comments on commit 837c879

Please sign in to comment.