From hb at stat.berkeley.edu  Wed Sep 22 06:52:07 2010
From: hb at stat.berkeley.edu (Henrik Bengtsson)
Date: Tue, 21 Sep 2010 21:52:07 -0700
Subject: [Rd] Crash report: regexpr("a{2-}", "")
In-Reply-To: <DB03C938-7BA3-4464-BF2C-506E33C9549B@comcast.net>
References: <AANLkTinxcpVMmZ6w6vRL74Xa8fSFUcVFV2t6t3sKszAG@mail.gmail.com>
	<B5067C6B-B806-4632-A58B-9F293CD52D3F@comcast.net>
	<AANLkTik=5K-2yiOrgx7bUp-vta2vx4pEg7b=BdpK2D6U@mail.gmail.com>
	<DB03C938-7BA3-4464-BF2C-506E33C9549B@comcast.net>
Message-ID: <AANLkTik8Bybanwap-8iTcozwNdUr2VDZHizCA6XdRfB+@mail.gmail.com>

On Tue, Sep 21, 2010 at 9:20 PM, David Winsemius <dwinsemius at comcast.net> wrote:
>
> On Sep 22, 2010, at 12:12 AM, Henrik Bengtsson wrote:
>
>> David's post made me realize that I got the sub()/gsub() lines wrong.
>> It should be:
>>
>> regexpr("a{2-}", "")
>> sub("a{2-}", "", "")
>> gsub("a{2-}", "", "")
>>
>
> Still no crash on a Mac. Did you mean to include a third argument to
> regexpr() as you did for sub and gsub?

No, it was only that sub()/gsub() needs at least three arguments while
regexpr() only needs two, and did a simple cut'n'paste when I wrote
the original message.  All three commands probably use the same
underlying regular expression library, so it is likely it is same bug.

It looks like at least on your OS/R version it does not crash.

/Henrik

>
> --
> David.
>>
>> Either way, the crash is there, at on least Windows and Linux.
>>
>> /Henrik
>>
>> On Tue, Sep 21, 2010 at 8:43 PM, David Winsemius <dwinsemius at comcast.net>
>> wrote:
>>>
>>> On Sep 21, 2010, at 11:04 PM, Henrik Bengtsson wrote:
>>>
>>>> Each of the following calls crash ("core dumps") R (R --vanilla) on
>>>> various versions and OSes:
>>>>
>>>> regexpr("a{2-}", "")
>>>> sub("a{2-}", "")
>>>> gsub("a{2-}", "")
>>>>
>>>>
>>>> EXAMPLES:
>>>>
>>>>> sessionInfo()
>>>>
>>>> R version 2.11.1 Patched (2010-09-16 r52949)
>>>> Platform: i386-pc-mingw32 (32-bit)
>>>> ...
>>>>>
>>>>> regexpr("a{2-}", "")
>>>>
>>>> Assertion failed: iter->max == -1 || iter->max == 1, file
>>>> tre-compile.c, line 1825
>>>> This application has requested the Runtime to terminate it in an unusual
>>>> way.
>>>> Please contact the application's support team for more information.
>>>>
>>>>> sessionInfo()
>>>>
>>>> R version 2.12.0 Under development (unstable) (2010-09-14 r52910)
>>>> Platform: i386-pc-mingw32/i386 (32-bit)
>>>> ...
>>>>>
>>>>> regexpr("a{2-}", "")
>>>>
>>>> Assertion failed: iter->max == -1 || iter->max == 1, file
>>>> tre-compile.c, line 1825
>>>> This application has requested the Runtime to terminate it in an unusual
>>>> way.
>>>> Please contact the application's support team for more information.
>>>>
>>>>
>>>>> sessionInfo()
>>>>
>>>> R version 2.11.0 Patched (2010-05-09 r51960)
>>>> x86_64-unknown-linux-gnu
>>>> ...
>>>>>
>>>>> regexpr("a{2-}", "")
>>>>
>>>> R: tre-compile.c:1825: tre_ast_to_tnfa: Assertion `iter->max == -1 ||
>>>> iter->max == 1' failed.
>>>> Aborted
>>>
>>> Not a problem in reasonably current Mac with 64bit GUI:
>>>>
>>>> regexpr("a{2-}", "")
>>>
>>> [1] 1
>>> attr(,"match.length")
>>> [1] 0
>>>>
>>>> sub("a{2-}", "")
>>>
>>> Error in is.character(x) : 'x' is missing
>>>>
>>>> gsub("a{2-}", "")
>>>
>>> Error in is.character(x) : 'x' is missing
>>>
>>> R version 2.11.1 Patched (2010-08-26 r52822)
>>> Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
>>> [R.app GUI 1.35 (5612) x86_64-apple-darwin9.8.0]
>>>
>>> --
>>> David.
>>>>
>>>>
>>>> /Henrik
>>>>
>>>> ______________________________________________
>>>> R-devel at r-project.org mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>>
>>> ______________________________________________
>>> R-devel at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>>
>
>



[Rd] Crash report: regexpr("a{2-}", "")
Henrik Bengtsson