Skip to content
Snippets Groups Projects
  1. Nov 25, 2020
    • Matthew Malcomson's avatar
      libsanitizer: Add option to bootstrap using HWASAN · 170e618e
      Matthew Malcomson authored
      This is an analogous option to --bootstrap-asan to configure.  It allows
      bootstrapping GCC using HWASAN.
      
      For the same reasons as for ASAN we have to avoid using the HWASAN
      sanitizer when compiling libiberty and the lto-plugin.
      
      Also add a function to query whether -fsanitize=hwaddress has been
      passed.
      
      ChangeLog:
      
      	* configure: Regenerate.
      	* configure.ac: Add --bootstrap-hwasan option.
      
      config/ChangeLog:
      
      	* bootstrap-hwasan.mk: New file.
      
      gcc/ChangeLog:
      
      	* doc/install.texi: Document new option.
      
      libiberty/ChangeLog:
      
      	* configure: Regenerate.
      	* configure.ac: Avoid using sanitizer.
      
      lto-plugin/ChangeLog:
      
      	* Makefile.am: Avoid using sanitizer.
      	* Makefile.in: Regenerate.
      170e618e
    • Matthew Malcomson's avatar
      libsanitizer: Only build libhwasan when targeting AArch64 · 8a769f81
      Matthew Malcomson authored
      Though the library has limited support for x86, we don't have any
      support for generating code targeting x86 so there is no point building
      for that target.
      
      Ensure we build for AArch64 but not for AArch64 ilp32.
      
      libsanitizer/ChangeLog:
      
      	* Makefile.am: Condition Build hwasan directory.
      	* Makefile.in: Regenerate.
      	* configure: Regenerate.
      	* configure.ac: Set HWASAN_SUPPORTED based on target
      	architecture.
      	* configure.tgt: Likewise.
      8a769f81
    • Matthew Malcomson's avatar
      libsanitizer: Tie the hwasan library into our build system · edb07cb9
      Matthew Malcomson authored
      This patch tries to tie libhwasan into the GCC build system in the same way
      that the other sanitizer runtime libraries are handled.
      
      libsanitizer/ChangeLog:
      
      	* Makefile.am:  Build libhwasan.
      	* Makefile.in:  Build libhwasan.
      	* asan/Makefile.in:  Build libhwasan.
      	* configure:  Build libhwasan.
      	* configure.ac:  Build libhwasan.
      	* hwasan/Makefile.am: New file.
      	* hwasan/Makefile.in: New file.
      	* hwasan/libtool-version: New file.
      	* interception/Makefile.in: Build libhwasan.
      	* libbacktrace/Makefile.in: Build libhwasan.
      	* libsanitizer.spec.in: Build libhwasan.
      	* lsan/Makefile.in: Build libhwasan.
      	* sanitizer_common/Makefile.in: Build libhwasan.
      	* tsan/Makefile.in: Build libhwasan.
      	* ubsan/Makefile.in: Build libhwasan.
      edb07cb9
    • Matthew Malcomson's avatar
      libsanitizer: Hwasan reporting check for dladdr failing · 8eb12742
      Matthew Malcomson authored
      In `GetGlobalSizeFromDescriptor` we use `dladdr` to get info on the the
      current address.  `dladdr` returns 0 if it failed.
      During testing on Linux this returned 0 to indicate failure, and
      populated the `info` structure with a NULL pointer which was
      dereferenced later.
      
      This patch checks for `dladdr` returning 0, and in that case returns 0
      from `GetGlobalSizeFromDescriptor` to indicate failure of identifying
      the address.
      
      This occurs when `GetModuleNameAndOffsetForPC` succeeds for some address
      not in a dynamically loaded library.  One example is when the found
      "module" is '[stack]' having come from parsing /proc/self/maps.
      
      Cherry-pick from 83ac18205ec69a00ac2be3b603bc3a61293fbe89.
      
      Differential Revision: https://reviews.llvm.org/D91344
      8eb12742
    • Martin Liska's avatar
      libsanitizer: add hwasan. · 1ee3d1ef
      Martin Liska authored
      Introduce the libhwasan library from LLVM sources.
      1ee3d1ef
    • Jakub Jelinek's avatar
      testsuite: Rename test to avoid typo in its name [PR95862] · b13dacdf
      Jakub Jelinek authored
      2020-11-25  Jakub Jelinek  <jakub@redhat.com>
      
      	PR rtl-optimization/95862
      	* gcc.dg/builtin-artih-overflow-5.c: Renamed to ...
      	* gcc.dg/builtin-arith-overflow-5.c: ... this.
      b13dacdf
    • Richard Sandiford's avatar
      aarch64: Avoid false dependencies for SVE unary operations · a4d9837e
      Richard Sandiford authored
      For calls like:
      
              z0 = svabs_s8_x (p0, z1)
      
      we previously generated:
      
              abs     z0.b, p0/m, z1.b
      
      However, this creates a false dependency on z0 (the merge input).
      This can lead to strange results in some cases, e.g. serialising
      the operation behind arbitrary earlier operations, or preventing
      two iterations of a loop from being executed in parallel.
      
      This patch therefore ties the input to the output, using a MOVPRFX
      if necessary and possible.  (The SVE2 unary long instructions do
      not support MOVPRFX.)
      
      When testing the patch, I hit a bug in the big-endian SVE move
      optimisation in aarch64_maybe_expand_sve_subreg_move.  I don't
      have an indepenedent testcase for it, so I didn't split it out
      into a separate patch.
      
      gcc/
      	* config/aarch64/aarch64.c (aarch64_maybe_expand_sve_subreg_move):
      	Do not optimize LRA subregs.
      	* config/aarch64/aarch64-sve.md
      	(@aarch64_pred_<SVE_INT_UNARY:optab><mode>): Tie the input to the
      	output.
      	(@aarch64_sve_revbhw_<SVE_ALL:mode><PRED_HSD:mode>): Likewise.
      	(*<ANY_EXTEND:optab><SVE_PARTIAL_I:mode><SVE_HSDI:mode>2): Likewise.
      	(@aarch64_pred_sxt<SVE_FULL_HSDI:mode><SVE_PARTIAL_I:mode>): Likewise.
      	(*cnot<mode>): Likewise.
      	(@aarch64_pred_<SVE_COND_FP_UNARY:optab><mode>): Likewise.
      	(@aarch64_sve_<optab>_nontrunc<SVE_FULL_F:mode><SVE_FULL_HSDI:mode>):
      	Likewise.
      	(@aarch64_sve_<optab>_trunc<VNx2DF_ONLY:mode><VNx4SI_ONLY:mode>):
      	Likewise.
      	(@aarch64_sve_<optab>_nonextend<SVE_FULL_HSDI:mode><SVE_FULL_F:mode>):
      	Likewise.
      	(@aarch64_sve_<optab>_extend<VNx4SI_ONLY:mode><VNx2DF_ONLY:mode>):
      	Likewise.
      	(@aarch64_sve_<optab>_trunc<SVE_FULL_SDF:mode><SVE_FULL_HSF:mode>):
      	Likewise.
      	(@aarch64_sve_<optab>_trunc<VNx4SF_ONLY:mode><VNx8BF_ONLY:mode>):
      	Likewise.
      	(@aarch64_sve_<optab>_nontrunc<SVE_FULL_HSF:mode><SVE_FULL_SDF:mode>):
      	Likewise.
      	* config/aarch64/aarch64-sve2.md
      	(@aarch64_pred_<SVE2_COND_FP_UNARY_LONG:sve_fp_op><mode>): Likewise.
      	(@aarch64_pred_<SVE2_COND_FP_UNARY_NARROWB:sve_fp_op><mode>): Likewise.
      	(@aarch64_pred_<SVE2_U32_UNARY:sve_int_op><mode>): Likewise.
      	(@aarch64_pred_<SVE2_COND_INT_UNARY_FP:sve_fp_op><mode>): Likewise.
      
      gcc/testsuite/
      	* gcc.target/aarch64/sve/acle/asm/abs_f16.c (abs_f16_x_untied): Expect
      	a MOVPRFX instruction.
      	* gcc.target/aarch64/sve/acle/asm/abs_f32.c (abs_f32_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/abs_f64.c (abs_f64_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/abs_s16.c (abs_s16_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/abs_s32.c (abs_s32_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/abs_s64.c (abs_s64_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/abs_s8.c (abs_s8_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/cls_s16.c (cls_s16_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/cls_s32.c (cls_s32_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/cls_s64.c (cls_s64_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/cls_s8.c (cls_s8_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/clz_s16.c (clz_s16_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/clz_s32.c (clz_s32_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/clz_s64.c (clz_s64_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/clz_s8.c (clz_s8_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/clz_u16.c (clz_u16_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/clz_u32.c (clz_u32_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/clz_u64.c (clz_u64_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/clz_u8.c (clz_u8_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/cnot_s16.c (cnot_s16_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/cnot_s32.c (cnot_s32_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/cnot_s64.c (cnot_s64_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/cnot_s8.c (cnot_s8_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/cnot_u16.c (cnot_u16_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/cnot_u32.c (cnot_u32_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/cnot_u64.c (cnot_u64_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/cnot_u8.c (cnot_u8_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/cnt_bf16.c (cnt_bf16_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/cnt_f16.c (cnt_f16_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/cnt_f32.c (cnt_f32_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/cnt_f64.c (cnt_f64_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/cnt_s16.c (cnt_s16_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/cnt_s32.c (cnt_s32_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/cnt_s64.c (cnt_s64_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/cnt_s8.c (cnt_s8_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/cnt_u16.c (cnt_u16_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/cnt_u32.c (cnt_u32_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/cnt_u64.c (cnt_u64_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/cnt_u8.c (cnt_u8_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/cvt_bf16.c (cvt_bf16_f32_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/cvt_f16.c (cvt_f16_f32_x_untied)
      	(cvt_f16_f64_x_untied, cvt_f16_s16_x_untied, cvt_f16_s32_x_untied)
      	(cvt_f16_s64_x_untied, cvt_f16_u16_x_untied, cvt_f16_u32_x_untied)
      	(cvt_f16_u64_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/cvt_f32.c (cvt_f32_f16_x_untied)
      	(cvt_f32_f64_x_untied, cvt_f32_s16_x_untied, cvt_f32_s32_x_untied)
      	(cvt_f32_s64_x_untied, cvt_f32_u16_x_untied, cvt_f32_u32_x_untied)
      	(cvt_f32_u64_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/cvt_f64.c (cvt_f64_f16_x_untied)
      	(cvt_f64_f32_x_untied, cvt_f64_s16_x_untied, cvt_f64_s32_x_untied)
      	(cvt_f64_s64_x_untied, cvt_f64_u16_x_untied, cvt_f64_u32_x_untied)
      	(cvt_f64_u64_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/cvt_s16.c (cvt_s16_f16_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/cvt_s32.c (cvt_s32_f16_x_untied)
      	(cvt_s32_f32_x_untied, cvt_s32_s64_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/cvt_s64.c (cvt_s64_f16_x_untied)
      	(cvt_s64_f32_x_untied, cvt_s64_s64_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/cvt_u16.c (cvt_u16_f16_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/cvt_u32.c (cvt_u32_f16_x_untied)
      	(cvt_u32_f32_x_untied, cvt_u32_u64_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/cvt_u64.c (cvt_u64_f16_x_untied)
      	(cvt_u64_f32_x_untied, cvt_u64_u64_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/extb_s16.c (extb_s16_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/extb_s32.c (extb_s32_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/extb_s64.c (extb_s64_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/exth_s32.c (exth_s32_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/exth_s64.c (exth_s64_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/extw_s64.c (extw_s64_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/neg_f16.c (neg_f16_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/neg_f32.c (neg_f32_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/neg_f64.c (neg_f64_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/neg_s16.c (neg_s16_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/neg_s32.c (neg_s32_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/neg_s64.c (neg_s64_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/neg_s8.c (neg_s8_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/not_s16.c (not_s16_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/not_s32.c (not_s32_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/not_s64.c (not_s64_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/not_s8.c (not_s8_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/not_u16.c (not_u16_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/not_u32.c (not_u32_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/not_u64.c (not_u64_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/not_u8.c (not_u8_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/rbit_s16.c (rbit_s16_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/rbit_s32.c (rbit_s32_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/rbit_s64.c (rbit_s64_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/rbit_s8.c (rbit_s8_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/rbit_u16.c (rbit_u16_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/rbit_u32.c (rbit_u32_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/rbit_u64.c (rbit_u64_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/rbit_u8.c (rbit_u8_x_untied): Ditto.
      	* gcc.target/aarch64/sve/acle/asm/recpx_f16.c (recpx_f16_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/recpx_f32.c (recpx_f32_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/recpx_f64.c (recpx_f64_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/revb_s16.c (revb_s16_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/revb_s32.c (revb_s32_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/revb_s64.c (revb_s64_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/revb_u16.c (revb_u16_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/revb_u32.c (revb_u32_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/revb_u64.c (revb_u64_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/revh_s32.c (revh_s32_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/revh_s64.c (revh_s64_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/revh_u32.c (revh_u32_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/revh_u64.c (revh_u64_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/revw_s64.c (revw_s64_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/revw_u64.c (revw_u64_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/rinta_f16.c (rinta_f16_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/rinta_f32.c (rinta_f32_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/rinta_f64.c (rinta_f64_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/rinti_f16.c (rinti_f16_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/rinti_f32.c (rinti_f32_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/rinti_f64.c (rinti_f64_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/rintm_f16.c (rintm_f16_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/rintm_f32.c (rintm_f32_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/rintm_f64.c (rintm_f64_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/rintn_f16.c (rintn_f16_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/rintn_f32.c (rintn_f32_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/rintn_f64.c (rintn_f64_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/rintp_f16.c (rintp_f16_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/rintp_f32.c (rintp_f32_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/rintp_f64.c (rintp_f64_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/rintx_f16.c (rintx_f16_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/rintx_f32.c (rintx_f32_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/rintx_f64.c (rintx_f64_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/rintz_f16.c (rintz_f16_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/rintz_f32.c (rintz_f32_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/rintz_f64.c (rintz_f64_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/sqrt_f16.c (sqrt_f16_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/sqrt_f32.c (sqrt_f32_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve/acle/asm/sqrt_f64.c (sqrt_f64_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve2/acle/asm/cvtx_f32.c (cvtx_f32_f64_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve2/acle/asm/logb_f16.c (logb_f16_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve2/acle/asm/logb_f32.c (logb_f32_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve2/acle/asm/logb_f64.c (logb_f64_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve2/acle/asm/qabs_s16.c (qabs_s16_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve2/acle/asm/qabs_s32.c (qabs_s32_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve2/acle/asm/qabs_s64.c (qabs_s64_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve2/acle/asm/qabs_s8.c (qabs_s8_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve2/acle/asm/qneg_s16.c (qneg_s16_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve2/acle/asm/qneg_s32.c (qneg_s32_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve2/acle/asm/qneg_s64.c (qneg_s64_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve2/acle/asm/qneg_s8.c (qneg_s8_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve2/acle/asm/recpe_u32.c (recpe_u32_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve2/acle/asm/rsqrte_u32.c (rsqrte_u32_x_untied):
      	Ditto.
      	* gcc.target/aarch64/sve2/acle/asm/cvtlt_f32.c
      	(cvtlt_f32_f16_x_untied): Expect a MOV instruction.
      	* gcc.target/aarch64/sve2/acle/asm/cvtlt_f64.c
      	(cvtlt_f64_f32_x_untied): Likewise.
      a4d9837e
    • Ian Lance Taylor's avatar
      compiler: avoid silent truncation for string(1 << 32) · 4aff491f
      Ian Lance Taylor authored
      In the conversion of a constant integer to a string type, the value of
      the constant integer was being silently truncated from unsigned long
      to unsigned int, producing the wrong string value.  Add an explicit
      overflow check to avoid this problem.
      
      For golang/go#42790
      
      Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/272611
      4aff491f
    • Jakub Jelinek's avatar
      middle-end: __builtin_mul_overflow expansion improvements [PR95862] · 049ce9d2
      Jakub Jelinek authored
      The following patch adds some improvements for __builtin_mul_overflow
      expansion.
      One optimization is for the u1 * u2 -> sr case, as documented we normally
      do:
           u1 * u2 -> sr
              res = (S) (u1 * u2)
              ovf = res < 0 || main_ovf (true)
      where main_ovf (true) stands for jump on unsigned multiplication overflow.
      If we know that the most significant bits of both operands are clear (such
      as when they are zero extended from something smaller), we can
      emit better coe by handling it like s1 * s2 -> sr, i.e. just jump on
      overflow after signed multiplication.
      
      Another two cases are s1 * s2 -> ur or s1 * u2 -> ur, if we know the minimum
      precision needed to encode all values of both arguments summed together
      is smaller or equal to destination precision (such as when the two arguments
      are sign (or zero) extended from half precision types, we know the overflows
      happen only iff one argument is negative and the other argument is positive
      (not zero), because even if both have maximum possible values, the maximum
      is still representable (e.g. for char * char -> unsigned short
      0x7f * 0x7f = 0x3f01 and for char * unsigned char -> unsigned short
      0x7f * 0xffU = 0x7e81) and as the result is unsigned, all negative results
      do overflow, but are also representable if we consider the result signed
      - all of them have the MSB set.  So, it is more efficient to just
      do the normal multiplication in that case and compare the result considered
      as signed value against 0, if it is smaller, overflow happened.
      
      And the get_min_precision change is to improve the char to short handling,
      we have there in the IL
        _2 = (int) arg_1(D);
      promotion from C promotions from char or unsigned char arg, and the caller
      adds a NOP_EXPR cast to short or unsigned short.  get_min_precision punts
      on the narrowing cast though, it handled only widening casts, but we can
      handle narrowing casts fine too, by recursing on the narrowing cast operands
      and using it only if it has in the end smaller minimal precision, which
      would duplicate the sign bits (or zero bits) to both the bits above the
      narrowing conversion and also at least one below that.
      
      2020-10-25  Jakub Jelinek  <jakub@redhat.com>
      
      	PR rtl-optimization/95862
      	* internal-fn.c (get_min_precision): For narrowing conversion, recurse
      	on the operand and if the operand precision is smaller than the
      	current one, return that smaller precision.
      	(expand_mul_overflow): For s1 * u2 -> ur and s1 * s2 -> ur cases
      	if the sum of minimum precisions of both operands is smaller or equal
      	to the result precision, just perform normal multiplication and
      	set overflow to the sign bit of the multiplication result.  For
      	u1 * u2 -> sr if both arguments have the MSB known zero, use
      	normal s1 * s2 -> sr expansion.
      
      	* gcc.dg/builtin-artih-overflow-5.c: New test.
      049ce9d2
    • Jan Hubicka's avatar
      Free more of CFG · 45281f12
      Jan Hubicka authored
      	* cfg.c (free_block): New function.
      	(clear_edges): Rename to ....
      	(free_cfg): ... this one; also free BBs and vectors.
      	(expunge_block): Update comment.
      	* cfg.h (clear_edges): Rename to ...
      	(free_cfg): ... this one.
      	* cgraph.c (release_function_body): Use free_cfg.
      45281f12
    • Richard Biener's avatar
      middle-end/97579 - lower VECTOR_BOOLEAN_TYPE_P VEC_COND_EXPRs · fddc7f00
      Richard Biener authored
      This makes sure to lower VECTOR_BOOLEAN_TYPE_P typed non-vector
      mode VEC_COND_EXPRs so we don't try to use vcond to expand those.
      That's required for x86 and gcn integer mode boolean vectors.
      
      2020-11-25  Richard Biener  <rguenther@suse.de>
      
      	PR middle-end/97579
      	* gimple-isel.cc (gimple_expand_vec_cond_expr): Lower
      	VECTOR_BOOLEAN_TYPE_P, non-vector mode VEC_COND_EXPRs.
      
      	* gcc.dg/pr97579.c: New testcase.
      fddc7f00
    • Andrew Stubbs's avatar
      Fix atomic_capture-1.f90 testcase · 52ce50d6
      Andrew Stubbs authored
      The testcase had invalid assumptions about which loop iterations would run
      first and last.
      
      libgomp/ChangeLog
      
      	* testsuite/libgomp.oacc-fortran/atomic_capture-1.f90 (main): Adjust
      	expected results.
      52ce50d6
    • Ed Schonberg's avatar
      [Ada] Further optimization with uninitialized aggregates · a46fa651
      Ed Schonberg authored
      gcc/ada/
      
      	* freeze.adb (Is_Uninitialized_Aggregate): Move...
      	* exp_util.adb (Is_Uninitialized_Aggregate): ... here.
      	(Expand_Subtype_From_Expr): If the expression is an
      	uninitialized aggregate, capture subtype for declared object and
      	remove expression to suppress further superfluous expansion.
      a46fa651
    • Ed Schonberg's avatar
      [Ada] Spurious error on instance with predicated actual · 55fae09d
      Ed Schonberg authored
      gcc/ada/
      
      	* sem_eval.adb (Subtypes_Statically_Compatible): Scalar types
      	with compatible static bounds are statically compatible if
      	predicates are compatible, even if they are not static subtypes.
      	Same for private types without discriminants.
      55fae09d
    • Eric Botcazou's avatar
      [Ada] Fix couple of minor issues with local exception propagation · 57966b4d
      Eric Botcazou authored
      gcc/ada/
      
      	* exp_ch11.adb (Expand_N_Raise_Statement): Use Is_Entity_Name
      	consistently in tests on the name of the statement.
      	* exp_prag.adb (Expand_Pragma_Check): In the local propagation
      	case, wrap the raise statement in a block statement.
      57966b4d
    • Piotr Trojanek's avatar
      [Ada] Remove shadowing by a nested subprogram parameter · 7a173848
      Piotr Trojanek authored
      gcc/ada/
      
      	* exp_ch8.adb (Expand_N_Exception_Renaming_Declaration): Move
      	"Nam" constant after the body of a nested subprogram; change "T"
      	from variable to constant.
      7a173848
    • Piotr Trojanek's avatar
      [Ada] Merge duplicated processing for gnatmake -u and -U switches · ea89e1c3
      Piotr Trojanek authored
      gcc/ada/
      
      	* make.adb (Scan_Make_Arg): Merge ELSIF branches for -u and -U.
      ea89e1c3
    • Piotr Trojanek's avatar
      [Ada] Document attribute Has_Tagged_Values in GNAT RM · 47c2b77f
      Piotr Trojanek authored
      gcc/ada/
      
      	* doc/gnat_rm/implementation_defined_attributes.rst
      	(Has_Tagged_Values): Document based on the existing description
      	of Has_Access_Type and the comment for Has_Tagged_Component,
      	which is where frontend evaluates this attribute.
      	* gnat_rm.texi: Regenerate.
      	* sem_attr.adb (Analyze_Attribute): Merge processing of
      	Has_Access_Type and Has_Tagged_Component attributes.
      	* sem_util.adb (Has_Access_Type): Fix casing in comment.
      	* sem_util.ads (Has_Tagged_Component): Remove wrong (or
      	outdated) comment about the use of this routine to implement the
      	equality operator.
      47c2b77f
    • Piotr Trojanek's avatar
      [Ada] Minor whitespace fix in expansion of attribute Size · 14a16e30
      Piotr Trojanek authored
      gcc/ada/
      
      	* exp_attr.adb (Expand_Size_Attribute): Remove whitespace;
      	simplify with a membership test, which are now allowed in the
      	frontend code.
      14a16e30
    • Piotr Trojanek's avatar
      [Ada] Use hardcoded names when converting aspects to pragmas · 52b9a264
      Piotr Trojanek authored
      gcc/ada/
      
      	* sem_ch13.adb (Analyze_One_Aspect): Fix inconsistent calls to
      	Make_Aitem_Pragma.
      52b9a264
    • Piotr Trojanek's avatar
      [Ada] Reuse Is_Named_Number where possible · 6d97121d
      Piotr Trojanek authored
      gcc/ada/
      
      	* sem_ch13.adb (Check_Expr_Constants): Simplify with
      	Is_Named_Number.
      	* sem_prag.adb (Process_Convention): Likewise.
      6d97121d
    • Piotr Trojanek's avatar
      [Ada] Simplify aspect processing with membership tests · 28488f5f
      Piotr Trojanek authored
      gcc/ada/
      
      	* sem_ch13.adb (Analyze_One_Aspect): Detect aspect identifiers
      	with membership tests.
      	(Check_Aspect_At_End_Of_Declarations): Likewise.
      	(Freeze_Entity_Checks): Likewise; a local constant is no longer
      	needed.
      	(Is_Operational_Item): Similar simplification for attribute
      	identifiers.
      	(Is_Type_Related_Rep_Item): Likewise.
      	(Resolve_Iterable_Operation): Detect names with a membership
      	test.
      	(Validate_Independence): Replace repeated Ekind with a
      	membership test.
      28488f5f
    • Piotr Trojanek's avatar
      [Ada] Fix copy-paste mistake in diagnostics for aspect Effective_Writes · a79039c0
      Piotr Trojanek authored
      gcc/ada/
      
      	* sem_ch13.adb (Analyze_One_Aspect): Replace duplicate of
      	Effective_Reads.
      a79039c0
    • Piotr Trojanek's avatar
      [Ada] Simplify Ekind tests with wrappers and membership tests · ad26cae1
      Piotr Trojanek authored
      gcc/ada/
      
      	* einfo.adb: Use composite wrappers (e.g.
      	Is_Subprogram_Or_Entry) and membership tests where it appears to
      	improve clarity.
      ad26cae1
    • Piotr Trojanek's avatar
      [Ada] Simplify Is_Standard_xxx_Type routines with membership tests · 49c4dd7a
      Piotr Trojanek authored
      gcc/ada/
      
      	* einfo.adb (Is_Standard_Character_Type,
      	Is_Standard_String_Type): Simplify.
      	(Last_Formal): Use procedural variant of Next_Formal.
      49c4dd7a
    • Piotr Trojanek's avatar
      [Ada] Consistently use explicit Entity_Id type instead of alias · a24033ec
      Piotr Trojanek authored
      gcc/ada/
      
      	* einfo.adb: Replace "E" with Entity_Id in local object
      	declarations.
      a24033ec
    • Steve Baird's avatar
      [Ada] Don't constant-fold renamed qualified expressions · eb0d08ad
      Steve Baird authored
      gcc/ada/
      
      	* exp_ch2.adb (Expand_Entity_Reference): A new local predicate
      	Is_Object_Renaming_Name indicates whether a given expression
      	occurs (after looking through qualified expressions and type
      	conversions) as the name of an object renaming declaration. If
      	Current_Value is available but this new predicate is True, then
      	ignore the availability of Current_Value.
      eb0d08ad
    • Piotr Trojanek's avatar
      [Ada] Remove dead and duplicated diagnostics for generic access types · 2d80df42
      Piotr Trojanek authored
      gcc/ada/
      
      	* sem_ch12.adb (Instantiate_Type): Remove extra whitespace.
      	(Validate_Access_Type_Instance): Remove dead (and duplicated)
      	code.
      2d80df42
    • Gary Dismukes's avatar
      [Ada] Remove hyphens in two cases of "side-effect" used as a noun · 595c9aeb
      Gary Dismukes authored
      gcc/ada/
      
      	* exp_util.adb (Possible_Side_Effect_In_SPARK): Replace hyphen
      	with a space in "side-effect" (two instances).
      595c9aeb
    • Justin Squirek's avatar
      [Ada] Crash on right shift operator for signed integers · e480bca2
      Justin Squirek authored
      gcc/ada/
      
      	* doc/gnat_rm/intrinsic_subprograms.rst (Shifts and Rotates):
      	Document behavior on negative numbers
      	* gnat_rm.texi: Regenerate.
      	* sem_eval.adb (Fold_Shift): Set modulus to be based on the RM
      	size for non-modular integer types.
      e480bca2
    • Olivier Hainque's avatar
      [Ada] Reinstate utime based code for vx6 in __gnat_copy_attribs · 4d617c3f
      Olivier Hainque authored
      gcc/ada/
      
      	* adaint.c (__gnat_copy_attribs): Reinstate code based on utime
      	for timestamp processing on VxWorks 6.
      4d617c3f
    • Yannick Moy's avatar
      [Ada] Minimize side-effect removal in GNATprove mode · a6fecb06
      Yannick Moy authored
      gcc/ada/
      
      	* exp_util.adb (Remove_Side_Effects): Only remove side-effects
      	in GNATprove mode when this is useful.
      	* sem_res.adb (Set_Slice_Subtype): Make sure in GNATprove mode
      	to define the Itype when needed, so that run-time errors can be
      	analyzed.
      	* sem_util.adb (Enclosing_Declaration): Correctly take into
      	account renaming declarations.
      a6fecb06
    • Eric Botcazou's avatar
      [Ada] Adjust support for 128-bit integer types in System.Random_Numbers · 9d41d78b
      Eric Botcazou authored
      gcc/ada/
      
      	* libgnat/s-rannum.adb (Random_Discrete): Specifically deal with
      	the case where the size of the base type is larger than 64 bits.
      9d41d78b
    • Yannick Moy's avatar
      [Ada] Fix internal compilation error on circular type in SPARK code · a8c229e1
      Yannick Moy authored
      gcc/ada/
      
      	* sem_ch3.adb (Access_Type_Declaration): Set Etype before
      	checking for volatility compatibility.
      a8c229e1
    • Eric Botcazou's avatar
      [Ada] Add support for 128-bit integer types to GNAT.Random_Numbers · 6d88dbdc
      Eric Botcazou authored
      gcc/ada/
      
      	* libgnat/g-rannum.ads (Random): New functions returning 128-bit.
      	* libgnat/g-rannum.adb (Random): Implement them and alphabetize.
      	(To_Signed): New unchecked conversion function for 128-bit.
      6d88dbdc
    • Arnaud Charlet's avatar
      [Ada] Allow debugging finalization-related expanded code · bbf14e13
      Arnaud Charlet authored
      gcc/ada/
      
      	* exp_ch7.adb (Build_Finalization_Master, Build_Finalizer,
      	Build_Object_Declarations, Make_Deep_Array_Body,
      	Wrap_Transient_Expression): Call Set_Debug_Info_Needed on
      	temporaries when Debug_Generated_Code is True.
      bbf14e13
    • Liaiss Merzougue's avatar
      [Ada] Unrecursify Set_Digit/Set_Image_Unsigned procedure · cf4737dc
      Liaiss Merzougue authored
      gcc/ada/
      
      	* libgnat/s-imagei.adb
      	(Set_Digits): Rewrite the procedure to remove recursion.
      	(Image_Integer, Set_Image_Integer): Update assertions and remove
      	redundant ones.
      	* libgnat/s-imageu.adb
      	(Set_Image_Unsigned): Rewrite the procedure to remove recursion.
      cf4737dc
    • Piotr Trojanek's avatar
      [Ada] Remove repeated calls to Attribute_Name · 6b0c5c72
      Piotr Trojanek authored
      gcc/ada/
      
      	* exp_util.adb (Attribute_Constrained_Static_Value): Fix body
      	box.
      	* sem_attr.adb (Eval_Attribute): Replace repeated calls to
      	Attribute_Name with a captured value of the Attribute_Id; also,
      	remove extra parens around Is_Generic_Type.
      6b0c5c72
    • Ghjuvan Lacambre's avatar
      [Ada] Fix crash on invalid `pragma Profile` · 193040a0
      Ghjuvan Lacambre authored
      gcc/ada/
      
      	* sem_prag.adb (Analyze_Pragma): Emit error on wrong argument
      	nkind.
      193040a0
    • Piotr Trojanek's avatar
      [Ada] Reuse Is_Named_Number where possible · 868268a8
      Piotr Trojanek authored
      gcc/ada/
      
      	* sem_attr.adb, sem_prag.adb: Use Is_Named_Number.
      868268a8
Loading