runtime: Fix GC bug caused by Entersyscall modifying reg.

This patch fixes a rare but serious bug.  The Go garbage
collector only examines Go stacks.  When Go code calls a
function that is not written in Go, it first calls
syscall.Entersyscall.  Entersyscall records the position of
the Go stack pointer and saves a copy of all the registers.
If the garbage collector runs while the thread is executing
the non-Go code, the garbage collector fetches the stack
pointer and registers from the saved location.

Entersyscall saves the registers using the getcontext
function.  Unfortunately I didn't consider the possibility
that Entersyscall might itself change a register before
calling getcontext.  This only matters for callee-saved
registers, as caller-saved registers would be visible on the
saved stack.  And it only matters if Entersyscall is compiled
to save and modify a callee-saved register before it calls
getcontext.  And it only matters if a garbage collection
occurs while the non-Go code is executing.  And it only
matters if the only copy of a valid Go pointer happens to be
in the callee-saved register when Entersyscall is called.
When all those conditions are true, the Go pointer might get
collected incorrectly, leading to memory corruption.

This patch tries to avoid the problem by splitting
Entersyscall into two functions.  The first is a simple
function that just calls getcontext and then calls the rest of
Entersyscall.  This should fix the problem, provided the
simple Entersyscall function does not itself modify any
callee-saved registers before calling getcontext.  That seems
to be true on the systems I checked.  But since the argument
to getcontext is an offset from a TLS variable, it won't be
true on a system which needs to save callee-saved registers in
order to get the address of a TLS variable.  I don't know why
any system would work that way, but I don't know how to rule
it out.  I think that on any such system this will have to be
implemented in assembler.  I can't put the ucontext_t
structure on the stack, because this function can not split
stacks, and the ucontext_t structure is large enough that it
could cause a stack overflow.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208390 138bc75d-0d04-0410-961f-82ee72b054a4
	* sort.c: New file.
	* stest.c: New file.
	* internal.h (backtrace_qsort): Declare.
	* dwarf.c (read_abbrevs): Call backtrace_qsort instead of qsort.
	(read_line_info, read_function_entry): Likewise.
	(read_function_info, build_dwarf_data): Likewise.
	* elf.c (elf_initialize_syminfo): Likewise.
	* Makefile.am (libbacktrace_la_SOURCES): Add sort.c.
	(stest_SOURCES, stest_LDADD): Define.
	(check_PROGRAMS): Add stest.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208392 138bc75d-0d04-0410-961f-82ee72b054a4
The error_mark_node is not an OpenMP mappable type.

	gcc/
	* langhooks.c (lhd_omp_mappable_type): The error_mark_node is not
	an OpenMP mappable type.
	gcc/c/
	* c-decl.c (c_decl_attributes): Use
	lang_hooks.types.omp_mappable_type.
	* c-typeck.c (c_finish_omp_clauses): Likewise.
	gcc/testsuite/
	* c-c++-common/gomp/map-1.c: Extend.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208394 138bc75d-0d04-0410-961f-82ee72b054a4
2014-03-07  Paulo Matos  <paulo@matos-sorge.com>

	* common.opt (fira-loop-pressure): Mark as optimization.



git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208395 138bc75d-0d04-0410-961f-82ee72b054a4
Disable local dynamic TLS model on Solaris/x86 if as/ld cannot handle it

	* configure.ac (TLS_SECTION_ASM_FLAG): Save as tls_section_flag.
	(LIB_TLS_SPEC): Save as ld_tls_libs.
	(HAVE_AS_IX86_TLSLDMPLT): Define as 1/0.
	(HAVE_AS_IX86_TLSLDM): New test.
	* configure, config.in: Regenerate.
	* config/i386/i386.c (legitimize_tls_address): Fall back to
	TLS_MODEL_GLOBAL_DYNAMIC on 32-bit Solaris/x86 if tool chain
	cannot support TLS_MODEL_LOCAL_DYNAMIC.
	* config/i386/i386.md (*tls_local_dynamic_base_32_gnu): Use if
	instead of #ifdef in HAVE_AS_IX86_TLSLDMPLT test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208398 138bc75d-0d04-0410-961f-82ee72b054a4
