Mark Mitchell - Re: [PATCH] Fix -Werror bootstrap problem with gcc 4.1 host compiler (original) (raw)

This is the mail archive of the gcc-patches@gcc.gnu.orgmailing 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]

Dirk Mueller wrote:

On Friday, 2. February 2007 17:59, Andi Kleen wrote:

I needed this patch to bootstrap with a gcc 4.1 host compiler. Otherwise -Werror would error out because gcc would think bases can be used uninitialized.

this is PR bootstrap/30510. Patches have been posted several times already.

Interesting. The first (and nearly immediate) use of bases is to take its address and pass it to cp_parser_class_head, which is supposed to initialize it. There is a patch through cp_parser_class_head that doesn't initialize bases, but in that case I think the return value will always be such that we never try to use bases in the parent. But, still, this is unnecessarily playing with fire.

At some point, the "bases" parameter was added to cp_parser_class_head, but no comment was added for it. So, it's not clear whether callers or expected to initialize it, or whether it is the responsibility of cp_parser_class_head itself to do so.

Since there's only one caller, it doesn't matter; the separation between caller and callee is mostly for documentation, in that "class-head" is a separate non-terminal in the C++ grammar. However, in keeping with the handling of the other parameters to cp_parser_class_head, I think it's best for this to be initialized in the callee.

Therefore, I think the best fix is to initialized bases in cp_parser_class_head, along with adding documentation for the parameter.

I think the following documentation would be good:

/* Upon return BASES is initialized to the list of base classes (or NULL, if there are none) in the same form returned by cp_parser_base_clause. */

Would one of you be willing to test such a patch? It's pre-approved, assuming it works.

Thanks,

-- Mark Mitchell CodeSourcery mark@codesourcery.com (650) 331-3385 x713


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