This is the mail archive of the
mailing list for the GCC project.
Re: PATCH: PR middle-end/29862: Calling a function with gcc_assert
On Wed, Nov 15, 2006 at 10:11:10PM -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.
I guess we are looking at different gcc_assert. I have
/* Use gcc_assert(EXPR) to test invariants. */
((void)(!(EXPR) ? fancy_abort (__FILE__, __LINE__, __FUNCTION__), 0 : 0))
/* Include EXPR, so that unused variable warnings do not occur. */
#define gcc_assert(EXPR) ((void)(0 && (EXPR)))
in system.h. If ENABLE_RUNTIME_CHECKING isn't define, I get
((void)(0 && (mpfr_set_str (m, buf, 16, GMP_RNDN) == 0)));
and gcc may not call mpfr_set_str. What do you have?