Commit Graph

181707 Commits

Author SHA1 Message Date
Arnaud Charlet
b514643cae [Ada] Potential read of uninitialized variable in exp_dist.adb
gcc/ada/

	* exp_dist.adb (RCI_Cache): Initialize.
2020-11-30 09:16:18 -05:00
Arnaud Charlet
336aa630a0 [Ada] Address warning compiling terminals.c
gcc/ada/

	* terminals.c (allocate_pty_desc): Copy one less byte since the
	last byte will always be set to 0.
2020-11-30 09:16:18 -05:00
Eric Botcazou
a09afbd1c6 [Ada] Add stream-oriented attributes support for 128-bit integer types
gcc/ada/

	* doc/gnat_ugn/building_executable_programs_with_gnat.rst (-xdr):
	Document that XDR is not supported for 128-bit integer types.
	* gnat_ugn.texi: Regenerate.
	* exp_strm.adb (Build_Elementary_Input_Call): Deal with types
	larger than Long_Long_Integer.
	(Build_Elementary_Write_Call): Likewise.
	* rtsfind.ads (RE_Id): Add RE_I_LLL{I,U] and RE_W_LLL{I,U}.
	(RE_Unit_Table): Add entries for them.
	* libgnat/s-stratt.ads (I_LLLI): New inline function.
	(I_LLLU): Likewise.
	(W_LLLI): New inline procedure.
	(W_LLLU): Likewise.
	* libgnat/s-stratt.adb (S_LLLI): New subtype of SEA.
	(S_LLLU): Likewise.
	(From_LLLI): New instance of Unchecked_Conversion.
	(From_LLLU): Likewise.
	(To_LLLI): Likewise.
	(To_LLLU): Likewise.
	(I_LLLI): Implement.
	(I_LLLU): Likewise.
	(W_LLLI): Likewise.
	(W_LLLU): Likewise.
2020-11-30 09:16:18 -05:00
Ed Schonberg
4056d9abfa [Ada] Spurious error on iterator over container with modified private part
gcc/ada/

	* exp_ch5.adb (Expand_Iterator_Loop_Over_Container): Check the
	signature of the private operation Get_Element_Access to prevent
	accidental use of a user-defined homonym subprogram.
2020-11-30 09:16:17 -05:00
Yannick Moy
602c7bc215 [Ada] Add comment on special Heap variable used in GNATprove
gcc/ada/

	* spark_xrefs.ads: Add comment for Heap that it may remain
	Empty.
2020-11-30 09:16:17 -05:00
Pascal Obry
50a2820f9d [Ada] Fix serial port control setting on GNU/Linux
gcc/ada/

	* libgnat/g-sercom__linux.adb (Set): Fix control flags of the
	serial port setting.
2020-11-30 09:16:17 -05:00
Pascal Obry
a6617b2950 [Ada] Minor style fixes
gcc/ada/

	* libgnat/g-sercom__linux.adb: Minor style fixes.
2020-11-30 09:16:17 -05:00
Piotr Trojanek
9784779754 [Ada] Fix folding of comparison operators in GNATprove mode
gcc/ada/

	* exp_util.adb (Get_Current_Value_Condition): Don't use current
	value tracking in GNATprove mode.
	* sem_res.adb (Resolve_Comparison_Op): Remove incomplete
	special-casing for folding in GNATprove mode.
2020-11-30 09:16:16 -05:00
Bob Duff
a442bed36c [Ada] Crash on ghost assignment check for illegal code
gcc/ada/

	* errout.adb (Error_Msg_NEL): Do not call Set_Posted if errors
	are being ignored.
	(Error_Msg): Change Errors_Must_Be_Ignored to use the getter.
	* sem_ch8.adb (Find_Direct_Name): Do not skip all the error
	checks when ignoring errors, but instead do not add an entry to
	the Urefs table if errors are being ignored.
	* exp_ch5.adb: Minor comment fix.
2020-11-30 09:16:16 -05:00
Yannick Moy
f456de4c43 [Ada] Add continuation message when others choice not allowed
gcc/ada/

	* sem_aggr.adb (Resolve_Array_Aggregate): Improve error message.
