This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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: Philosophical question on dependencies, etc.


FX Coudert wrote:
And, if there should be some active checking, is a gcc_assert() a sufficient way of doing it? From a cursory glance, it looks like gcc_assert() is defined as a no-op in everything but Stage 1, which I think would mean that it's largely a no-op in anything meaningful with gfortran

No, it's not. When the assert if false, it actually triggers an ICE with front-end file and line number displayed. I don't know how it does that (and can't look right now), but I'm pretty sure it does.

In gcc/system.h, it's defined as follows (slightly reformatted to avoid line-wrapping):


#if ENABLE_ASSERT_CHECKING
#define gcc_assert(EXPR) 				\
  ((void)(!(EXPR)?fancy_abort (__FILE__, __LINE__, __FUNCTION__),0:0))
#else
/* Include EXPR, so that unused variable warnings do not occur.  */
#define gcc_assert(EXPR) ((void)(0 && (EXPR)))
#endif

I had thought that the only definition of ENABLE_ASSERT_CHECKING was in the part of gcc/Makefile.in that defines STAGE1_CHECKING, which would mean that the #else half of that definition would apply to everything outside of stage 1, which led to my initial post.

However, after a bit more investigation just now, I see that configure appears to also define ENABLE_ASSERT_CHECKING based on the value of the "--enable-checking" option, with the default being to enable asserts in both release and non-release versions.

Thanks!
- Brooks


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