On Tue, Oct 9, 2018 at 11:39 PM Paul Koning <paulkon...@comcast.net> wrote:
>
>
>
> > On Jul 17, 2018, at 9:36 AM, Richard Biener <richard.guent...@gmail.com> 
> > wrote:
> >
> > On Tue, Jul 17, 2018 at 3:08 PM Paul Koning <paulkon...@comcast.net> wrote:
> >>
> >>
> >>> On Jul 17, 2018, at 5:46 AM, Richard Biener <richard.guent...@gmail.com> 
> >>> wrote:
> >>>
> >>>> ...
> >>>
> >>> There is not enough information for anyone to help you without
> >>> reproducing the issue which is maybe too much to ask for ;)
> >>>
> >>> Can you debug_tree () the offending decl in gdb?
> >>
> >> Yes, here it is.  I don't know anything about debugging in this area, so 
> >> tools like debug_tree are good to learn about.  How would I interpret its 
> >> output?
> >>
> >> pkoning:gcc pkoning$ lldb ./cc1plus -- new_opa.ii -fno-implicit-templates 
> >> -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi 
> >> -fdiagnostics-show-location=once -frandom-seed=new_opa.lo -g -O2 
> >> -std=gnu++1z
> >> (lldb) target create "./cc1plus"
> >> Current executable set to './cc1plus' (x86_64).
> >> ...
> >> Process 10880 stopped
> >> * thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
> >>    frame #0: 0x0000000100c21378 cc1plus`internal_error(gmsgid="in %s, at 
> >> %s:%d") at diagnostic.c:1441 [opt]
> >>   1438 internal_error (const char *gmsgid, ...)
> >>   1439 {
> >>   1440   va_list ap;
> >> -> 1441   va_start (ap, gmsgid);
> >>   1442   rich_location richloc (line_table, input_location);
> >>   1443   diagnostic_impl (&richloc, -1, gmsgid, &ap, DK_ICE);
> >>   1444   va_end (ap);
> >> Target 0: (cc1plus) stopped.
> >> (lldb) frame sel 2
> >> frame #2: 0x0000000100074b36 
> >> cc1plus`import_export_decl(decl=0x000000014269c750) at decl2.c:2877 [opt]
> >>   2874   gcc_assert (VAR_OR_FUNCTION_DECL_P (decl));
> >>   2875   /* Any code that creates entities with TREE_PUBLIC cleared should
> >>   2876      also set DECL_INTERFACE_KNOWN.  */
> >> -> 2877   gcc_assert (TREE_PUBLIC (decl));
> >>   2878   if (TREE_CODE (decl) == FUNCTION_DECL)
> >>   2879     gcc_assert (DECL_IMPLICIT_INSTANTIATION (decl)
> >>   2880                 || DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION (decl)
> >> (lldb) call debug_tree(decl)
> >> <var_decl 0x14269c750 value
> >>    type <boolean_type 0x1426aa5e8 bool readonly unsigned type_6 QI
> >>        size <integer_cst 0x142502768 constant 8>
> >>        unit-size <integer_cst 0x142502780 constant 1>
> >>        align:8 warn_if_not_align:0 symtab:150 alias-set -1 canonical-type 
> >> 0x1426aa5e8 precision:1 min <integer_cst 0x1425029d8 0> max <integer_cst 
> >> 0x142502a08 1>>
> >>    readonly constant used static tree_1 tree_2 tree_3 unsigned nonlocal 
> >> in_system_header read decl_1 QI 
> >> /Users/pkoning/Documents/svn/buildpdp/pdp11-aout/libstdc++-v3/include/type_traits:59:28
> >>  size <integer_cst 0x142502768 8> unit-size <integer_cst 0x142502780 1>
> >>    align:8 warn_if_not_align:0 context <record_type 0x1426a7e70 
> >> integral_constant> initial <integer_cst 0x1425029d8 0>
> >>    template-info 0x1426a64e0 chain <function_decl 0x1426a0600 __conv_op >>
> >> (lldb)
> >
> > lldb? eh ... ;)
> >
> > anyhow, this is
> >
> > namespace std
> > {
> >
> > # 56 
> > "/Users/pkoning/Documents/svn/buildpdp/pdp11-aout/libstdc++-v3/include/type_traits"
> > 3
> >  template<typename _Tp, _Tp __v>
> >    struct integral_constant
> >    {
> >      static constexpr _Tp value = __v;
> > ^^^
> >
> > which should have TREE_PUBLIC set.  My next step would be to watch how
> > this flag changes (if it does...)
> >
> > break at ggc-page.c:1442 (the return stmt of ggc_internal_alloc)
> > conditional on result == 0x14269c750
> > and then watch *&the-decl->base.public_flag printing said flag when
> > the watchpoint hits
> > (because you're watching the whole integer containing the bitfield bit).
> >
> > If that doesn't go anywhere try reducing the source file using creduce
> > or by other means.
> >
> > Maybe look at reset_decl_linkage () and visibility support in general.
>
> I trimmed the file a bit.
>
> Managed to find where public_flag is cleared.  It is in cp/expr.c 
> maybe_commonize_var, line 5619, here:
>
>           else
>             {
>               /* While for initialized variables, we must use internal
>                  linkage -- which means that multiple copies will not
>                  be merged.  */
>               TREE_PUBLIC (decl) = 0;
>               DECL_COMMON (decl) = 0;
>
> Could it be related to the fact that I have an a.out (rather than ELF) target?

I guess a.out is bitrotten (or too incapable) for C++ here.  I see the
code above emits warnings about this
being unhandled as well, it possibly should simply sorry() when it can
figure out it
will run into the import_export_decl ICE later...

Richard.

>         paul
>

Reply via email to