1. 27 Jan, 2016 3 commits
  2. 05 Jan, 2016 2 commits
  3. 28 Dec, 2015 1 commit
  4. 21 Dec, 2015 1 commit
  5. 27 Nov, 2015 1 commit
    • PR other/61321 - demangler crash on casts in template parameters · 921da198
      The fix for bug 59195:
      
       [C++ demangler handles conversion operator incorrectly]
       https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59195
      
      unfortunately makes the demangler crash due to infinite recursion, in
      case of casts in template parameters.
      
      For example, with:
      
       template<int> struct A {};
       template <typename Y> void function_temp(A<sizeof ((Y)(999))>) {}
       template void function_temp<int>(A<sizeof (int)>);
      
      The 'function_temp<int>' instantiation above mangles to:
      
        _Z13function_tempIiEv1AIXszcvT_Li999EEE
      
      The demangler parses this as:
      
      typed name
        template
          name 'function_temp'
          template argument list
            builtin type int
        function type
          builtin type void
          argument list
            template                          (*)
              name 'A'
              template argument list
                unary operator
                  operator sizeof
                  unary operator
                    cast
                      template parameter 0    (**)
                    literal
                      builtin type int
                      name '999'
      
      And after the fix for 59195, due to:
      
       static void
       d_print_cast (struct d_print_info *dpi, int options,
      	       const struct demangle_component *dc)
       {
       ...
         /* For a cast operator, we need the template parameters from
            the enclosing template in scope for processing the type.  */
         if (dpi->current_template != NULL)
           {
             dpt.next = dpi->templates;
             dpi->templates = &dpt;
             dpt.template_decl = dpi->current_template;
           }
      
      when printing the template argument list of A (what should be "<sizeof
      (int)>"), the template parameter 0 (that is, "T_", the '**' above) now
      refers to the first parameter of the the template argument list of the
      'A' template (the '*' above), exactly what we were already trying to
      print.  This leads to infinite recursion, and stack exaustion.  The
      template parameter 0 should actually refer to the first parameter of
      the 'function_temp' template.
      
      Where it reads "for the cast operator" in the comment in d_print_cast
      (above), it's really talking about a conversion operator, like:
      
        struct A { template <typename U> explicit operator U(); };
      
      We don't want to inject the template parameters from the enclosing
      template in scope when processing a cast _expression_, only when
      handling a conversion operator.
      
      The problem is that DEMANGLE_COMPONENT_CAST is currently ambiguous,
      and means _both_ 'conversion operator' and 'cast expression'.
      
      Fix this by adding a new DEMANGLE_COMPONENT_CONVERSION component type,
      which does what DEMANGLE_COMPONENT_CAST does today, and making
      DEMANGLE_COMPONENT_CAST just simply print its component subtree.
      
      I think we could instead reuse DEMANGLE_COMPONENT_CAST and in
      d_print_comp_inner still do:
      
       @@ -5001,9 +5013,9 @@ d_print_comp_inner (struct d_print_info *dpi, int options,
              d_print_comp (dpi, options, dc->u.s_extended_operator.name);
              return;
      
           case DEMANGLE_COMPONENT_CAST:
             d_append_string (dpi, "operator ");
       -     d_print_cast (dpi, options, dc);
       +     d_print_conversion (dpi, options, dc);
             return;
      
      leaving the unary cast case below calling d_print_cast, but seems to
      me that spliting the component types makes it easier to reason about
      the code.
      
      g++'s testsuite actually generates three symbols that crash the
      demangler in the same way.  I've added those as tests in the demangler
      testsuite as well.
      
      And then this fixes PR other/61233 too, which happens to be a
      demangler crash originally reported to GDB, at:
      https://sourceware.org/bugzilla/show_bug.cgi?id=16957
      
      Bootstrapped and regtested on x86_64 Fedora 20.
      
      Also ran this through GDB's testsuite.  GDB will require a small
      update to use DEMANGLE_COMPONENT_CONVERSION in one place it's using
      DEMANGLE_COMPONENT_CAST in its sources.
      
      libiberty/
      2015-11-27  Pedro Alves  <palves@redhat.com>
      
              PR other/61321
              PR other/61233
              * demangle.h (enum demangle_component_type)
              <DEMANGLE_COMPONENT_CONVERSION>: New value.
              * cp-demangle.c (d_demangle_callback, d_make_comp): Handle
              DEMANGLE_COMPONENT_CONVERSION.
              (is_ctor_dtor_or_conversion): Handle DEMANGLE_COMPONENT_CONVERSION
              instead of DEMANGLE_COMPONENT_CAST.
              (d_operator_name): Return a DEMANGLE_COMPONENT_CONVERSION
              component if handling a conversion.
              (d_count_templates_scopes, d_print_comp_inner): Handle
              DEMANGLE_COMPONENT_CONVERSION.
              (d_print_comp_inner): Handle DEMANGLE_COMPONENT_CONVERSION instead
              of DEMANGLE_COMPONENT_CAST.
              (d_print_cast): Rename as ...
              (d_print_conversion): ... this.  Adjust comments.
              (d_print_cast): Rewrite - simply print the left subcomponent.
              * cp-demint.c (cplus_demangle_fill_component): Handle
              DEMANGLE_COMPONENT_CONVERSION.
      
              * testsuite/demangle-expected: Add tests.
      
      From-SVN: r231020
      Pedro Alves committed
  6. 12 Nov, 2015 1 commit
  7. 09 Nov, 2015 5 commits
  8. 06 Nov, 2015 1 commit
  9. 28 Oct, 2015 1 commit
  10. 18 Oct, 2015 1 commit
    • Fix PR63758 by using the _NSGetEnviron() API on Darwin · efd40fc4
      include/
      
      	Roland McGrath  <roland@gnu.org>
      
      	PR other/63758
      	* environ.h: New file.
      
      libiberty/
      
      	Roland McGrath  <roland@gnu.org>
      	Iain Sandoe  <iain@codesourcery.com>
      
      	PR other/63758
      	* pex-unix.c: Obtain the environment interface from settings in environ.h
      	rather than in-line code.  Update copyright date.
      	* setenv.c: Likewise.
      	* xmalloc.c: Likewise.
      
      
      
      Co-Authored-By: Iain Sandoe <iain@codesourcery.com>
      
      From-SVN: r228942
      Roland McGrath committed
  11. 04 Oct, 2015 1 commit
    • Implement N4514, C++ Extensions for Transactional Memory. · b8fd7909
      gcc/
      	* builtins.def (BUILT_IN_ABORT): Add transaction_pure attribute.
      gcc/c-family/
      	* c-common.c (c_common_reswords): Add C++ TM TS keywords.
      	(c_common_attribute_table): Add transaction_safe_dynamic.
      	transaction_safe now affects type identity.
      	(handle_tm_attribute): Handle transaction_safe_dynamic.
      	* c-common.h (enum rid): Add RID_ATOMIC_NOEXCEPT,
      	RID_ATOMIC_CANCEL, RID_SYNCHRONIZED.
      	(OBJC_IS_CXX_KEYWORD): Add RID_SYNCHRONIZED.
      	(D_TRANSMEM): New.
      	* c-cppbuiltin.c (c_cpp_builtins): Define __cpp_transactional_memory.
      	* c-pretty-print.c (pp_c_attributes_display): Don't print
      	transaction_safe in C++.
      gcc/c/
      	* c-parser.c (c_lex_one_token): Handle @synchronized.
      	* c-decl.c (match_builtin_function_types): A declaration of a built-in
      	can change whether the function is transaction_safe.
      gcc/cp/
      	* cp-tree.h (struct cp_declarator): Add tx_qualifier field.
      	(BCS_NORMAL, BCS_TRANSACTION): New enumerators.
      	* lex.c (init_reswords): Limit TM kewords to -fgnu-tm.
      	* parser.c (cp_lexer_get_preprocessor_token): Fix @synchronized.
      	(make_call_declarator): Take tx_qualifier.
      	(cp_parser_tx_qualifier_opt): New.
      	(cp_parser_lambda_declarator_opt): Use it.
      	(cp_parser_direct_declarator): Likewise.
      	(cp_parser_statement): Handle atomic_noexcept, atomic_cancel.
      	(cp_parser_compound_statement): Change in_try parameter to bcs_flags.
      	(cp_parser_std_attribute): Map optimize_for_synchronized to
      	transaction_callable.
      	(cp_parser_transaction): Take the token.  Handle atomic_noexcept.
      	* lambda.c (maybe_add_lambda_conv_op): Handle transaction-safety.
      	* call.c (enum conversion_kind): Add ck_tsafe.
      	(standard_conversion): Handle transaction-safety conversion.
      	(convert_like_real, resolve_address_of_overloaded_function): Likewise.
      	(check_methods): Diagnose transaction_safe_dynamic on non-virtual
      	function.
      	(look_for_tm_attr_overrides): Don't inherit transaction_safe_dynamic.
      	* cvt.c (tx_safe_fn_type_p, tx_unsafe_fn_variant)
      	(can_convert_tx_safety): New.
      	* typeck.c (composite_pointer_type): Handle transaction-safety.
      	* name-lookup.h (enum scope_kind): Add sk_transaction.
      	* name-lookup.c (begin_scope): Handle it.
      	* semantics.c (begin_compound_stmt): Pass it.
      	* decl.c (check_previous_goto_1): Check it.
      	(struct named_label_entry): Add in_transaction_scope.
      	(poplevel_named_label_1): Set it.
      	(check_goto): Check it.
      	(duplicate_decls): A specialization can be transaction_safe
      	independently of its template.
      	(grokdeclarator): Handle tx-qualifier.
      	* rtti.c (ptr_initializer): Handle transaction-safe.
      	* search.c (check_final_overrider): Check transaction_safe_dynamic.
      	Don't check transaction_safe.
      	* mangle.c (write_function_type): Mangle transaction_safe here.
      	(write_CV_qualifiers_for_type): Not here.
      	(write_type): Preserve transaction_safe when stripping attributes.
      	* error.c (dump_type_suffix): Print transaction_safe.
      libiberty/
      	* cp-demangle.c (d_cv_qualifiers): Dx means transaction_safe.
      	(cplus_demangle_type): Let d_cv_qualifiers handle it.
      	(d_dump, d_make_comp, has_return_type, d_encoding)
      	(d_count_templates_scopes, d_print_comp_inner)
      	(d_print_mod_list, d_print_mod, d_print_function_type)
      	(is_ctor_or_dtor): Handle DEMANGLE_COMPONENT_TRANSACTION_SAFE.
      
      From-SVN: r228462
      Jason Merrill committed
  12. 15 Aug, 2015 1 commit
  13. 11 Aug, 2015 1 commit
  14. 13 Jul, 2015 1 commit
    • Fix several crashes of C++ demangler on fuzzed input. · 76d96a5a
      libiberty/
      	* cp-demangle.c (d_dump): Fix syntax error.
      	(d_identifier): Adjust type of len to match d_source_name.
      	(d_expression_1): Fix out-of-bounds access.  Check code variable for
      	NULL before dereferencing it.
      	(d_find_pack): Do not recurse for FIXED_TYPE, DEFAULT_ARG and NUMBER.
      	(d_print_comp_inner): Add NULL pointer check.
      	* cp-demangle.h (d_peek_next_char): Define as inline function when
      	CHECK_DEMANGLER is defined.
      	(d_advance): Likewise.
      	* testsuite/demangle-expected: Add new testcases.
      
      From-SVN: r225727
      Mikhail Maltsev committed
  15. 09 Jul, 2015 1 commit
  16. 08 Jul, 2015 1 commit
  17. 02 Jun, 2015 1 commit
    • re PR c++/44282 (fastcall is not mangled at all) · 603eaec4
      	PR c++/44282
      gcc/cp/
      	* mangle.c (attr_strcmp): New.
      	(write_CV_qualifiers_for_type): Also write out attributes that
      	affect type identity.
      	(write_type): Strip all attributes after writing qualifiers.
      libiberty/
      	* cp-demangle.c (cplus_demangle_type): Handle arguments to vendor
      	extended qualifier.
      
      From-SVN: r224007
      Jason Merrill committed
  18. 22 May, 2015 1 commit
  19. 16 May, 2015 8 commits
    • d-demangle.c (dlang_symbol_kinds): New enum. · 7e865541
      libiberty/ChangeLog:
      
      2015-05-16  Iain Buclaw  <ibuclaw@gdcproject.org>
      
      	* d-demangle.c (dlang_symbol_kinds): New enum.
      	(dlang_parse_symbol): Update signature.  Handle an ambiguity between
      	pascal functions and template value arguments.  Only check for a type
      	if parsing a function, or at the top level.  Return failure if the
      	entire symbol was not successfully demangled.
      	(dlang_identifier): Update signature.  Handle an ambiguity between two
      	adjacent digits in a mangled symbol string.
      	(dlang_type): Update call to dlang_parse_symbol.
      	(dlang_template_args): Likewise.
      	(dlang_parse_template): Likewise.
      	(dlang_demangle): Likewise.
      	* testsuite/d-demangle-expected: Fix bad tests found, and add problematic
      	examples to the unittests.
      
      From-SVN: r223247
      Iain Buclaw committed
    • d-demangle.c (dlang_template_args): Skip over specialized template parameters in mangled symbol. · ed4cdb85
      libiberty/ChangeLog:
      
      2015-05-16  Iain Buclaw  <ibuclaw@gdcproject.org>
      
      	* d-demangle.c (dlang_template_args): Skip over specialized template
      	parameters in mangled symbol.
      	* testsuite/d-demangle-expected: Add coverage and unittest for specialized
      	template parameters.
      
      From-SVN: r223246
      Iain Buclaw committed
    • d-demangle.c (dlang_type): Handle cent and ucent types. · 59251a73
      libiberty/ChangeLog:
      
      2015-05-16  Iain Buclaw  <ibuclaw@gdcproject.org>
      
      	* d-demangle.c (dlang_type): Handle cent and ucent types.
      	* testsuite/d-demangle-expected: Add coverage tests for cent and ucent.
      
      From-SVN: r223245
      Iain Buclaw committed
    • d-demangle.c (dlang_attributes): Handle return attributes, ignoring return… · 7ce4461f
      d-demangle.c (dlang_attributes): Handle return attributes, ignoring return parameters in the mangled string.
      
      libiberty/ChangeLog:
      
      2015-05-16  Iain Buclaw  <ibuclaw@gdcproject.org>
      
      	* d-demangle.c (dlang_attributes): Handle return attributes, ignoring
      	return parameters in the mangled string.  Return NULL if have encountered
      	an unknown attribute.
      	(dlang_function_args): Handle return parameters in the mangled string.
      	* testsuite/d-demangle-expected: Add coverage tests for functions with
      	return parameters and return attributes.
      
      From-SVN: r223244
      Iain Buclaw committed
    • d-demangle.c (dlang_identifier): Check encoded length of identifier to verify… · 5cc158e9
      d-demangle.c (dlang_identifier): Check encoded length of identifier to verify strncmp matches entire string.
      
      libiberty/ChangeLog:
      
      2015-05-16  Iain Buclaw  <ibuclaw@gdcproject.org>
      
      	* d-demangle.c (dlang_identifier): Check encoded length of identifier
      	to verify strncmp matches entire string.
      	* testsuite/d-demangle-expected: Fix wrong test for postblit symbol.
      
      From-SVN: r223243
      Iain Buclaw committed
    • d-demangle.c (dlang_type_modifiers): New function. · fa66ced4
      libiberty/ChangeLog:
      
      2015-05-16  Iain Buclaw  <ibuclaw@gdcproject.org>
      
      	* d-demangle.c (dlang_type_modifiers): New function.
      	(dlang_type_modifier_p): New function.
      	(dlang_call_convention_p): Ignore any kind of type modifier.
      	(dlang_type): Handle and emit the type modifier after delegate types.
      	(dlang_parse_symbol): Handle and emit the type modifier after the symbol.
      	* testsuite/d-demangle-expected: Add coverage tests for all valid
      	usages of function symbols with type modifiers.
      
      From-SVN: r223242
      Iain Buclaw committed
    • d-demangle.c (dlang_call_convention): Return NULL if have reached the end of the… · 76b41cad
      d-demangle.c (dlang_call_convention): Return NULL if have reached the end of the symbol, but expected something to read.
      
      libiberty/ChangeLog:
      
      2015-05-16  Iain Buclaw  <ibuclaw@gdcproject.org>
      
      	* d-demangle.c (dlang_call_convention): Return NULL if have reached the
      	end of the symbol, but expected something to read.
      	(dlang_attributes): Likewise.
      	(dlang_function_type): Likewise.
      	(dlang_type): Likewise.
      	(dlang_identifier): Likewise.
      	(dlang_value): Likewise.
      
      From-SVN: r223241
      Iain Buclaw committed
    • d-demangle.c (dlang_parse_string): Represent embedded whitespace or… · eb058b7d
      d-demangle.c (dlang_parse_string): Represent embedded whitespace or non-printable characters as hex or escape...
      
      libiberty/ChangeLog:
      
      2015-05-16  Iain Buclaw  <ibuclaw@gdcproject.org>
      
      	* d-demangle.c (dlang_parse_string): Represent embedded whitespace or
      	non-printable characters as hex or escape sequences.
      	* testsuite/d-demangle-expected: Add test for templates with tabs and
      	newlines embedded into the signature.
      
      From-SVN: r223240
      Iain Buclaw committed
  20. 08 May, 2015 1 commit
  21. 22 Apr, 2015 1 commit
  22. 14 Apr, 2015 1 commit
    • Makefile.tpl (EXTRA_HOST_EXPORTS): New variables. · 77019397
      2015-04-14  Max Ostapenko  <m.ostapenko@partner.samsung.com>
      
      	* Makefile.tpl (EXTRA_HOST_EXPORTS): New variables.
      	(EXTRA_BOOTSTRAP_FLAGS): Likewise.
      	(check-[+module+]): Add EXTRA_HOST_EXPORTS and EXTRA_BOOTSTRAP_FLAGS.
      	* Makefile.in: Regenerate.
      
      	libiberty/
      	* testsuite/Makefile.in (LIBCFLAGS): Add LDFLAGS.
      
      From-SVN: r222099
      Max Ostapenko committed
  23. 10 Apr, 2015 1 commit
    • re PR target/65351 (libiberty's pic version contains non-pic code on m32 darwin;… · cacf1f59
      re PR target/65351 (libiberty's pic version contains non-pic code on m32 darwin; causes bootstrap fail building libcc1.)
      
      	PR target/65351
      config/
      	* mh-darwin: Only apply -mdynamic-no-pic for m32 Darwin when the compiler in
      	use supports -mno-dynamic-no-pic.
      	* picflag.m4: Only append -mno-dynamic-no-pic for Darwin when -mdynamic-no-pic
      	is present in CFLAGS.
      
      libiberty/
      	* configure: Regenerate.
      libada/
      	* configure: Regenerate.
      libgcc/
      	* configure: Regenerate.
      gcc/
      	* configure: Regenerate.
      
      
      Co-Authored-By: Iain Sandoe <iain@codesourcery.com>
      
      From-SVN: r221967
      Jakub Jelinek committed
  24. 07 Apr, 2015 1 commit
  25. 19 Jan, 2015 1 commit
  26. 24 Dec, 2014 1 commit
    • xasprintf.c: New file. · e8850918
      libiberty/ChangeLog:
      
      	* xasprintf.c: New file.
      	* Makefile.in (CFILES): Add xasprintf.c.
      	(REQUIRED_OFILES): Add xasprintf.$(objext).
      	(xasprintf.$(objext)): New target.
      	* functions.texi: Regenerate.
      
      include/ChangeLog:
      
      	* libiberty.h (xasprintf): Declare.
      
      gcc/ChangeLog:
      
      	* gengtype.h (xasprintf): Remove declaration.
      	* gengtype.c (xasprintf): Remove.
      
      
      Co-Authored-By: Ben Elliston <bje@au.ibm.com>
      Co-Authored-By: Manuel López-Ibáñez <manu@gcc.gnu.org>
      
      From-SVN: r219060
      Uros Bizjak committed