2020-11-30 09:16:16 -05:00
Eric Botcazou
c161b39d05 [Ada] Small cleanup in System.Value_F
gcc/ada/

	* libgnat/s-valuef.adb (Integer_To_Fixed): Do not modify numerator
	or denominator in order to reduce the exponent.
2020-11-30 09:16:16 -05:00
Arnaud Charlet
b50706ef31 [Ada] Confusion in Transform_Function_Array and internal subprograms
gcc/ada/

	* ali-util.adb (Get_File_Checksum): Remove dead code.
	* exp_ch4.adb (Expand_Boolean_Operator, Expand_N_Op_Not,
	Make_Boolean_Array_Op): Take Transform_Function_Array into
	account.
	* exp_ch6.adb (Expand_Call_Helper): Update comment. Code
	cleanup.
	* exp_util.adb (Build_Procedure_Form): Use new predefined name
	Name_UP_RESULT.
	* snames.ads-tmpl (Name_UP_RESULT): New predefined name.  Code
	cleanup: remove unused names from the project parser, moved to
	gprbuild sources.
	* xsnamest.adb: Add support for uppercase names.
2020-11-30 09:16:15 -05:00
Ed Schonberg
86b747a553 [Ada] Spurious visibility error in subprogram body in with_clause
gcc/ada/

	* sem_util.adb (Enter_Name): When an inherited operation for a
	local derived type is hidden by an explicit declaration of a
	non-overloadable entity in the same scope, make the inherited
	operation non-visible to prevent its accidental use elsewhere.
2020-11-30 09:16:15 -05:00
Richard Biener
ebbe3f2951 tree-optimization/98064 - fix BB SLP live lane extract wrt LC SSA
This avoids breaking LC SSA when SLP codegen pulled an out-of-loop
def into a loop when merging with in-loop defs for an external def.

2020-11-30  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/98064
	* tree-vect-loop.c (vectorizable_live_operation): Avoid
	breaking LC SSA for BB vectorization.

	* g++.dg/vect/pr98064.cc: New testcase.
2020-11-30 14:29:57 +01:00
Martin Liska
1e5c644fb6 changelog: allow subdir wildcard entry
contrib/ChangeLog:

	* gcc-changelog/git_commit.py: Allow sub-directory wildcard
	changelog entry. Fix a typo caused by apostrophe escaping.
	* gcc-changelog/test_email.py: Test it.
	* gcc-changelog/test_patches.txt: Likewise.
2020-11-30 13:42:25 +01:00
Jonathan Wakely
d795a8ef4e doc: Fix description of dg-require-effective-target
The optional target selector for the dg-require-effective-target
directive needs to be { target selector } not just { selector } as
currently documented.

gcc/ChangeLog:

	* doc/sourcebuild.texi (Directives): Fix description of
	dg-require-effective-target to include "target" in selector.
2020-11-30 12:29:01 +00:00
Richard Biener
4bcded23eb tree-optimization/98048 - fix vector lowering of ABSU_EXPR
This makes sure to use the correct type for the LHS of the scalar
replacement statement.

20220-11-30  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/98048
	* tree-vect-generic.c (expand_vector_operations_1): Use the
	correct type for the scalar LHS replacement.

	* gcc.dg/vect/pr98048.c: New testcase.
2020-11-30 13:27:56 +01:00
Martin Liska
5877c544c1 gimple ISEL: fix BB stmt iteration
gcc/ChangeLog:

	PR tree-optimization/98066
	* gimple-isel.cc (gimple_expand_vec_exprs): Return when
	gimple_expand_vec_exprs replaces last stmt.
2020-11-30 12:57:31 +01:00
Jonathan Wakely
08cd56a6b3 gcc-changelog: Add libstdc++-v3/testsuite to wildcard prefixes
This allows using "testsuite/*" in libstdc++-v3/ChangeLog entries, which
was one of the original motivations for adding wildcard support in the
first place:
https://gcc.gnu.org/pipermail/gcc/2020-June/232719.html

