public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix ICE caused by a missing check for DECL_LANG_SPECIFIC
@ 2018-03-01 12:02 Matthew Fortune
  2018-03-01 19:34 ` Jason Merrill
  0 siblings, 1 reply; 4+ messages in thread
From: Matthew Fortune @ 2018-03-01 12:02 UTC (permalink / raw)
  To: jason, gcc-patches

Hi,

It seems we have had a bug for some time that causes an ICE and prevents the
MIPS16 library builds from completing but is likely unrelated to MIPS16.
The problem is when we call target_reinit and library functions get created
as shown in the call stack at the end of this message. The first builtin
that triggers the problem happens to be one of the MIPS16 helpers but I
don't think there is anything unique about it. The issue appeared after some
refactoring work in r253600 where code testing DECL_CLASS_SCOPE_P and
DECL_FRIEND_P was previously guarded by a check for DECL_LANG_SPECIFIC but
not after.

https://gcc.gnu.org/ml/gcc-patches/2017-10/msg00604.html

I don’t know if this is the correct solution or whether we need to change the
way builtins are initialised in the MIPS backend but I suspect this fix
is the right way to go.

Cc: Jason as author of the original change.

Thanks,
Matthew

gcc/cp/
	* pt.c (type_dependent_expression_p): Add missing check for
	DECL_LANG_SPECIFIC.
---
 gcc/cp/pt.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 7345119..c88304f 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -24635,6 +24635,7 @@ type_dependent_expression_p (tree expression)
      type-dependent.  Checking this is important for functions with auto return
      type, which looks like a dependent type.  */
   if (TREE_CODE (expression) == FUNCTION_DECL
+      && DECL_LANG_SPECIFIC (expression)
       && !(DECL_CLASS_SCOPE_P (expression)
 	   && dependent_type_p (DECL_CONTEXT (expression)))
       && !(DECL_FRIEND_P (expression)
-- 
2.2.1


...v3/include/bits/cpp_type_traits.h:408:32: internal compiler error: Segmentation fault
     __miter_base(_Iterator __it)
                                ^
0xd77fff crash_signal
	/scratch/mpf/overtest/64126/240294/shared/gcc/gcc/toplev.c:326
0xd77fff crash_signal
	/scratch/mpf/overtest/64126/240294/shared/gcc/gcc/toplev.c:326
0x74aeb9 type_dependent_expression_p(tree_node*)
	/scratch/mpf/overtest/64126/240294/shared/gcc/gcc/cp/pt.c:24293
0x6cda47 mangle_decl_string
	/scratch/mpf/overtest/64126/240294/shared/gcc/gcc/cp/mangle.c:3740
0x6cdca8 get_mangled_id
	/scratch/mpf/overtest/64126/240294/shared/gcc/gcc/cp/mangle.c:3782
0x6cdf50 mangle_decl(tree_node*)
	/scratch/mpf/overtest/64126/240294/shared/gcc/gcc/cp/mangle.c:3820
0x74aeb9 type_dependent_expression_p(tree_node*)
	/scratch/mpf/overtest/64126/240294/shared/gcc/gcc/cp/pt.c:24293
0x6cda47 mangle_decl_string
	/scratch/mpf/overtest/64126/240294/shared/gcc/gcc/cp/mangle.c:3740
0x6cdca8 get_mangled_id
	/scratch/mpf/overtest/64126/240294/shared/gcc/gcc/cp/mangle.c:3782
0x6cdf50 mangle_decl(tree_node*)
	/scratch/mpf/overtest/64126/240294/shared/gcc/gcc/cp/mangle.c:3820
0x105af90 decl_assembler_name(tree_node*)
	/scratch/mpf/overtest/64126/240294/shared/gcc/gcc/tree.c:673
0xc7d1e8 build_libfunc_function(char const*)
	/scratch/mpf/overtest/64126/240294/shared/gcc/gcc/optabs-libfuncs.c:736
0xc7d717 init_one_libfunc(char const*)
	/scratch/mpf/overtest/64126/240294/shared/gcc/gcc/optabs-libfuncs.c:766
0xc7d79a set_optab_libfunc(optab_tag, machine_mode, char const*)
	/scratch/mpf/overtest/64126/240294/shared/gcc/gcc/optabs-libfuncs.c:804
0x105af90 decl_assembler_name(tree_node*)
	/scratch/mpf/overtest/64126/240294/shared/gcc/gcc/tree.c:673
0xc7d1e8 build_libfunc_function(char const*)
	/scratch/mpf/overtest/64126/240294/shared/gcc/gcc/optabs-libfuncs.c:736
0xc7d717 init_one_libfunc(char const*)
	/scratch/mpf/overtest/64126/240294/shared/gcc/gcc/optabs-libfuncs.c:766
0xc7d79a set_optab_libfunc(optab_tag, machine_mode, char const*)
	/scratch/mpf/overtest/64126/240294/shared/gcc/gcc/optabs-libfuncs.c:804
0x10d49bb mips_init_libfuncs
	/scratch/mpf/overtest/64126/240294/shared/gcc/gcc/config/mips/mips.c:13425
0xd7836c lang_dependent_init_target
	/scratch/mpf/overtest/64126/240294/shared/gcc/gcc/toplev.c:1758
0xd7941c target_reinit()
	/scratch/mpf/overtest/64126/240294/shared/gcc/gcc/toplev.c:1880
0x13e6f55 save_target_globals()
	/scratch/mpf/overtest/64126/240294/shared/gcc/gcc/target-globals.c:86
0x10e0124 mips_set_compression_mode
	/scratch/mpf/overtest/64126/240294/shared/gcc/gcc/config/mips/mips.c:19518
0xa7ee1b invoke_set_current_function_hook
	/scratch/mpf/overtest/64126/240294/shared/gcc/gcc/function.c:4783
0xa88aa7 invoke_set_current_function_hook
	/scratch/mpf/overtest/64126/240294/shared/gcc/gcc/function.c:4918
0xa88aa7 allocate_struct_function(tree_node*, bool)
	/scratch/mpf/overtest/64126/240294/shared/gcc/gcc/function.c:4893
0x10d49bb mips_init_libfuncs
	/scratch/mpf/overtest/64126/240294/shared/gcc/gcc/config/mips/mips.c:13425
0xd7836c lang_dependent_init_target
	/scratch/mpf/overtest/64126/240294/shared/gcc/gcc/toplev.c:1758
0xd7941c target_reinit()
	/scratch/mpf/overtest/64126/240294/shared/gcc/gcc/toplev.c:1880
0x13e6f55 save_target_globals()
	/scratch/mpf/overtest/64126/240294/shared/gcc/gcc/target-globals.c:86
0x10e0124 mips_set_compression_mode
	/scratch/mpf/overtest/64126/240294/shared/gcc/gcc/config/mips/mips.c:19518
0xa7ee1b invoke_set_current_function_hook
	/scratch/mpf/overtest/64126/240294/shared/gcc/gcc/function.c:4783
0xa88aa7 invoke_set_current_function_hook
	/scratch/mpf/overtest/64126/240294/shared/gcc/gcc/function.c:4918
0xa88aa7 allocate_struct_function(tree_node*, bool)
	/scratch/mpf/overtest/64126/240294/shared/gcc/gcc/function.c:4893
0x650ab7 start_preparsed_function(tree_node*, tree_node*, int)
	/scratch/mpf/overtest/64126/240294/shared/gcc/gcc/cp/decl.c:14941
0x670fb6 start_function(cp_decl_specifier_seq*, cp_declarator const*, tree_node*)
	/scratch/mpf/overtest/64126/240294/shared/gcc/gcc/cp/decl.c:15155
0x650ab7 start_preparsed_function(tree_node*, tree_node*, int)
	/scratch/mpf/overtest/64126/240294/shared/gcc/gcc/cp/decl.c:14941
0x670fb6 start_function(cp_decl_specifier_seq*, cp_declarator const*, tree_node*)
	/scratch/mpf/overtest/64126/240294/shared/gcc/gcc/cp/decl.c:15155
0x72b364 cp_parser_function_definition_from_specifiers_and_declarator
	/scratch/mpf/overtest/64126/240294/shared/gcc/gcc/cp/parser.c:26492
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See < /> for instructions.
make[8]: *** [mips-mti-elf/bits/stdc++.h.gch/O2ggnu++0x.gch] Error

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix ICE caused by a missing check for DECL_LANG_SPECIFIC
  2018-03-01 12:02 [PATCH] Fix ICE caused by a missing check for DECL_LANG_SPECIFIC Matthew Fortune
@ 2018-03-01 19:34 ` Jason Merrill
  2018-03-02 13:26   ` Matthew Fortune
  0 siblings, 1 reply; 4+ messages in thread
From: Jason Merrill @ 2018-03-01 19:34 UTC (permalink / raw)
  To: Matthew Fortune; +Cc: gcc-patches List

[-- Attachment #1: Type: text/plain, Size: 1915 bytes --]

On Thu, Mar 1, 2018 at 7:02 AM, Matthew Fortune <mfortune@gmail.com> wrote:
> Hi,
>
> It seems we have had a bug for some time that causes an ICE and prevents the
> MIPS16 library builds from completing but is likely unrelated to MIPS16.
> The problem is when we call target_reinit and library functions get created
> as shown in the call stack at the end of this message. The first builtin
> that triggers the problem happens to be one of the MIPS16 helpers but I
> don't think there is anything unique about it. The issue appeared after some
> refactoring work in r253600 where code testing DECL_CLASS_SCOPE_P and
> DECL_FRIEND_P was previously guarded by a check for DECL_LANG_SPECIFIC but
> not after.
>
> https://gcc.gnu.org/ml/gcc-patches/2017-10/msg00604.html
>
> I don’t know if this is the correct solution or whether we need to change the
> way builtins are initialised in the MIPS backend but I suspect this fix
> is the right way to go.
>
> Cc: Jason as author of the original change.
>
> Thanks,
> Matthew
>
> gcc/cp/
>         * pt.c (type_dependent_expression_p): Add missing check for
>         DECL_LANG_SPECIFIC.
> ---
>  gcc/cp/pt.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
> index 7345119..c88304f 100644
> --- a/gcc/cp/pt.c
> +++ b/gcc/cp/pt.c
> @@ -24635,6 +24635,7 @@ type_dependent_expression_p (tree expression)
>       type-dependent.  Checking this is important for functions with auto return
>       type, which looks like a dependent type.  */
>    if (TREE_CODE (expression) == FUNCTION_DECL
> +      && DECL_LANG_SPECIFIC (expression)
>        && !(DECL_CLASS_SCOPE_P (expression)
>            && dependent_type_p (DECL_CONTEXT (expression)))
>        && !(DECL_FRIEND_P (expression)

I think we want to go into this block when DECL_LANG_SPECIFIC is NULL.
Does this also fix the issue for you?

[-- Attachment #2: friend.diff --]
[-- Type: text/plain, Size: 602 bytes --]

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index e07d77bb87e..f67080fc279 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -24641,7 +24641,8 @@ type_dependent_expression_p (tree expression)
   if (TREE_CODE (expression) == FUNCTION_DECL
       && !(DECL_CLASS_SCOPE_P (expression)
 	   && dependent_type_p (DECL_CONTEXT (expression)))
-      && !(DECL_FRIEND_P (expression)
+      && !(DECL_LANG_SPECIFIC (expression)
+	   && DECL_FRIEND_P (expression)
 	   && (!DECL_FRIEND_CONTEXT (expression)
 	       || dependent_type_p (DECL_FRIEND_CONTEXT (expression))))
       && !DECL_LOCAL_FUNCTION_P (expression))

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] Fix ICE caused by a missing check for DECL_LANG_SPECIFIC
  2018-03-01 19:34 ` Jason Merrill
