This is the mail archive of the gcc-bugs@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]

Re: gcc-2.95.2 compiler bug:


On Sun, 17 Oct 1999, Martin v. Loewis wrote:

> > hm, this one didn't get through because of size restrictions,
> > i'm sending you .gz files now.
> 
> Ok, I can reproduce the problem. There is a serious bug in the code;
> you write
> 
>   BST_DEBUG (SAMPLES, {
>     GList *free_list = bst_sample_repo_list_sample_locs (), *list;
> 
>     for (list = free_list; list; list = list->next)
>       {
> 	BstSampleLoc *loc = list->data;
> 	
> 	g_print ("%s:: %s\n", loc->repo->name, loc->name);
>       }
>     g_list_free (free_list);
>   });
> 
> where BST_DEBUG is
> 
> #define BST_DEBUG(type, code)   G_STMT_START { \
>   if (bst_debug_flags & BST_DEBUG_##type) \
>     { code ; } \
> } G_STMT_END
> 
> Now, the "second" parameter to BST_DEBUG has a number of commas in it,
> which result in many more macro argument. gcc complains but continues,
> giving the preprocessor output.
> 
>   (void)(  { if (bst_debug_flags & BST_DEBUG_SAMPLES ) {   {
>     GList *free_list = bst_sample_repo_list_sample_locs ()  ; } } )  ;
> 
> With that being fixed, gcc complains
> 
> x.c:113: `BstSampleLoc' undeclared (first use in this function)
> x.c:113: (Each undeclared identifier is reported only once
> x.c:113: for each function it appears in.)
> x.c:113: `loc' undeclared (first use in this function)
> 
> which also looks like a genuine bug in your code.

yep, you're right about the macro arguments, but this is not the code i actually
use, it was just an *intermediate* step that was supposed to fail compilation
with something like a parse error from gcc (i was just in the process of
gradually adding debugging support). but because it actually triggered
an internal compiler error, i stopped editing my sources and shrank it down
first to report the bug.

> Since the crash in gcc has an easy work-around (fix the code), it is
> unlikely that anything else will be done about it for gcc 2.95.x

well, it might not have highest priority to fix because its actually invalid
C that triggers the compiler error, but gcc certainly shouldn't *crash* on
this, right?
thanks anyways for your quick responses and looking into this.

> 
> Hope this helps,
> Martin
> 
> 

---
ciaoTJ


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