Improve @tlsldmplt test on Solaris 11/x86

	* configure.ac (HAVE_AS_IX86_TLSLDMPLT): Improve test for Solaris
	11/x86 ld.
	* configure: Regenerate.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208399 138bc75d-0d04-0410-961f-82ee72b054a4
	PR bootstrap/58572
	* Makefile.tpl (POSTSTAGE1_CXX_EXPORT): Use -isystem instead of
	-I for libstdc++-v3 includes if $(LEAN).
	* Makefile.in: Regenerated.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208400 138bc75d-0d04-0410-961f-82ee72b054a4
Handle backtrace_qsort

	* libbacktrace/Makefile.am (libsanitizer_libbacktrace_la_SOURCES):
	Add ../../libbacktrace/sort.c.
	* libbacktrace/Makefile.in: Regenerate.
	* libbacktrace/backtrace-rename.h (backtrace_qsort): Define.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208401 138bc75d-0d04-0410-961f-82ee72b054a4
2014-03-07  Paolo Carlini  <paolo.carlini@oracle.com>

	* decl.c (check_initializer): Remove dead code.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208402 138bc75d-0d04-0410-961f-82ee72b054a4
	* sort.c (backtrace_qsort): Use middle element as pivot.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208403 138bc75d-0d04-0410-961f-82ee72b054a4
	* c.opt: Add -std=c++14.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208404 138bc75d-0d04-0410-961f-82ee72b054a4
	* MAINTAINERS: Remove avr maintainers: Anatoly Sokolov and Eric Weddington



git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208406 138bc75d-0d04-0410-961f-82ee72b054a4
/cp
2014-03-07  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/58609
	* decl.c (check_initializer): Return NULL_TREE after error;
	consistently use inform.

/testsuite
2014-03-07  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/58609
	* g++.dg/cpp0x/constexpr-ice12.C: New.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208410 138bc75d-0d04-0410-961f-82ee72b054a4
	* decl.c (create_array_type_for_decl): Only warn about invalid
	C++1y VLA if flag_iso or warn_vla>0.
	(grokdeclarator): Likewise.
	* pt.c (tsubst): Likewise.
	* semantics.c (finish_decltype_type): Likewise.
	* typeck.c (cxx_sizeof_or_alignof_type): Likewise.
	(cp_build_addr_expr_1): Likewise.
	* init.c (build_new_1): Improve diagnostics.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208411 138bc75d-0d04-0410-961f-82ee72b054a4
	* cp-tree.h (REF_PARENTHESIZED_P): New.
	* semantics.c (force_paren_expr): Set it.
	* pt.c (do_auto_deduction): Check it.
	(tsubst) [COMPONENT_REF]: Copy it.
	* typeck.c (maybe_warn_about_useless_cast): Don't strip dereference.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208412 138bc75d-0d04-0410-961f-82ee72b054a4
	* parser.c (cp_parser_using_declaration): Consume the semicolon
	after bare parameter pack error.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208413 138bc75d-0d04-0410-961f-82ee72b054a4
	* typeck.c (comp_template_parms_position): 'auto' and
	'decltype(auto)' are different from real template parms.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208414 138bc75d-0d04-0410-961f-82ee72b054a4
	* parser.c (cp_parser_type_id_1): Only allow 'auto' in C++1y if
	we're in a trailing return type.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208415 138bc75d-0d04-0410-961f-82ee72b054a4
	* lib/g++-dg.exp (g++-dg-runtest): Run tests in C++1y mode, too.
	* lib/target-supports.exp (check_effective_target_c++11): Now
	means C++11 and up.
	(check_effective_target_c++11_only): New.
	(check_effective_target_c++11_down): New.
	(check_effective_target_c++1y): New.
	(check_effective_target_c++1y_only): New.
	(check_effective_target_c++98_only): Rename from
	check_effective_target_c++98.
	* g++.dg/*: Use { target c++11 } instead of -std=c++11.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208416 138bc75d-0d04-0410-961f-82ee72b054a4
	* Make-lang.in (check_g++_parallelize): Split dg.exp.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208417 138bc75d-0d04-0410-961f-82ee72b054a4