MathGroup Archive 2001

[Date Index] [Thread Index] [Author Index]

Search the Archive

Serious bug in MatchQ causes crashes and incorrect results

  • To: mathgroup at
  • Subject: [mg28206] Serious bug in MatchQ causes crashes and incorrect results
  • From: Jeff DuMonthier <jeff at>
  • Date: Wed, 4 Apr 2001 04:13:28 -0400 (EDT)
  • Organization: NASA GSFC
  • Sender: owner-wri-mathgroup at

I recently posted a question in this group asking how I could do complex
pattern matching and default arguments in function (delayed set)
definitions.  The best way seemed to be to use the argument list
definition for the defaults and MatchQ in the body to check arguments.
This is an example of what I was doing:

getFile[dirs_:{},file_]:=Module[{ vars... },

If[! MatchQ[dirs,{_String...}], Message[getFile::err1];Abort[] ];


Although my test cases worked, when I tried to actually use the code I
encountered serious problems.

Running version 4.0.1 for Macintosh (OS 9.1) I started experiencing
frequent system crashes (freezing).  Usually this would occur while one
of these functions was being executed.  Once it froze when closing the
help browser.   I edited just the MatchQ expressions out of the code and
it ran with no problems.

Running version 3.0 under Solaris the MatchQ conditions did not always
return the correct results.  For example, the code fragment above would
usually but not always abort on the check shown, even when the first
argument was a list containing one or more strings, i.e. {"aaa"}.

This is the first case I have found (without using Mathlink) where
Mathematica crashes or returns erroneous and inconsistent results rather
than cryptic error messages.


  • Prev by Date: Help
  • Next by Date: Re: Re: Strange error message from NIntegrate
  • Previous by thread: Re: Help
  • Next by thread: Re: Serious bug in MatchQ causes crashes and incorrect results