Philosophical question on dependencies, etc.

Brooks Moses brooks.moses@codesourcery.com
Thu Nov 9 10:09:00 GMT 2006


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



More information about the Fortran mailing list