Commit graph

182458 commits

Author SHA1 Message Date
Ian Lance Taylor
1fa5fc7408 runtime: remove scase.releasetime field
This is the gofrontend version of https://golang.org/cl/245122.
Original CL description:

    selectgo will report at most one block event, so there's no need to
    keep a releasetime for every select case. It suffices to simply track
    the releasetime of the case responsible for the wakeup.

    Updates golang/go#40410.

This is being brought over to gofrontend as a step toward upgrading to
Go1.16beta1.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/279732
2020-12-22 11:54:03 -08:00
Jakub Jelinek
ffd454b92b c++: Handle array members in build_comparison_op [PR93480]
http://eel.is/c++draft/class.compare.default#6 says for the
expanded list of subobjects:
"In that list, any subobject of array type is recursively expanded
to the sequence of its elements, in the order of increasing subscript."
but build_comparison_op just tried to compare the whole arrays, which
failed and therefore the defaulted comparison was deleted.

The following patch instead compares the array elements, and
if info.defining, adds runtime loops around it so that it iterates
over increasing subscripts.

For flexible array members it punts, we don't know how large those will be,
for zero sized arrays it doesn't even try to compare the elements,
because if there are no elements, there is nothing to compare, and
for [1] arrays it will not emit a loop because it is enough to use
[0] array ref to cover everything.

2020-12-21  Jakub Jelinek  <jakub@redhat.com>

	PR c++/93480
	* method.c (common_comparison_type): If comps[i] is a TREE_LIST,
	use its TREE_VALUE instead.
	(build_comparison_op): Handle array members.

	* g++.dg/cpp2a/spaceship-synth10.C: New test.
	* g++.dg/cpp2a/spaceship-synth-neg5.C: New test.
2020-12-22 20:18:10 +01:00
Qian Jianhua
ae27ce51e4 arm&aarch64: subdivide the type attribute "alu_shfit_imm"
The type attribute "alu_shfit_imm" is subdivided into
"alu_shift_imm_lsl_1to4" and "alu_shift_imm_other", to accommodate
optimazations of some microarchitectures.

Here is the detailed discussion.
https://gcc.gnu.org/pipermail/gcc/2020-September/233594.html

gcc/
	* config/arm/types.md (define_attr "autodetect_type"): New.
	(define_attr "type"): Subdivide alu_shift_imm.
	* config/arm/common.md: New file.
	* config/aarch64/predicates.md:Include common.md.
	* config/arm/predicates.md:Include common.md.
	* config/aarch64/aarch64.md (*add_<shift>_<mode>): Set autodetect_type.
	(*add_<shift>_si_uxtw): Likewise.
	(*sub_<shift>_<mode>): Likewise.
	(*sub_<shift>_si_uxtw): Likewise.
	(*neg_<shift>_<mode>2): Likewise.
	(*neg_<shift>_si2_uxtw): Likewise.
	* config/arm/arm.md (*addsi3_carryin_shift): Likewise.
	(add_not_shift_cin): Likewise.
	(*subsi3_carryin_shift): Likewise.
	(*subsi3_carryin_shift_alt): Likewise.
	(*rsbsi3_carryin_shift): Likewise.
	(*rsbsi3_carryin_shift_alt): Likewise.
	(*arm_shiftsi3): Likewise.
	(*<arith_shift_insn>_multsi): Likewise.
	(*<arith_shift_insn>_shiftsi): Likewise.
	(subsi3_carryin): Set new type.
	(*if_arith_move): Set new type.
	(*if_move_arith): Set new type.
	(define_attr "core_cycles"): Use new type.
	* config/arm/arm-fixed.md (arm_ssatsihi_shift): Set autodetect_type.
	* config/arm/thumb2.md (*orsi_not_shiftsi_si): Likewise.
	(*thumb2_shiftsi3_short): Set new type.
	* config/aarch64/falkor.md (falkor_alu_1_xyz): Use new type.
	* config/aarch64/saphira.md (saphira_alu_1_xyz): Likewise.
	* config/aarch64/thunderx.md (thunderx_arith_shift): Likewise.
	* config/aarch64/thunderx2t99.md (thunderx2t99_alu_shift): Likewise.
	* config/aarch64/thunderx3t110.md (thunderx3t110_alu_shift): Likewise.
	(thunderx3t110_alu_shift1): Likewise.
	* config/aarch64/tsv110.md (tsv110_alu_shift): Likewise.
	* config/arm/arm1020e.md (1020alu_shift_op): Likewise.
	* config/arm/arm1026ejs.md (alu_shift_op): Likewise.
	* config/arm/arm1136jfs.md (11_alu_shift_op): Likewise.
	* config/arm/arm926ejs.md (9_alu_op): Likewise.
	* config/arm/cortex-a15.md (cortex_a15_alu_shift): Likewise.
	* config/arm/cortex-a17.md (cortex_a17_alu_shiftimm): Likewise.
	* config/arm/cortex-a5.md (cortex_a5_alu_shift): Likewise.
	* config/arm/cortex-a53.md (cortex_a53_alu_shift): Likewise.
	* config/arm/cortex-a57.md (cortex_a57_alu_shift): Likewise.
	* config/arm/cortex-a7.md (cortex_a7_alu_shift): Likewise.
	* config/arm/cortex-a8.md (cortex_a8_alu_shift): Likewise.
	* config/arm/cortex-a9.md (cortex_a9_dp_shift): Likewise.
	* config/arm/cortex-m4.md (cortex_m4_alu): Likewise.
	* config/arm/cortex-m7.md (cortex_m7_alu_shift): Likewise.
	* config/arm/cortex-r4.md (cortex_r4_alu_shift): Likewise.
	* config/arm/exynos-m1.md (exynos_m1_alu_shift): Likewise.
	* config/arm/fa526.md (526_alu_shift_op): Likewise.
	* config/arm/fa606te.md (606te_alu_op): Likewise.
	* config/arm/fa626te.md (626te_alu_shift_op): Likewise.
	* config/arm/fa726te.md (726te_alu_shift_op): Likewise.
	* config/arm/fmp626.md (mp626_alu_shift_op): Likewise.
	* config/arm/marvell-pj4.md (pj4_shift): Likewise.
	(pj4_shift_conds): Likewise.
	(pj4_alu_shift): Likewise.
	(pj4_alu_shift_conds): Likewise.
	* config/arm/xgene1.md (xgene1_alu): Likewise.
	* config/arm/arm.c (xscale_sched_adjust_cost): Likewise.
