https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85535

            Bug ID: 85535
           Summary: bogus code in decl2.c:decl_needed_p
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ebotcazou at gcc dot gnu.org
  Target Milestone: ---

These lines are bogus:

  /* When not optimizing, do not bother to produce definitions for extern
     symbols.  */
  if (DECL_REALLY_EXTERN (decl)
      && ((TREE_CODE (decl) != FUNCTION_DECL
           && !optimize)
          || (TREE_CODE (decl) == FUNCTION_DECL
              && !opt_for_fn (decl, optimize)))
      && !lookup_attribute ("always_inline", decl))
    return false;

You cannot call lookup_attribute on a DECL, this will immediately fail a check:

internal compiler error: tree check: expected tree_list, have var_decl in
get_attribute_name, at attribs.c:835

I spotted this by visual inspection so no testcase.

Reply via email to