Re: [PATCH] Fix ICE caused by a missing check for DECL_LANG_SPECIFIC

2018-03-02 Thread Jason Merrill
On Fri, Mar 2, 2018 at 8:25 AM, Matthew Fortune  wrote:
> Jason Merrill  writes:
>> On Thu, Mar 1, 2018 at 7:02 AM, Matthew Fortune 
>> 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


RE: [PATCH] Fix ICE caused by a missing check for DECL_LANG_SPECIFIC

2018-03-02 Thread Matthew Fortune
Jason Merrill  writes:
> On Thu, Mar 1, 2018 at 7:02 AM, Matthew Fortune 
> 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



Re: [PATCH] Fix ICE caused by a missing check for DECL_LANG_SPECIFIC

2018-03-01 Thread Jason Merrill
On Thu, Mar 1, 2018 at 7:02 AM, Matthew Fortune  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?
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))


[PATCH] Fix ICE caused by a missing check for DECL_LANG_SPECIFIC

2018-03-01 Thread Matthew Fortune
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()