2010年1月28日1:49 Tanaka Akira <akr / fsij.org>:
> 以下のように、
>  exit;if a;end;/[aa]/
>  exit;/[aa]/
> というふたつの文字列を eval したとき、前者に対しては
>  warning: character class has duplicated range: /[aa]/
> という警告が出るのに、後者には出ません。

valgrind で以下のようなのが出てくるんですが、もしかするとこれですかね。

% valgrind ./ruby -w -e 'exit;/[aa]/'
==7830== Memcheck, a memory error detector.
==7830== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==7830== Using LibVEX rev 1854, a library for dynamic binary translation.
==7830== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==7830== Using valgrind-3.3.1-Debian, a dynamic binary instrumentation
framework.
==7830== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
==7830== For more details, rerun with: -v
==7830==
==7830== Conditional jump or move depends on uninitialised value(s)
==7830==    at 0x80E04DF: CC_DUP_WARN (regparse.c:2892)
==7830==    by 0x80E42E8: next_state_val (regparse.c:4186)
==7830==    by 0x80E4F73: parse_char_class (regparse.c:4555)
==7830==    by 0x80E6B57: parse_exp (regparse.c:5388)
==7830==    by 0x80E7083: parse_branch (regparse.c:5544)
==7830==    by 0x80E71EE: parse_subexp (regparse.c:5587)
==7830==    by 0x80E73A5: parse_regexp (regparse.c:5635)
==7830==    by 0x80E7457: onig_parse_make_tree (regparse.c:5662)
==7830==    by 0x80D0C0A: onig_compile (regcomp.c:5391)
==7830==    by 0x80C0A3F: make_regexp (re.c:755)
==7830==    by 0x80C41DA: rb_reg_initialize (re.c:2376)
==7830==    by 0x80C4360: rb_reg_initialize_str (re.c:2402)
-e:1: warning: character class has duplicated range: /[aa]/
==7830==
==7830== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 29 from 1)
==7830== malloc/free: in use at exit: 1,341,790 bytes in 14,652 blocks.
==7830== malloc/free: 15,913 allocs, 1,261 frees, 1,643,306 bytes allocated.
==7830== For counts of detected errors, rerun with: -v
==7830== searching for pointers to 14,652 not-freed blocks.
==7830== checked 855,696 bytes.
==7830==
==7830== LEAK SUMMARY:
==7830==    definitely lost: 20 bytes in 2 blocks.
==7830==      possibly lost: 0 bytes in 0 blocks.
==7830==    still reachable: 1,341,770 bytes in 14,650 blocks.
==7830==         suppressed: 0 bytes in 0 blocks.
==7830== Rerun with --leak-check=full to see details of leaked memory.
-- 
[田中 哲][たなか あきら][Tanaka Akira]