This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[C++ Patch] PR 51400


Hi,

this issue manifests itself as an ICE on the gcc_assert toward the end of start_decl:

  if (VAR_P (decl)
&& DECL_NAMESPACE_SCOPE_P (decl) && !TREE_PUBLIC (decl) && !was_public
      && !DECL_THIS_STATIC (decl) && !DECL_ARTIFICIAL (decl))
    {
      /* This is a const variable with implicit 'static'.  Set
     DECL_THIS_STATIC so we can tell it from variables that are
     !TREE_PUBLIC because of the anonymous namespace.  */
      gcc_assert (CP_TYPE_CONST_P (TREE_TYPE (decl)) || errorcount);
      DECL_THIS_STATIC (decl) = 1;
    }

and the reason seems clear to me: both handle_noreturn_attribute and handle_const_attribute call build_pointer_type and discard the TYPE_QUALS on the original POINTER_TYPE. That seems obviously incorrect. The below fixes the ICE and passes testing.

Thanks!
Paolo.

/////////////////

Attachment: CL_51400
Description: Text document

Attachment: patch_51400
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]