contrib/ChangeLog:

	* gcc-changelog/git_commit.py (wildcard_prefixes): Add libstdc++
	testsuite directory.
2020-11-30 11:41:03 +00:00
Ilya Leoshkevich
4380d5ae72 rtl_dump_bb: fix segfault when reporting internal error
During ICE reporting, sometimes rtl_dump_bb is called on partially
initialized basic blocks.  This produces another ICE, obscuring the
original problem.

Fix by checking that that basic blocks are initialized before touching
their bb_infos.

gcc/ChangeLog:

2020-11-25  Ilya Leoshkevich  <iii@linux.ibm.com>

	* cfgrtl.c (rtl_bb_info_initialized_p): New function.
	(rtl_dump_bb): Use rtl_bb_info_initialized_p before accessing bb
	insns.
2020-11-30 11:50:30 +01:00
Iain Buclaw
e855b30c28 d: Add freebsd support for D compiler and runtime
gcc/ChangeLog:

	PR d/87818
	* config.gcc (*-*-freebsd*): Add freebsd-d.o and t-freebsd.
	* config/freebsd-d.c: New file.
	* config/t-freebsd: New file.

libphobos/ChangeLog:

	PR d/87818
	* configure.tgt: Add x86_64-*-freebsd* and i?86-*-freebsd* as
	supported targets.
