public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Bogdan Harjoc <harjoc@gmail.com>
To: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Avoid infinite loop with duplicate anonymous union fields
Date: Tue, 31 Jul 2018 09:56:00 -0000	[thread overview]
Message-ID: <CAF4+tmqXdimzC0DyZFDb+m8=VxOaKijKa5q5-K2AC333k9Bskg@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1807271700570.15481@digraph.polyomino.org.uk>

With fresh git sources and contrib/gcc_update the tests pass:

=== gcc Summary ===

# of expected passes 133500
# of expected failures 422
# of unsupported tests 2104

gcc-build/gcc/xgcc  version 9.0.0 20180730 (experimental) (GCC)

I wasn't able to reduce the input to avoid including <time.h> and as
it only reproduces without -save-temps, it's not clear how to write a
testcase for this one.

On Fri, Jul 27, 2018 at 8:01 PM, Joseph Myers <joseph@codesourcery.com> wrote:
> 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

  reply	other threads:[~2018-07-31  9:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-27 10:27 Bogdan Harjoc
2018-07-27 17:02 ` Joseph Myers
2018-07-31  9:56   ` Bogdan Harjoc [this message]
2018-07-31 17:45     ` Richard Sandiford
2018-07-31 19:43     ` Joseph Myers
2018-07-31 22:03       ` Bogdan Harjoc
2018-07-31 22:20         ` Joseph Myers
2018-08-01 14:26           ` Bogdan Harjoc
2018-08-03 15:26             ` Joseph Myers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAF4+tmqXdimzC0DyZFDb+m8=VxOaKijKa5q5-K2AC333k9Bskg@mail.gmail.com' \
    --to=harjoc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).