public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Paul Smith <paul@mad-scientist.net>
To: "gcc@gcc.gnu.org" <gcc@gcc.gnu.org>
Subject: Re: ICE with precompiled headers (GCC 8.1)
Date: Wed, 01 May 2019 15:04:00 -0000	[thread overview]
Message-ID: <e9ef7b772d8c222e1e5dbd73ee5d9a0eba936dc2.camel@mad-scientist.net> (raw)
In-Reply-To: <42b8330f0d75562fcab205c0ea5ea92b96654bae.camel@mad-scientist.net>

On Wed, 2019-05-01 at 09:35 -0400, Paul Smith wrote:
> > Unfortunately my GCC is heavily optimized and stripped so backtraces
> > are useless.  I will generate a debuggable GCC and see if I can get
> > more info on the ICE.
> 
> I have created a GCC with debug enabled so I'll see what I find.

I was able to reproduce this ICE quite readily with my debuggable GCC
8.1.0.  Here's the failure:

<command-line>: internal compiler error: Segmentation fault
0x9cae61 crash_signal
        /work/src/cc/gcc-8.1.0/gcc/toplev.c:325
0x1293778 apply_vpath
        /work/src/cc/gcc-8.1.0/libcpp/mkdeps.c:127
0x1293acc deps_add_dep(deps*, char const*)
        /work/src/cc/gcc-8.1.0/libcpp/mkdeps.c:258
0x1293fe3 deps_restore(deps*, _IO_FILE*, char const*)
        /work/src/cc/gcc-8.1.0/libcpp/mkdeps.c:432
0x129535b cpp_read_state(cpp_reader*, char const*, _IO_FILE*, save_macro_data*)
        /work/src/cc/gcc-8.1.0/libcpp/pch.c:884
0x596d59 c_common_read_pch(cpp_reader*, char const*, int, char const*)
        /work/src/cc/gcc-8.1.0/gcc/c-family/c-pch.c:373
0x12872fe should_stack_file
        /work/src/cc/gcc-8.1.0/libcpp/files.c:814
0x12874f1 _cpp_stack_file
        /work/src/cc/gcc-8.1.0/libcpp/files.c:900
0x12876a7 _cpp_stack_include
        /work/src/cc/gcc-8.1.0/libcpp/files.c:1049
0x1287b22 cpp_push_include(cpp_reader*, char const*)
        /work/src/cc/gcc-8.1.0/libcpp/files.c:1484
0x5943ec push_command_line_include
        /work/src/cc/gcc-8.1.0/gcc/c-family/c-opts.c:1483
0x594615 c_finish_options
        /work/src/cc/gcc-8.1.0/gcc/c-family/c-opts.c:1452
0x5963a2 c_common_parse_file()
        /work/src/cc/gcc-8.1.0/gcc/c-family/c-opts.c:1126

Unsurprisingly the problem is that the "deps" data member in
cpp_reader* is null:

#0  apply_vpath (d=d@entry=0x0,
    t=t@entry=0x2174860 "/src/foo_pch.h") at /work/src/cc/gcc-8.1.0/libcpp/mkdeps.c:127
#1  0x0000000001293acd in deps_add_dep (d=d@entry=0x0,
    t=t@entry=0x2174860 "/src/foo_pch.h") at /work/src/cc/gcc-8.1.0/libcpp/mkdeps.c:258
#2  0x0000000001293fe4 in deps_restore (deps=0x0, fd=fd@entry=0x2171750,
    self=self@entry=0x2106810 "/src/obj/foo_pch.h.gch")
    at /work/src/cc/gcc-8.1.0/libcpp/mkdeps.c:432
#3  0x000000000129535c in cpp_read_state (r=r@entry=0x20f4d60,
    name=name@entry=0x2106810 "/src/obj/foo_pch.h.gch", f=f@entry=0x2171750, data=0x210bce0)
    at /work/src/cc/gcc-8.1.0/libcpp/pch.c:884

I have no idea whether the problem is that it should never be possible
for "deps" to be null, or whether the problem is that we're not
checking for that possibility when we should be.

I'm building the current GCC 9.0.1 prerelease to see if I can reproduce
it there.

Once again removing -fpch-deps solves the problem.  I can only assume
that without that flag we never bother to walk the deps data member at
all.

  reply	other threads:[~2019-05-01 15:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-30 14:02 Paul Smith
2019-04-30 15:34 ` Zan Lynx
2019-04-30 17:04   ` Paul Smith
2019-05-01 13:35 ` Paul Smith
2019-05-01 15:04   ` Paul Smith [this message]
2019-05-01 23:42     ` Paul Smith
2019-05-02 11:12     ` Nathan Sidwell

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=e9ef7b772d8c222e1e5dbd73ee5d9a0eba936dc2.camel@mad-scientist.net \
    --to=paul@mad-scientist.net \
    --cc=gcc@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).