bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bison torture test speedup: `assert (x);' -> `if (! (x)) abort ();'


From: Akim Demaille
Subject: Re: Bison torture test speedup: `assert (x);' -> `if (! (x)) abort ();'
Date: 12 Nov 2002 09:29:49 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Honest Recruiter)

| > From: Akim Demaille <address@hidden>
| > Date: 12 Nov 2002 08:54:49 +0100
| > 
| > Err...  This is shocking!  What is the difference between assert and 
if/abort???
| 
| assert (FOO) preprocesses into this code:
| 
|   (void)((FOO) || (__assert("1", "t.c", 6), 0));
| 
| whereas 'if (! (FOO)) abort ();' is unaffected by the preprocessor.
| 
| My vague impression is that the GCC optimizer spends a lot of time
| optimizing the assert code, whereas the abort code is easily
| optimized.  I compile with "gcc -O -Wall" so it's important for me for
| the torture test to work well even if optimization is turned on.

Same here.

| Typically, the GNU style is to use abort rather than assert, since we
| assume that one has a debugger at hand at all times, so it's not too
| surprising that assert isn't tuned well with GCC.

So I guess we should remove all the asserts from bison itself.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]