This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: PR middle-end/29862: Calling a function with gcc_assert


On Wed, 2006-11-15 at 22:11 -0500, Kaveh R. GHAZI wrote:
> On Wed, 15 Nov 2006, H. J. Lu wrote:
> 
> > We shouldn't call mpfr_set_str with gcc_assert since it leads to
> > mpfr_set_str is only called when runtime check is enabled. This
> > patch fixes it.
> > H.J.
> 
> Actually that's not true.  The definition of gcc_assert evaluates the
> argument >even when assert checking is turned off<.  Look at the
> definition in system.h.
> 
> However if you feel the code as I wrote it is misleading to the average
> person, I have no objection to your change.

Actually it does not evaluate the expression:
/* Include EXPR, so that unused variable warnings do not occur.  */
#define gcc_assert(EXPR) ((void)(0 && (EXPR)))

&& does a short cut so (EXPR) never gets evaluated.  (maybe you are looking at
too much fortran lately).


Thanks,
Andrew Pinski

PS I think the patch is obvious.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]