2020-12-22 18:54:34 +00:00
Uros Bizjak
337ed0eb49 i386: Fix __builtin_floor with FE_DOWNWARD rounding direction [PR96793]
x86_expand_floorceil expander uses x86_sse_copysign_to_positive, which
is unable to change the sign from - to +.  When FE_DOWNWARD rounding
direction is in effect, the expanded sequence that involves subtraction
can trigger x - x = -0.0 special rule.  x86_sse_copysign_to_positive
fails to change the sign of the intermediate value, assumed to always
be positive, back to positive.

The patch adds one extra fabs that strips the sign from the intermediate
value when flag_rounding_math is in effect.

2020-12-22  Uroš Bizjak  <ubizjak@gmail.com>

gcc/
	PR target/96793
	* config/i386/i386-expand.c (ix86_expand_floorceil):
	Remove the sign of the intermediate value for flag_rounding_math.
	(ix86_expand_floorceildf_32): Ditto.

gcc/testsuite/
	PR target/96793
	* gcc.target/i386/pr96793.c: New test.
2020-12-22 18:14:51 +01:00
Gerald Pfeifer
7e63d383b8 c++: Fix build with clang
After the addition of libcody building with clang 10.0.1 would fail
as follows:

  In file included from .../libcody/cody.hh:24:
  In file included from /usr/include/c++/v1/memory:653:
  /usr/include/c++/v1/typeinfo:346:5: error: no member named 'fancy_abort'
  in namespace 'std::__1'; did you mean simply 'fancy_abort'?
    _VSTD::abort();
    ^~~~~~~

mapper-client.cc and mapper-resolver.cc have addressed this already
by getting <string> and <vector> included; do the same for module.cc.

gcc/cp:
2020-12-22  Gerald Pfeifer  <gerald@pfeifer.com>

	* module.cc (INCLUDE_STRING): Define.
	(INCLUDE_VECTOR): Ditto.
2020-12-22 13:37:56 +01:00
Jason Merrill
027935eec4 c++: Add some asserts in mangle.c
The added asserts are places I noticed that we aren't adding the "on" to
distinguish an operator name from an expression involving the operator.
Hopefully that's because operator names never get there; if not, crash bug
reports will let us fix the issue.

gcc/cp/ChangeLog:

	* mangle.c (write_member_name): Add assert.
	(write_expression): Add asserts.