2020-11-30 11:45:15 +01:00
Stam Markianos-Wright
dee11eb742 [Obvious] arm: Fix test from failing on some targets [PR91816]
This recently submitted test was found to fail on some Cortex-M
targets. This was because codegen on these CPUs would emit a ldr
instead of a movw/movt pair, resulting in an overall smaller test
(i.e. the branch wasn't as far) and the behaviour being tested
for not being triggered.

This commit doubles the size of the test to account for this.

gcc/testsuite/ChangeLog:

	* gcc.target/arm/pr91816.c: New test.
2020-11-30 10:36:26 +00:00
Jakub Jelinek
4d87bd39ba expansion: Improve double-word modulo by certain constant divisors [PR97459]
As discussed in the PR, e.g. on x86_64 (both -m32 and -m64) there is no
double-word modulo and so we expand it to a __{,u}mod[dt]i3 call.
For certain constant divisors we can do better.  E.g. consider
32-bit word-size, 0x100000000ULL % 3 == 1, so we can use partly the Hacker's
delight modulo by summing digits approach and optimize
unsigned long long foo (unsigned long long x) { return x % 3; }
as
unsigned long long foo (unsigned long long x) {
  unsigned int sum, carry;
  carry = __builtin_add_overflow ((unsigned int) x, (unsigned int) (x >> 32), &sum);
  sum += carry;
  return sum % 3;
}
Similarly, 0x10000000ULL % 5 == 1 (note, 1 << 28), so
unsigned long long bar (unsigned long long x) { return x % 5; }
as
unsigned long long bar (unsigned long long x) {
  unsigned int sum = x & ((1 << 28) - 1);
  sum += (x >> 28) & ((1 << 28) - 1);
  sum += (x >> 56);
  return sum % 5;
}
etc.
And we can do also signed modulo,
long long baz (long long x) { return x % 5; }
as
long long baz (long long x) {
  unsigned int sum = x & ((1 << 28) - 1);
  sum += ((unsigned long long) x >> 28) & ((1 << 28) - 1);
  sum += ((unsigned long long) x >> 56);
  /* Sum adjustment for negative x.  */
  sum += (x >> 63) & 3;
  unsigned int rem = sum % 5;
  /* And finally adjust it to the right interval for negative values.  */
  return (int) (rem + ((x >> 63) & -4));
}

2020-11-30  Jakub Jelinek  <jakub@redhat.com>

	PR rtl-optimization/97459
	* internal-fn.h (expand_addsub_overflow): Declare.
	* internal-fn.c (expand_addsub_overflow): No longer static.
	* optabs.c (expand_doubleword_mod): New function.
	(expand_binop): Optimize double-word mod with constant divisor.

	* gcc.dg/pr97459-1.c: New test.
	* gcc.dg/pr97459-2.c: New test.
2020-11-30 10:55:43 +01:00
Martin Liska
fbbce1c6e9 changelog: Allow wildcard pattern only.
contrib/ChangeLog:

	* gcc-changelog/git_commit.py: Allow wildcard pattern only.
2020-11-30 10:40:36 +01:00
Kito Cheng
a5ad5d5c47 RISC-V: Always define MULTILIB_DEFAULTS
- Define MULTILIB_DEFAULTS can reduce the total number of multilib if
   the default arch and ABI are listed in the multilib config.

 - This also simplify the implementation of --with-multilib-list.

gcc/ChangeLog:

	* config.gcc (riscv*-*-*): Add TARGET_RISCV_DEFAULT_ABI and
	TARGET_RISCV_DEFAULT_ARCH to tm_defines.
	Remove including riscv/withmultilib.h for --with-multilib-list.
	* config/riscv/riscv.h (STRINGIZING): New.
	(__STRINGIZING): Ditto.
	(MULTILIB_DEFAULTS): Ditto.
	* config/riscv/withmultilib.h: Remove.
2020-11-30 11:50:30 +08:00
Kito Cheng
3a5d8ed231 Fix print_multilib_info when default arguments appear in the option list with '!'
This issue is found when we try to always define MULTILIB_DEFAULTS for -march
and -mabi for RISC-V back-end, however `-print-multi-lib` will skip
multi-lib setting if match any one of flag in MULTILIB_DEFAULTS, even
some options are specified in the option list with '!'.

e.g.

We have default march=rv32i and mabi=ilp32.

And we have following multi-lib set:

". !march=rv32i !march=rv32im !march=rv32imafc !mabi=ilp32 !mabi=ilp32f;"
"rv32i/ilp32 march=rv32i !march=rv32im !march=rv32imafc mabi=ilp32 !mabi=ilp32f;"
"rv32im/ilp32 !march=rv32i march=rv32im !march=rv32imafc mabi=ilp32 !mabi=ilp32f;"
"rv32imafc/ilp32f !march=rv32i !march=rv32ic !march=rv32im march=rv32imafc !mabi=ilp32 mabi=ilp32f;"

`-print-multi-lib` willl show `.` and `rv32imafc/ilp32f` only, because
the mabi=ilp32 is matched, however there is `!march=rv32i` in `rv32im/ilp32`, so
`rv32im/ilp32` should keep, because it reject march=rv32i.

Note: This can be reproduced via following configure options with patch [1]:
gcc/configure --target=riscv64-elf --with-arch=rv32i --with-abi=ilp32 \
  --with-multilib-generator="rv32i-ilp32--;rv32im-ilp32--;rv32imafc-ilp32f--"

[1] https://gcc.gnu.org/pipermail/gcc-patches/2020-November/559707.html

gcc/ChangeLog:

	* gcc.c (print_multilib_info): Check default arguments not
	appeared in multi-lib option list with '!'
2020-11-30 11:50:30 +08:00
Stefan Kanthak
a8ae23920f fixed _bswapsi2 function
libgcc

	* libgcc2.c (bswapsi2): Make constants unsigned.
2020-11-29 18:05:46 -07:00
Jeff Law
5f628fb5ce Fix minor bug in ft32 widening multiply
gcc/
	* config/ft32/ft32.md (umulsidi3): Do not allow constants as
	arguments.
2020-11-29 18:03:28 -07:00
GCC Administrator
a9625c50dd Daily bump. 2020-11-30 00:16:27 +00:00
Harald Anlauf
bb67ad5cff PR fortran/98017 - Suspected regression using PACK
When substituting a parameter variable of type character, the character
length was reset to 1.  Fix this by copying the length.

gcc/fortran/ChangeLog:

	* expr.c (simplify_parameter_variable): Fix up character length
	after copying an array-valued expression.

gcc/testsuite/ChangeLog:

	* gfortran.dg/pr98017.f90: New test.
2020-11-29 23:24:45 +01:00
Jan Hubicka
ccea13715b Fix handling of ignore_stores in ipa_merge_modref_summary_after_inlining
* ipa-modref.c (ipa_merge_modref_summary_after_inlining): Fix
	handling of ignore_stores.
2020-11-29 23:23:33 +01:00
Jan Hubicka
caea077c17 Fix freeing of thunk-info
PR jit/97867
	* symtab-thunks.h (thunk_info::release): Use ggc_delete.
2020-11-29 23:22:24 +01:00
Martin Sebor
eafe8ee7af Handle PHIs in compute_objsize.
PR middle-end/92936 - missing warning on a past-the-end store to a PHI
PR middle-end/92940 - incorrect offset and size in -Wstringop-overflow for out-of-bounds store into VLA and two offset ranges
PR middle-end/89428 - missing -Wstringop-overflow on a PHI with variable offset

gcc/ChangeLog:

	PR middle-end/92936
	PR middle-end/92940
	PR middle-end/89428
	* builtins.c (access_ref::access_ref): Initialize member.
	(access_ref::phi): New function.
	(access_ref::get_ref): New function.
	(access_ref::add_offset): Remove duplicate assignment.
	(maybe_warn_for_bound): Add "maybe" kind of warning messages.
	(warn_for_access): Same.
	(inform_access): Rename...
	(access_ref::inform_access): ...to this.  Print PHI arguments.  Format
	offset the same as size and simplify.  Improve printing of allocation
	functions and VLAs.
	(check_access): Adjust to the above.
	(gimple_parm_array_size): Change argument.
	(handle_min_max_size): New function.
	* builtins.h (class ssa_name_limit_t): Move class here from
	tree-ssa-strlen.c.
	(struct access_ref): Declare new members.
	(gimple_parm_array_size): Change argument.
	* tree-ssa-strlen.c (maybe_warn_overflow): Use access_ref and simplify.
	(handle_builtin_memcpy): Correct argument passed to maybe_warn_overflow.
	(handle_builtin_memset): Same.
	(class ssa_name_limit_t): Move class to builtins.{h,c}.

gcc/testsuite/ChangeLog:

	PR middle-end/92936
	PR middle-end/92940
	PR middle-end/89428
	* c-c++-common/Wstringop-overflow-2.c: Adjust text of expected
	informational notes.
	* g++.dg/warn/Wstringop-overflow-3.C: Same.
	* g++.dg/warn/Wplacement-new-size.C: Remove a test for a no longer
	issued warning.
	* gcc.dg/Warray-bounds-43.c: Removed unused declarations.
	* gcc.dg/Wstringop-overflow-11.c: Remove xfails.
	* gcc.dg/Wstringop-overflow-12.c: Same.
	* gcc.dg/Wstringop-overflow-17.c: Adjust text of expected messages.
	* gcc.dg/Wstringop-overflow-27.c: Same.  Remove xfails.
	* gcc.dg/Wstringop-overflow-28.c: Adjust text of expected messages.
	* gcc.dg/Wstringop-overflow-29.c: Same.
	* gcc.dg/Wstringop-overflow-37.c: Same.
	* gcc.dg/Wstringop-overflow-46.c: Same.
	* gcc.dg/Wstringop-overflow-47.c: Same.
	* gcc.dg/Wstringop-overflow-54.c: Same.
	* gcc.dg/warn-strnlen-no-nul.c: Add expected warning.
	* gcc.dg/Wstringop-overflow-7.c: New test.
	* gcc.dg/Wstringop-overflow-58.c: New test.
	* gcc.dg/Wstringop-overflow-59.c: New test.
	* gcc.dg/Wstringop-overflow-60.c: New test.
	* gcc.dg/Wstringop-overflow-61.c: New test.
	* gcc.dg/Wstringop-overflow-62.c: New test.
	* gcc.dg/Wstringop-overflow-63.c: New test.
	* gcc.dg/Wstringop-overflow-64.c: New test.
2020-11-29 15:12:32 -07:00
Iain Buclaw
4dce3b05ec d: Add darwin support for D language front-end
gcc/ChangeLog:

	* config.gcc (*-*-darwin*): Set d_target_objs and target_has_targetdm.
	* config/elfos.h (TARGET_D_MINFO_SECTION): New macro.
	(TARGET_D_MINFO_START_NAME): New macro.
	(TARGET_D_MINFO_END_NAME): New macro.
	* config/t-darwin: Add darwin-d.o.
	* doc/tm.texi: Regenerate.
	* doc/tm.texi.in (D language and ABI): Add @hook for
	TARGET_D_MINFO_SECTION, TARGET_D_MINFO_START_NAME, and
	TARGET_D_MINFO_END_NAME.
	* config/darwin-d.c: New file.

gcc/d/ChangeLog:

	* d-target.def (d_minfo_section): New hook.
	(d_minfo_start_name): New hook.
	(d_minfo_end_name): New hook.
	* modules.cc: Include d-target.h.
	(register_moduleinfo): Update to use new targetdm hooks.
2020-11-29 22:10:00 +01:00
Iain Buclaw
2fdf75cb70 configure: Support building D front-end on *-*-darwin*
The bootstrap has been confirmed to be succeeding, there's no need to
set it as an unsupported language.

ChangeLog:

	PR d/87788
	* configure.ac: Don't disable D for *-*-darwin*.
	* configure: Regenerate.
2020-11-29 22:09:42 +01:00
John David Anglin
4e4ba6478a Fix hppa64-hpux11 build to remove source paths from embedded path.
This change adds the +nodefaultrpath ld option to remove all library
paths that were specified with the -L option from the embedded path.

2020-11-29  John David Anglin  <danglin@gcc.gnu.org>

ChangeLog:
	* libtool.m4 (archive_cmds): Add +nodefaultrpath ld option on
	hppa64-*-hpux11*.

libatomic/ChangeLog:
	* configure: Regenerate.

libbacktrace/ChangeLog:
	* configure: Regenerate.

libcc1/ChangeLog:
	* configure: Regenerate.

libffi/ChangeLog:
	* configure: Regenerate.

libgfortran/ChangeLog:
	* configure: Regenerate.

libgomp/ChangeLog:
	* configure: Regenerate.

libhsail-rt/ChangeLog:
	* configure: Regenerate.

libitm/ChangeLog:
	* configure: Regenerate.

libobjc/ChangeLog:
	* configure: Regenerate.

liboffloadmic/ChangeLog:
	* configure: Regenerate.
	* plugin/configure: Regenerate.

libquadmath/ChangeLog:
	* configure: Regenerate.

libsanitizer/ChangeLog:
	* configure: Regenerate.

libssp/ChangeLog:
	* configure: Regenerate.

libstdc++-v3/ChangeLog:
	* configure: Regenerate.

libvtv/ChangeLog:
	* configure: Regenerate.

lto-plugin/ChangeLog:
	* configure: Regenerate.

zlib/ChangeLog:
	* configure: Regenerate.
2020-11-29 20:11:38 +00:00
John David Anglin
4612c4d09d Fix PR ada/97504 on hppa*-*-hpux*.
2020-11-29  John David Anglin  <danglin@gcc.gnu.org>

gcc/ada/
	PR ada/97504
	* Makefile.rtl (LIBGNAT_TARGET_PAIRS) <hppa*-*-hpux*>: Use wraplf
	version of Aux_Long_Long_Float.
2020-11-29 15:57:40 +00:00
Jan Hubicka
01148fa656 Skip EAF_UNUSED parameters in handle_pure_call
* tree-ssa-structalias.c (handle_pure_call): Skip EAF_UNUSED
	 parameters.
2020-11-29 16:31:47 +01:00
Jan Hubicka
3350e59f29 Detect unused parameters in ipa-modref
* ipa-modref.c (modref_lattice::merge): Do nothing if F is EAF_UNUSED.
	(analyze_parms): Detect unused params.
	(modref_merge_call_site_flags): Merge correct EAF_UNUSED.
2020-11-29 16:27:35 +01:00
Iain Buclaw
f59be8dfbd d: Remove d_size_t from front-end sources (PR 87788)
The typedef for d_size_t assumes that the implementation of the
front-end is written in D itself, where size_t can map only to uint32_t
or uint64_t.  As that is not the case for the current D front-end, the
typedef should be removed. This would fix the bootstrap on targets where
in C++ size_t is a long, such as darwin i386.

Reviewed-on: https://github.com/dlang/dmd/pull/12008

gcc/d/ChangeLog:

	PR d/87788
	* dmd/MERGE: Merge upsream dmd 45fa6cfd2.
2020-11-29 13:06:32 +01:00
GCC Administrator
5fbf0ecb01 Daily bump. 2020-11-29 00:16:22 +00:00
Eric Botcazou
8e59ff5541 Improve support of simple bit-fields in -fdump-ada-spec
This fixes an issue with nested structures and adds an Alignment clause
to counter the effect of the Pack aspect.

gcc/c-family/ChangeLog:
	* c-ada-spec.c (dump_nested_type) <RECORD_TYPE>: Remove obsolete code.
	(dump_ada_structure): Also deal with convention, unchecked union and
	bit-field for nested types.  In the latter case, print an Alignment
	aspect along with the Pack aspect.
2020-11-28 16:39:20 +01:00
Ian Lance Taylor
b1adbc27c4 compiler: avoid follow-on errors for bad types
Mark bad types as erroneous, to avoid generating further errors.

This required some code using array types to check for errors.

For https://golang.org/issue/19880

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/273626
2020-11-28 07:01:41 -08:00
Ian Lance Taylor
822ea13e49 compiler: better error for x, x := 1, 2
Was
    assign.go:59:28: error: multiple assignments to x
Now
    assign.go:59:28: error: ‘x’ repeated on left side of :=

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/273546
2020-11-28 06:57:06 -08:00
Eric Botcazou
c04bd12b06 Fix PR target/97939
The little dance around 4096 that add/sub instructions do on the SPARC
needs to be taken into account for the overflow arithmetic operations.
It cannot be done for unsigned overflow, but it can be done for signed
overflow.

gcc/ChangeLog:
	PR target/97939
	* config/sparc/predicates.md (arith_double_add_operand): Comment.
	* config/sparc/sparc.md (uaddvdi4): Use arith_double_operand.
	(addvdi4): Use arith_double_add_operand.
	(addsi3): Remove useless attributes.
	(addvsi4): Use arith_add_operand.
	(*cmp_ccv_plus): Likewise and add second alternative accordingly.
	(*cmp_ccxv_plus): Likewise.
	(*cmp_ccv_plus_set): Likewise.
	(*cmp_ccxv_plus_set): Likewise.
	(*cmp_ccv_plus_sltu_set): Likewise.
	(usubvdi4): Use arith_double_operand.
	(subvdi4): Use arith_double_add_operand.
	(subsi3): Remove useless attributes.
	(subvsi4): Use arith_add_operand.
	(*cmp_ccv_minus): Likewise and add second alternative accordingly.
	(*cmp_ccxv_minus): Likewise.
	(*cmp_ccv_minus_set): Likewise.
	(*cmp_ccxv_minus_set): Likewise.
	(*cmp_ccv_minus_sltu_set): Likewise.
	(negsi2): Use register_operand.
	(unegvsi3): Likewise.
	(negvsi3) Likewise.
	(*cmp_ccnz_neg): Likewise.
	(*cmp_ccxnz_neg): Likewise.
	(*cmp_ccnz_neg_set): Likewise.
	(*cmp_ccxnz_neg_set): Likewise.
	(*cmp_ccc_neg_set): Likewise.
	(*cmp_ccxc_neg_set): Likewise.
	(*cmp_ccc_neg_sltu_set): Likewise.
	(*cmp_ccv_neg): Likewise.
	(*cmp_ccxv_neg): Likewise.
	(*cmp_ccv_neg_set): Likewise.
	(*cmp_ccxv_neg_set): Likewise.
	(*cmp_ccv_neg_sltu_set): Likewise.

gcc/testsuite/ChangeLog:
	* gcc.target/sparc/overflow-6.c: New test.
2020-11-28 13:01:41 +01:00
Thomas Koenig
36ec54aac7 Generate correct fn specs for some Fortran library functions.
This patch works by generating the correct fn spec from the
actual arguments in specific_intrinsic_symbol, and by passing this
down via gfc_get_extern_function_decl to gfc_get_function_type.
CSHIFT remains to be done.

gcc/fortran/ChangeLog:

	PR fortran/97454
	* trans-decl.c (gfc_get_extern_function_decl): Add argument
	fnspec.
	* trans-intrinsic.c (MAX_SPEC_ARG): Define.
	(intrinsic_fnspec): New function.
	(ADD_CHAR): Define.
	(specific_intrinsic_symbol): Adjust comment. Pass
	fn spec to gfc_get_extern_function_decl.
	(gfc_conv_intrinsic_funcall): Add ANY, ALL, NORM2, PRODUCT
	and SUM intrnisic. Add FIXME for cshift et al.
	* trans-types.c	(gfc_get_function_type): Add fnspec argument,
	handle it.
	* trans-types.h (gfc_get_function_type): Add optinal fnspec
	argument.
	* trans.h (gfc_get_extern_function_decl): Likewise.
2020-11-28 12:37:17 +01:00
GCC Administrator
e87559d202 Daily bump. 2020-11-28 00:16:38 +00:00
Martin Sebor
fb6b29c85c Revert previous change and use pragma to suppress -Wformat-diag.
gcc/cp/ChangeLog:

	* error.c (add_quotes): Revert previous change and use pragma to
	suppress -Wformat-diag.
2020-11-27 16:06:18 -07:00
Joseph Myers
9ccffd1298 preprocessor: Fix #line overflow check [PR97602]
The preprocessor check for overflow (of linenum_type = unsigned int)
when reading the line number in a #line directive is incomplete; it
checks "reg < reg_prev" which doesn't cover all cases where
multiplying by 10 overflowed.  Fix this by checking for overflow
before rather than after it occurs (using essentially the same logic
as used by e.g. glibc printf when reading width and precision values
from strings).

Bootstrapped with no regressions for x86_64-pc-linux-gnu.

libcpp/
2020-11-27  Joseph Myers  <joseph@codesourcery.com>

	PR preprocessor/97602
	* directives.c (strtolinenum): Check for overflow before it
	occurs.  Correct comment.

gcc/testsuite/
2020-11-27  Joseph Myers  <joseph@codesourcery.com>

	PR preprocessor/97602
	* gcc.dg/cpp/line9.c, gcc.dg/cpp/line10.c: New tests.
2020-11-27 22:40:01 +00:00
Iain Buclaw
5dbab7b3f4 libphobos: Fix segfault at run-time when using custom Fibers (PR 98025)
When libphobos is configured with --enable-cet, this adds extra fields
to the Fiber class to support the ucontext_t fallback implementation.
These fields get omitted when compiling user code unless they also used
`-fversion=CET' to build their project, which resulted in data being
overwritten from within swapcontext().

On reviewing the ucontext_t definitions, it was found that the shadow
stack fields were missing, and the struct size didn't match up on X32.
This has been fixed in upstream druntime and merged down here.

Reviewed-on: https://github.com/dlang/druntime/pull/3293

libphobos/ChangeLog:

	PR d/98025
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* configure.ac (DCFG_ENABLE_CET): Substitute.
	* libdruntime/MERGE: Merge upstream druntime 0fe7974c.
	* libdruntime/Makefile.in: Regenerate.
	* libdruntime/core/thread.d: Import gcc.config.
	(class Fiber): Add ucontext_t fields when GNU_Enable_CET is true.
	* libdruntime/gcc/config.d.in (GNU_Enable_CET): Define.
	* src/Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.
2020-11-27 21:27:14 +01:00