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] Fix PR c/7622


> I think there might be a problem with your patch, I mean the following
> code should issue an error
>
> void foo()
> {
>   auto void bar();
>   bar();
> }
>
> while it does not with this patch, am I wrong?

It certainly should issue an error, but not segfault as it currently does:
test.c: In function `bar':
test.c:25: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.

The faulty definition of the nested bar() should be flagged earlier during 
parsing I think (see c-decl.c:finish_decl).

In any cases, output_inline_function requires DECL_SAVED_INSNS (fn) to be non 
zero, so it makes sense to check that before calling it.

> (my proposed patch for alias PR c/7490 was dealing with this issue also)

I've now read it. It seems that we agree that output_inline_function must be 
guarded by the check on DECL_SAVED_INSNS (fn).

However I'm not convinced that PR c/7490 has something to do with nested 
functions: it seems that the submitter wanted to call a function with another 
name than the original one, by using the "alias" attribute. But, as Richard 
pointed out, the "alias" attribute is a definition, not a declaration. So we 
should again flag the error earlier.

-- 
Eric Botcazou


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