2020-12-21 21:17:04 -05:00
Jason Merrill
58fb912c15 c++: Fix demangling of <unresolved-name>
The ABI for unresolved scoped names on the RHS of . and -> used to be

  sr <type> <unqualified-id>

That changed years ago to something more complex, but G++ was never updated.
This change was particularly incompatible for simple qualified-ids like
A::x, which were previously mangled as sr1A1x, and now sr1AE1x.

This obviously makes life hard for demanglers, which can't know whether to
consume that E or not.  To work around this, we now try demangling with the
newer ABI, and if that fails and we saw an "sr", try again with the older
ABI.

libiberty/ChangeLog:

	PR c++/67343
	* cp-demangle.h (struct d_info): Add unresolved_name_state.
	* cp-demangle.c (d_prefix): Add subst parm.
	(d_nested_name): Pass it.
	(d_unresolved_name): Split out from...
	(d_expression_1): ...here.
	(d_demangle_callback): Maybe retry with old sr mangling.
	* testsuite/demangle-expected: Add test.
2020-12-21 21:13:41 -05:00
liuhongt
93ac0c05ff Fix Typo.
gcc/ChangeLog

	* config/i386/i386.md (*one_cmpl<mode>2_1): Fix typo, change
	alternative from 2 to 1 in attr isa.
2020-12-22 09:32:16 +08:00
Ian Lance Taylor
30b76d9059 -fdump-go-spec: don't crash if DECL_ORIGINAL_TYPE is NULL
* godump.c (go_output_typedef): If DECL_ORIGINAL_TYPE is NULL, use
	TREE_TYPE.
2020-12-21 16:21:58 -08:00
Ian Lance Taylor
03ea48ff27 Go frontend: ensure mpfr exponent range is large enough for Go
PR go/98402
	* go-lang.c (go_langhook_init): Force MPFR exponent range to be
	large enough to support Go constants.
2020-12-21 16:18:02 -08:00
GCC Administrator
1a5e728a54 Daily bump. 2020-12-22 00:16:23 +00:00
Jakub Jelinek
a477f1445b gimplify: Gimplify value in gimplify_init_ctor_eval_range [PR98353]
gimplify_init_ctor_eval_range wasn't gimplifying value, so if it wasn't
a gimple val, verification at the end of gimplification would ICE (or with
release checking some random pass later on would ICE or misbehave).

2020-12-21  Jakub Jelinek  <jakub@redhat.com>

	PR c++/98353
	* gimplify.c (gimplify_init_ctor_eval_range): Gimplify value before
	storing it into cref.

	* g++.dg/opt/pr98353.C: New test.
2020-12-22 00:01:34 +01:00
Jason Merrill
8cd42d3cc2 c++: Fix demangling of qualified-id after '.'
The demangler was assuming that only an unqualified-id could appear after
. or ->.

libiberty/ChangeLog:

	* cp-demangle.c (d_expression_1): Recognize qualified-id
	on RHS of dt/pt.
	* testsuite/demangle-expected: Add test.
2020-12-21 16:39:48 -05:00
Jason Merrill
7169049332 c++: Fix demangling of x.operator type
d_operator_name decides whether "cv" indicates a cast or a conversion
operator based on is_expression.  "on" specifies that we want the conversion
operator.

libiberty/ChangeLog:

	* cp-demangle.c (d_unqualified_name): Clear is_expression.
	* testsuite/demangle-expected: Add tests.
2020-12-21 15:46:14 -05:00
Iain Sandoe
0e1d4b3bfe Darwin : Update the kernel version to macOS version mapping.
With the change to macOS 11 and Darwin20, the algorithm for mapping
kernel version to macOS version has changed.

We now have darwin 20.X.Y => macOS 11.(X > 0 ? X - 1 : 0).??.
It currently unclear if the Y will be mapped to macOS patch version
and, if so, whether it will be one-based or 0-based.
Likewise, it's unknown if Darwin 21 will map to macOS 12, so these
entries are unchanged for the present.

gcc/ChangeLog:

	* config/darwin-driver.c (darwin_find_version_from_kernel):
	Compute the minor OS version from the minor kernel version.
2020-12-21 20:19:30 +00:00
Patrick Palka
6a31d47e27 libstdc++: Disable floating-point std::to_chars on unsupported targets
This patch conditionally disables the floating-point std::to_chars
implementation on targets whose float and double aren't IEEE binary32
and binary64, until a proper fallback can be added for such targets.
This fixes a bootstrap failure on non-IEEE-754 FP targets such as
vax-netbsdelf.

