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] Avoid infinite loop with duplicate anonymous union fields


On Fri, 27 Jul 2018, Bogdan Harjoc wrote:

> If a struct contains an anonymous union and both have a field with the
> same name, detect_field_duplicates_hash() will replace one of them
> with NULL. If compilation doesn't stop immediately, it may later call
> lookup_field() on the union, which falsely assumes the union's
> LANG_SPECIFIC array is sorted, and may loop indefinitely because of
> this.
> 
> Reproduced on amd64 since gcc-5, on ubuntu-18.04 and gentoo.
> 
> The patch falls back to iterating via DECL_CHAIN if there was an error
> earlier during compilation.

The patch should also add a testcase to the testsuite (which fails before 
and passes after the patch).

> I ran the gcc testsuite with the result (the FAIL seems unrelated to the patch):
> 
> FAIL: gcc.dg/cpp/_Pragma3.c (test for excess errors)

You should use contrib/gcc_update --touch to get timestamps in the right 
order when checking out.  This failure is a symptom of badly ordered 
timestamps.

-- 
Joseph S. Myers
joseph@codesourcery.com


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