@ 2018-03-02 13:26   ` Matthew Fortune
  2018-03-02 17:04     ` Jason Merrill
  0 siblings, 1 reply; 4+ messages in thread
From: Matthew Fortune @ 2018-03-02 13:26 UTC (permalink / raw)
  To: 'Jason Merrill'; +Cc: 'gcc-patches List'

Jason Merrill <jason@redhat.com> writes:
> On Thu, Mar 1, 2018 at 7:02 AM, Matthew Fortune <mfortune@gmail.com>
> wrote:
> > Hi,
> >
> > It seems we have had a bug for some time that causes an ICE and
> prevents the
> > MIPS16 library builds from completing but is likely unrelated to
> MIPS16.
> > The problem is when we call target_reinit and library functions get
> created
> > as shown in the call stack at the end of this message. The first
> builtin
> > that triggers the problem happens to be one of the MIPS16 helpers but
> I
> > don't think there is anything unique about it. The issue appeared
> after some
> > refactoring work in r253600 where code testing DECL_CLASS_SCOPE_P and
> > DECL_FRIEND_P was previously guarded by a check for
> DECL_LANG_SPECIFIC but
> > not after.
> >
> > https://gcc.gnu.org/ml/gcc-patches/2017-10/msg00604.html
> >
> > I don’t know if this is the correct solution or whether we need to
> change the
> > way builtins are initialised in the MIPS backend but I suspect this
> fix
> > is the right way to go.
> >
> > Cc: Jason as author of the original change.
> >
> > Thanks,
> > Matthew
> >
> > gcc/cp/
> >         * pt.c (type_dependent_expression_p): Add missing check for
> >         DECL_LANG_SPECIFIC.
> > ---
> >  gcc/cp/pt.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
> > index 7345119..c88304f 100644
> > --- a/gcc/cp/pt.c
> > +++ b/gcc/cp/pt.c
> > @@ -24635,6 +24635,7 @@ type_dependent_expression_p (tree expression)
> >       type-dependent.  Checking this is important for functions with
> auto return
> >       type, which looks like a dependent type.  */
> >    if (TREE_CODE (expression) == FUNCTION_DECL
> > +      && DECL_LANG_SPECIFIC (expression)
> >        && !(DECL_CLASS_SCOPE_P (expression)
> >            && dependent_type_p (DECL_CONTEXT (expression)))
> >        && !(DECL_FRIEND_P (expression)
> 
> I think we want to go into this block when DECL_LANG_SPECIFIC is NULL.
> Does this also fix the issue for you?

Thanks. Yes, this fixes it too. I wasn't sure which of the accessors were
dependent on DECL_LANG_SPECIFIC so ended up with a sledgehammer. 

Matthew

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix ICE caused by a missing check for DECL_LANG_SPECIFIC
  2018-03-02 13:26   ` Matthew Fortune
@ 2018-03-02 17:04     ` Jason Merrill
  0 siblings, 0 replies; 4+ messages in thread
From: Jason Merrill @ 2018-03-02 17:04 UTC (permalink / raw)
  To: Matthew Fortune; +Cc: gcc-patches List

On Fri, Mar 2, 2018 at 8:25 AM, Matthew Fortune <mfortune@gmail.com> wrote:
> Jason Merrill <jason@redhat.com> writes:
>> On Thu, Mar 1, 2018 at 7:02 AM, Matthew Fortune <mfortune@gmail.com>
>> wrote:
>> > Hi,
>> >
>> > It seems we have had a bug for some time that causes an ICE and
>> prevents the
>> > MIPS16 library builds from completing but is likely unrelated to
>> MIPS16.
>> > The problem is when we call target_reinit and library functions get
>> created
>> > as shown in the call stack at the end of this message. The first
>> builtin
>> > that triggers the problem happens to be one of the MIPS16 helpers but
>> I
>> > don't think there is anything unique about it. The issue appeared
>> after some
>> > refactoring work in r253600 where code testing DECL_CLASS_SCOPE_P and
>> > DECL_FRIEND_P was previously guarded by a check for
>> DECL_LANG_SPECIFIC but
>> > not after.
>> >
>> > https://gcc.gnu.org/ml/gcc-patches/2017-10/msg00604.html
>> >
>> > I don’t know if this is the correct solution or whether we need to
>> change the
>> > way builtins are initialised in the MIPS backend but I suspect this
>> fix
>> > is the right way to go.
>> >
>> > Cc: Jason as author of the original change.
>> >
>> > Thanks,
>> > Matthew
>> >
>> > gcc/cp/
>> >         * pt.c (type_dependent_expression_p): Add missing check for
>> >         DECL_LANG_SPECIFIC.
>> > ---
>> >  gcc/cp/pt.c | 1 +
>> >  1 file changed, 1 insertion(+)
>> >
>> > diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
>> > index 7345119..c88304f 100644
>> > --- a/gcc/cp/pt.c
>> > +++ b/gcc/cp/pt.c
>> > @@ -24635,6 +24635,7 @@ type_dependent_expression_p (tree expression)
>> >       type-dependent.  Checking this is important for functions with
>> auto return
>> >       type, which looks like a dependent type.  */
>> >    if (TREE_CODE (expression) == FUNCTION_DECL
>> > +      && DECL_LANG_SPECIFIC (expression)
>> >        && !(DECL_CLASS_SCOPE_P (expression)
>> >            && dependent_type_p (DECL_CONTEXT (expression)))
>> >        && !(DECL_FRIEND_P (expression)
>>
>> I think we want to go into this block when DECL_LANG_SPECIFIC is NULL.
>> Does this also fix the issue for you?
>
> Thanks. Yes, this fixes it too. I wasn't sure which of the accessors were
> dependent on DECL_LANG_SPECIFIC so ended up with a sledgehammer.

Applied.

Jason

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-03-02 17:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-01 12:02 [PATCH] Fix ICE caused by a missing check for DECL_LANG_SPECIFIC Matthew Fortune
2018-03-01 19:34 ` Jason Merrill
2018-03-02 13:26   ` Matthew Fortune
2018-03-02 17:04     ` Jason Merrill

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).