The new preprocessor tests in c++config that detect the binary32 and
binary64 formats were copied from gcc/testsuite/gcc.dg/float-exact-1.c.

libstdc++-v3/ChangeLog:

	* include/bits/c++config (_GLIBCXX_FLOAT_IS_IEEE_BINARY_32):
	Define this macro.
	(_GLIBCXX_DOUBLE_IS_IEEE_BINARY_64): Likewise.
	* include/std/charconv (to_chars): Use these macros to
	conditionally hide the overloads for floating-point types.
	* src/c++17/floating_to_chars.cc: Use the macros to
	conditionally disable this file.
	(floating_type_traits<float>): Remove redundant static assert.
	(floating_type_traits<double>): Likewise.
	* testsuite/20_util/to_chars/double.cc: Run this test only on
	ieee-floats effective targets.
	* testsuite/20_util/to_chars/float.cc: Likewise.
	* testsuite/20_util/to_chars/long_double.cc: Likewise.
	* testsuite/lib/libstdc++.exp
	(check_effective_target_ieee-floats): Define new proc for
	detecting whether float and double have the IEEE binary32 and
	binary64 formats.
2020-12-21 15:15:36 -05:00
Nathan Sidwell
e798f08192 c++: Windows rename [PR 98412]
Some system's rename(2) fails if the target already exists, so delete it
first.

	gcc/cp/
	* module.cc (create_dirs): Add logging.
	(finish_module_processing): Unlink before rename.
2020-12-21 09:48:28 -08:00
Nathan Sidwell
1467a5c5ab bootstrap: std:stoul non-portable [PR 98412]
Fix some more system-specific issues.  Not everyone's C++11 is the same :(

	PR bootstrap/98412
	libcody/
	* client.cc: Include cstdlib.
	* server.cc: Include cstdlib.
	gcc/cp/
	* mapper-client.cc: INCLUDE_STRING, INCLUDE_VECTOR.
	(module_client::open_module_client): Avoid std::stoul.
	* mapper-resolver.cc: INCLUDE_STRING, INCLUDE_VECTOR.
2020-12-21 09:20:15 -08:00
Gerald Pfeifer
cf22f78ff6 libcody: Include <netinet/in.h> as needed
libcody as originally added to GCC fail to build on *-unknown-freebsd11.4
and presumably others:

  c++ -std=c++11 -g -include config.h -I ... -MMD -MP -MF netclient.d -c
    -o netclient.o
  .../libcody/netclient.cc:114:3: error: unknown type sockaddr_in6 addr;
                                                      ^~~~~~~~~~~~

sockaddr_in6 is declared in /usr/include/netinet6/in6.h,
which is included by /usr/include/netinet/in.h.

Indeed, per https://man7.org/linux/man-pages/man7/ipv6.7.html

    #include <sys/socket.h>
    #include <netinet/in.h>

should be included, and our own gcc/ada/gsocket.h also has

    #if !(defined (VMS) || defined (__MINGW32__))
    #include <sys/socket.h>
    #include <sys/un.h>
    #include <netinet/in.h>
    :
    #endif

libcody/ChangeLog:

2020-12-21  Gerald Pfeifer  <gerald@pfeifer.com>

	* netserver.cc: Include <netinet/in.h>.
2020-12-21 17:11:43 +01:00
Nathan Sidwell
626b63d63a libcody: Add ranlib
Add RANLIB.

	libcody/
	* Makefile.in (RANLIB): New var.
	* Makesub.in (libcody.a): Apply RANLIB.
	* configure.ac: Call AC_PROG_RANLIB.
	* configure: Rebuilt.
2020-12-21 06:30:59 -08:00
Nathan Sidwell
119d7478d1 libcody: to_string is not always available [PR 98412]
to_string is not always available, so don't use it.

	libcody/
	* buffer.cc (MessageBuffer::AppendInteger): Workaround
	to_string's non-ubiquity.
2020-12-21 05:42:03 -08:00
Nathan Sidwell
31705b068f libcody: Add netinet.h
We explicitly need to inlude netinet.h, (despite what happened on my test systems)

	libcody/
	* netclient.cc: Add netinet.h.
2020-12-21 05:42:03 -08:00
Nathan Sidwell
e4043c636c c++tools: Fix exe suffix [PR 98409]
I had a thinko about variable case, and, coupled with Make's behaviour
of just consing up variables out of nothing, and linux not having an
executable extension, didn't notice.

	PR other/98409
	c++tools/
	* Makefile.in: Fix exeext variable case.
2020-12-21 05:41:42 -08:00
Martin Liska
1b021bbd85 gcc-changelog: new error for quoted utf8 filenames
contrib/ChangeLog:

	* gcc-changelog/git_commit.py: Add new error for quoted
	filenames.
	* gcc-changelog/test_email.py: Test it.
	* gcc-changelog/test_patches.txt: Test it.
2020-12-21 10:35:11 +01:00
Martin Liska
2ebe752658 gcc-changelog: add Unicode test-case
contrib/ChangeLog:

	* gcc-changelog/test_email.py: New test.
	* gcc-changelog/test_patches.txt: Likewise.
2020-12-21 10:21:25 +01:00
Jakub Jelinek
d8aeee11af fold-const: Fix up a buffer overflow in native_encode_initializer [PR98407]
For flexible array members we need to incrementally clear just from
ptr + total_bytes up to new ptr + total_bytes, but memset has been called
with the length from ptr, so was missing - total_bytes.  Additionally,
in this code off is guaranteed to be -1 and thus o 0, so don't bother pretending
we could handle anything else, it would be more complicated than that.

2020-12-21  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/98407
	* fold-const.c (native_encode_initializer): When handling flexible
	array members, fix up computation of length for memset.  Also remove
	" - o" as o is always guaranteed to be 0 in this code path.

	* gcc.c-torture/compile/pr98407.c: New test.
2020-12-21 10:14:46 +01:00
Jakub Jelinek
b6237343e7 openmp: Fix up handling of addressable temporaries in simd lb, b and incr expressions [PR98383]
For simd, we have code to artificially add locally defined variables into
private clauses if they are addressable, so that omplower turns them into
"omp simd array" variables.  As the testcase shows, this is undesirable if
those temporaries only show in the lb, b or incr expressions and nowhere else,
if it is just used there, we really want normal scalar temporaries.

This patch implements that by making sure we don't set for those GOVD_LOCAL-ish
temporaries turned into GOVD_PRIVATE the GOVD_SEEN flag during gimplification
of the lb, b and incr expressions, which means that the private clause isn't
added for those.

2020-12-21  Jakub Jelinek  <jakub@redhat.com>

	PR c++/98383
	* gimplify.c (struct gimplify_omp_ctx): Add in_for_exprs flag.
	(gimple_add_tmp_var): For addressable temporaries appearing in
	simd lb, b or incr expressions, don't add a private clause unless
	it is seen also outside of those expressions in the simd body.
	(omp_notice_variable): Likewise.
	(gimplify_omp_for): Set and reset in_for_exprs around gimplification
	of lb, b or incr expressions.

	* g++.dg/gomp/pr98383.C: New test.
2020-12-21 08:59:05 +01:00
Nikhil Benesch
9bac66390c libgo: adjust sysinfo scripts for changed -fdump-go-spec
The -fdump-go-spec flag to GCC recently changed to be more fastidious
about handling incomplete types. This caused some breakage in
mk[r]sysinfo.sh on Solaris. This commit adjusts for the new behavior.
Specifically:

  * Types that refer to _in6_addr may be hidden behind a typedef and can
    no longer be filtered out with `grep -v in6_addr`. Instead just
    rewrite the definition of _in6_addr to [16]byte wherever it appears.

  * timestruc_t is now (correctly) emitted as an alias for timespec, so this
    case is handled specially.

  * stdio.h is included in sysinfo.c to avoid emitting an incomplete
    definition of the FILE type.

  * Dummy definitions for _u?pad128_t are now emitted automatically,
    which conflict with the definitions installed by mk[r]sysinfo.sh.
    These definitions were actually dead code, so just remove them.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/278672
2020-12-20 20:16:50 -08:00
GCC Administrator
108beb75da Daily bump. 2020-12-21 00:16:20 +00:00
Max Filippov
18e86fae2a gcc: xtensa: implement bswapsi2, bswapdi2 and helpers
2020-12-20  Max Filippov  <jcmvbkbc@gmail.com>
gcc/
	* config/xtensa/xtensa.md (bswapsi2, bswapdi2): New patterns.

gcc/testsuite/
	* gcc.target/xtensa/bswap.c: New test.

libgcc/
	* config/xtensa/lib1funcs.S (__bswapsi2, __bswapdi2): New
	functions.
	* config/xtensa/t-xtensa (LIB1ASMFUNCS): Add _bswapsi2 and
	_bswapdi2.
2020-12-20 14:02:26 -08:00
Jonathan Wakely
3621a7bb57 libstdc++: Fix indentation in <semaphore>
libstdc++-v3/ChangeLog:

	* include/std/semaphore: Fix indentation.
2020-12-20 18:49:46 +00:00
Jakub Jelinek
8b01af02b5 doc: Fix a typo [PR98400]
Fix a typo in an option name in documentation.

2020-12-20  Jakub Jelinek  <jakub@redhat.com>

	PR other/98400
	* doc/invoke.texi (-mbackchain): Fix a typo - -mmo-backchain ->
	-mno-backchain.
2020-12-20 18:59:57 +01:00
Thomas Koenig
8d76c007af Set DECL_ARTIFICIAL on gfortran internal variables.
It seems we sometimes use DECL_ARTIFICIAL as choosing between
different code paths.  In order not to make -fdebug-aux-vars
do different things, set DECL_ARTIFICIAL on the variables to
avoid these different code paths (and the corresponding
regressions).

gcc/fortran/ChangeLog:

	* trans.c (create_var_debug_raw): Set DECL_ARTIFICIAL
	on variables.
2020-12-20 16:27:01 +01:00
Thomas Koenig
bebf930dd2 Correct coarray indices for test case.
gcc/testsuite/ChangeLog:

	* gfortran.dg/coarray/send_char_array_1.f90: Correct coarray
	indces.
2020-12-20 16:21:44 +01:00
GCC Administrator
eb460c5986 Daily bump. 2020-12-20 00:16:21 +00:00
Jakub Jelinek
69165332a9 expr: Fix up constant_byte_string bitfield handling [PR98366]
constant_byte_string now uses a convert_to_bytes function, which doesn't
handle bitfields at all (don't punt on them, just puts them into wrong bits
or bytes).  Furthermore, I don't see a reason why that function should exist
at all, it duplicates native_encode_initializer functionality.
Except that native_encode_initializer punted on flexible array members and 2
tests in the testsuite relied on constant_byte_string handling those.
So, this patch throws away convert_to_bytes, uses native_encode_initializer
instead, but teaches it to handle flexible array members (only in the
non-mask mode with off == -1 for now), furthermore, it adds various corner
case checks that the old implementation was missing (like that STRING_CSTs
use int as length and therefore we shouldn't try to build larger than that
strings, or that native_encode*/native_interpret* APIs require sane
host and target bytes (8-bit on both).

2020-12-19  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/98366
	* fold-const.c (native_encode_initializer): Don't try to
	memset more than total_bytes with off == -1 even if len is large.
	Handle flexible array member initializers if off == -1 and mask is
	NULL.
	* expr.c (convert_to_bytes): Remove.
	(constant_byte_string): Use native_encode_initializer instead of
	convert_to_bytes.  Remove extraneous semicolon.  Punt on various
	corner-cases the APIs don't handle, like sizes > INT_MAX,
	BITS_PER_UNIT != 8, CHAR_BIT != 8.

	* gcc.c-torture/execute/pr98366.c: New test.
2020-12-19 22:24:10 +01:00
Iain Buclaw
e9e4ddfc5a d: Fix ICE in in force_decl_die, at dwarf2out.c with -gdwarf-2 -gstrict-dwarf [PR98067]
Manifest constants in D are represented as CONST_DECLs, which can be
imported from one module to another.  However, when compiling on strict
dwarf2 targets such as *-*-darwin10, importing CONST_DECLs cannot be
represented in debug as D did not exist as an AT_language until dwarf3,
and the only available fallback being DW_LANG_C.  As CONST_DECLs are
treated as enumerators in C, and not outputted individually in
gen_decl_die, this causes an internal error in force_decl_die to occur.

To handle this, similar to other places in dwarf2out, if a CONST_DECL is
seen in dwarf2out_imported_module_or_decl_1, then we simply return early
if the language is not one of Ada, D, or Fortran.

gcc/ChangeLog:

	PR d/98067
	* dwarf2out.c (dwarf2out_imported_module_or_decl_1): Handle
	  CONST_DECL only if is_fortran, is_ada, or is_dlang.

gcc/testsuite/ChangeLog:

	PR d/98067
	* gdc.dg/debug/debug.exp: New test.
	* gdc.dg/debug/dwarf2/dwarf2.exp: New test.
	* gdc.dg/debug/dwarf2/imports/pr98067.d: New test.
	* gdc.dg/debug/dwarf2/langdw2.d: New test.
	* gdc.dg/debug/dwarf2/langdw3.d: New test.
	* gdc.dg/debug/dwarf2/pr98067.d: New test.
	* gdc.dg/debug/trivial.d: New test.
2020-12-19 20:39:04 +01:00
Jakub Jelinek
9032d2b241 bswap: Fix up a thinko with empty CONSTRUCTORs [PR98378]
The code I've added recently in find_bswap_or_nop for VECTOR CONSTRUCTORs
is missing punt on an important case - namely empty CONSTRUCTORs, because in that
case the loop will not initialize *n and the code after the loop will then
use the uninitialized structure.

2020-12-19  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/98378
	* gimple-ssa-store-merging.c (find_bswap_or_nop): Punt if CONSTRUCTOR
	has no elements.
2020-12-19 12:46:40 +01:00
GCC Administrator
b1a2242e24 Daily bump. 2020-12-19 00:16:31 +00:00
Ian Lance Taylor
5128f8d0d9 compiler: check for floating-point exponent overflow
Adjust mksysinfo and mkrsysinfo to strip out floating-point max numbers,
as they can trigger this error.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/278476
2020-12-18 15:56:20 -08:00
Andrew MacLeod
0e9f2b2dc8 Re: [r11-6232 Regression] FAIL: gcc.dg/pr97750.c
Adjust testcase to not actually check for an undefined warning since we
don't really care about it, or what line it is issued on.

	gcc/testsuite/
	* gcc.dg/pr97750.c: Remove check for warning.
2020-12-18 17:08:42 -05:00
Jakub Jelinek
8b60459465 openmp: Don't optimize shared to firstprivate on task with depend clause
The attached testcase is miscompiled, because we optimize shared clauses
to firstprivate when task body can't modify the variable even when the
task has depend clause.  That is wrong, because firstprivate means the
variable will be copied immediately when the task is created, while with
depend clause some other task might change it later before the dependencies
are satisfied and the task should observe the value only after the change.

2020-12-18  Jakub Jelinek  <jakub@redhat.com>

	* gimplify.c (struct gimplify_omp_ctx): Add has_depend member.
	(gimplify_scan_omp_clauses): Set it to true if OMP_CLAUSE_DEPEND
	appears on OMP_TASK.
	(gimplify_adjust_omp_clauses_1, gimplify_adjust_omp_clauses): Force
	GOVD_WRITTEN on shared variables if task construct has depend clause.

	* testsuite/libgomp.c/task-6.c: New test.
2020-12-18 21:43:20 +01:00
Kwok Cheung Yeung
bfb37fa4dd openmp: Fix g++.dg/gomp/declare-target-3.C testcase when offloading is disabled
2020-12-18  Kwok Cheung Yeung  <kcy@codesourcery.com>

	gcc/testsuite/
	* g++.dg/gomp/declare-target-3.C: Only check .offload_var_table
	entries if offloading is enabled.
2020-12-18 12:28:49 -08:00
Jakub Jelinek
5dc998933e libcc1: Fix up libcc1 configure [PR98330]
Either we should write test x$darwin_dynamic_lookup = xyes
or we should make sure the variable is always defined to non-empty string.

2020-12-18  Jakub Jelinek  <jakub@redhat.com>

	PR bootstrap/98380
	* configure.ac: Set darwin_dynamic_lookup=no instead to empty
	string.
	* configure: Regenerated.
2020-12-18 20:25:26 +01:00
Przemyslaw Wirkus
d44d47b492 aarch64: SVE: ICE in expand_direct_optab_fn [PR98177]
Problem comes from using the wrong interface to get the index type for a
COND_REDUCTION. For fixed-length SVE we get a V2SI (a 64-bit Advanced
SIMD vector) instead of a VNx2SI (an SVE vector that stores SI elements
in DI containers).

Credits to Richard Sandiford for pointing out the issue's root cause.

Original PR snippet proposed to reproduce issue was only causing ICE for C++
compiler (see pr98177-1 test cases). I've slightly modified original
snippet in order to reproduce issue on both C and C++ compilers. These
are pr98177-2 test cases.

gcc/ChangeLog:

	PR target/98177
	* tree-vect-loop.c (vect_create_epilog_for_reduction): Use
	get_same_sized_vectype to obtain index type.
	(vectorizable_reduction): Likewise.

gcc/testsuite/ChangeLog:

	PR target/98177
	* g++.target/aarch64/sve/pr98177-1.C: New test.
	* g++.target/aarch64/sve/pr98177-2.C: New test.
	* gcc.target/aarch64/sve/pr98177-1.c: New test.
	* gcc.target/aarch64/sve/pr98177-2.c: New test.
2020-12-18 18:19:49 +00:00
Patrick Palka
60cecb2b83 libstdc++: Fix mistake in PR98374 change [PR98377]
The #ifdef RADIXCHAR directive should be moved one line up so that it
also guards the outer if statement, or else when RADIXCHAR is not
defined the outer if statement will end up nonsensically guarding the
declaration of output_length_upper_bound a few lines below it.

libstdc++-v3/ChangeLog:

	PR libstdc++/98377
	* src/c++17/floating_to_chars.cc (__floating_to_chars_precision):
	Fix mistake.
2020-12-18 13:01:49 -05:00
Patrick Palka
22a7e82c20 libstdc++: Fix build failure on AArch64 ILP32 [PR98370]
This should fix a build failure on AArch64 ILP32 due to int32_t mapping
to long int instead of int on this platform, which causes type deduction
to fail in the below call to std::max as reported in the PR.

libstdc++-v3/ChangeLog:

	PR libstdc++/98370
	* src/c++17/floating_to_chars.cc (__floating_to_chars_shortest):
	Provide explicit template arguments to the call to std::max.
2020-12-18 11:52:24 -05:00
Patrick Palka
d7bab388b8 libstdc++: Fix build failure due to missing <langinfo.h> [PR98374]
This should fix a build failure on Windows which lacks <langinfo.h>,
from which we use nl_langinfo() to obtain the radix character of the
current locale.  (We can't use the more portable localeconv() from
<clocale> to obtain the radix character of the current locale here
because it's not thread-safe, unfortunately.)

This change means that on Windows and other such platforms, we'll just
always assume the radix character used by printf is '.' when formatting
a long double through it.

libstdc++-v3/ChangeLog:

	PR libstdc++/98374
	* src/c++17/floating_to_chars.cc: Guard include of <langinfo.h>
	with __has_include.
	(__floating_to_chars_precision) [!defined(RADIXCHAR)]: Don't
	attempt to obtain the radix character of the current locale,
	just assume it's '.'.
2020-12-18 11:52:17 -05:00
Patrick Palka
266d746475 libstdc++: Check FE_TONEAREST is defined before using it
We need to test that FE_TONEAREST is defined before we may use it along
with fegetround/fesetround to adjust the floating-point rounding mode.
This fixes a build failure with older versions of newlib.

libstdc++-v3/ChangeLog:

	* src/c++17/floating_from_chars.cc (from_chars_impl)
	[!defined(FE_TONEAREST)]: Don't adjust the rounding mode.
	* src/c++17/floating_to_chars.cc (__floating_to_chars_precision):
	Likewise.
2020-12-18 11:52:14 -05:00
Kwok Cheung Yeung
3af02d32cc openmp: Implicitly add 'declare target' directives for dynamic initializers in C++
2020-12-18  Kwok Cheung Yeung  <kcy@codesourcery.com>

	gcc/
	* langhooks-def.h (lhd_get_decl_init): New.
	(lhd_finish_decl_inits): New.
	(LANG_HOOKS_GET_DECL_INIT): New.
	(LANG_HOOKS_OMP_FINISH_DECL_INITS): New.
	(LANG_HOOKS_DECLS): Add LANG_HOOKS_GET_DECL_INIT and
	LANG_HOOKS_OMP_FINISH_DECL_INITS.
	* langhooks.c (lhd_omp_get_decl_init): New.
	(lhd_omp_finish_decl_inits): New.
	* langhooks.h (struct lang_hooks_for_decls): Add omp_get_decl_init
	and omp_finish_decl_inits.
	* omp-offload.c (omp_discover_declare_target_var_r): Use
	get_decl_init langhook in place of DECL_INITIAL.  Call
	omp_finish_decl_inits langhook at end of function.

	gcc/cp/
	* cp-lang.c (cxx_get_decl_init): New.
	(cxx_omp_finish_decl_inits): New.
	(LANG_HOOKS_GET_DECL_INIT): New.
	(LANG_HOOKS_OMP_FINISH_DECL_INITS): New.
	* cp-tree.h (dynamic_initializers): New.
	* decl.c (dynamic_initializers): New.
	* decl2.c (c_parse_final_cleanups): Add initializer entries
	from vars to dynamic_initializers.

	gcc/testsuite/
	* g++.dg/gomp/declare-target-3.C: New.
2020-12-18 08:38:30 -08:00