9.0.1-0.3
This commit is contained in:
parent
2a22f8c83a
commit
3694befabb
1
.gitignore
vendored
1
.gitignore
vendored
@ -57,3 +57,4 @@
|
||||
/gcc-8.2.1-20181105.tar.xz
|
||||
/gcc-8.2.1-20181215.tar.xz
|
||||
/gcc-8.2.1-20190109.tar.xz
|
||||
/gcc-9.0.0-20190119.tar.xz
|
||||
|
@ -1,17 +0,0 @@
|
||||
2018-04-24 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* config/i386/i386.opt (mcet): Remporarily re-add as alias to -mshstk.
|
||||
|
||||
--- gcc/config/i386/i386.opt (revision 259613)
|
||||
+++ gcc/config/i386/i386.opt (revision 259612)
|
||||
@@ -1006,6 +1006,10 @@ mgeneral-regs-only
|
||||
Target Report RejectNegative Mask(GENERAL_REGS_ONLY) Var(ix86_target_flags) Save
|
||||
Generate code which uses only the general registers.
|
||||
|
||||
+mcet
|
||||
+Target Undocumented Alias(mshstk)
|
||||
+;; Deprecated
|
||||
+
|
||||
mshstk
|
||||
Target Report Mask(ISA_SHSTK) Var(ix86_isa_flags) Save
|
||||
Enable shadow stack built-in functions from Control-flow Enforcement
|
@ -1,445 +0,0 @@
|
||||
--- gcc/config/aarch64/aarch64.c
|
||||
+++ gcc/config/aarch64/aarch64.c
|
||||
@@ -3799,7 +3799,14 @@ aarch64_output_probe_stack_range (rtx reg1, rtx reg2)
|
||||
output_asm_insn ("sub\t%0, %0, %1", xops);
|
||||
|
||||
/* Probe at TEST_ADDR. */
|
||||
- output_asm_insn ("str\txzr, [%0]", xops);
|
||||
+ if (flag_stack_clash_protection)
|
||||
+ {
|
||||
+ gcc_assert (xops[0] == stack_pointer_rtx);
|
||||
+ xops[1] = GEN_INT (PROBE_INTERVAL - 8);
|
||||
+ output_asm_insn ("str\txzr, [%0, %1]", xops);
|
||||
+ }
|
||||
+ else
|
||||
+ output_asm_insn ("str\txzr, [%0]", xops);
|
||||
|
||||
/* Test if TEST_ADDR == LAST_ADDR. */
|
||||
xops[1] = reg2;
|
||||
@@ -4589,6 +4596,133 @@ aarch64_set_handled_components (sbitmap components)
|
||||
cfun->machine->reg_is_wrapped_separately[regno] = true;
|
||||
}
|
||||
|
||||
+/* Allocate POLY_SIZE bytes of stack space using TEMP1 and TEMP2 as scratch
|
||||
+ registers. */
|
||||
+
|
||||
+static void
|
||||
+aarch64_allocate_and_probe_stack_space (rtx temp1, rtx temp2,
|
||||
+ poly_int64 poly_size)
|
||||
+{
|
||||
+ HOST_WIDE_INT size;
|
||||
+ if (!poly_size.is_constant (&size))
|
||||
+ {
|
||||
+ sorry ("stack probes for SVE frames");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ HOST_WIDE_INT probe_interval
|
||||
+ = 1 << PARAM_VALUE (PARAM_STACK_CLASH_PROTECTION_PROBE_INTERVAL);
|
||||
+ HOST_WIDE_INT guard_size
|
||||
+ = 1 << PARAM_VALUE (PARAM_STACK_CLASH_PROTECTION_GUARD_SIZE);
|
||||
+ HOST_WIDE_INT guard_used_by_caller = 1024;
|
||||
+
|
||||
+ /* SIZE should be large enough to require probing here. ie, it
|
||||
+ must be larger than GUARD_SIZE - GUARD_USED_BY_CALLER.
|
||||
+
|
||||
+ We can allocate GUARD_SIZE - GUARD_USED_BY_CALLER as a single chunk
|
||||
+ without any probing. */
|
||||
+ gcc_assert (size >= guard_size - guard_used_by_caller);
|
||||
+ aarch64_sub_sp (temp1, temp2, guard_size - guard_used_by_caller, true);
|
||||
+ HOST_WIDE_INT orig_size = size;
|
||||
+ size -= (guard_size - guard_used_by_caller);
|
||||
+
|
||||
+ HOST_WIDE_INT rounded_size = size & -probe_interval;
|
||||
+ HOST_WIDE_INT residual = size - rounded_size;
|
||||
+
|
||||
+ /* We can handle a small number of allocations/probes inline. Otherwise
|
||||
+ punt to a loop. */
|
||||
+ if (rounded_size && rounded_size <= 4 * probe_interval)
|
||||
+ {
|
||||
+ /* We don't use aarch64_sub_sp here because we don't want to
|
||||
+ repeatedly load TEMP1. */
|
||||
+ rtx step = GEN_INT (-probe_interval);
|
||||
+ if (probe_interval > ARITH_FACTOR)
|
||||
+ {
|
||||
+ emit_move_insn (temp1, step);
|
||||
+ step = temp1;
|
||||
+ }
|
||||
+
|
||||
+ for (HOST_WIDE_INT i = 0; i < rounded_size; i += probe_interval)
|
||||
+ {
|
||||
+ rtx_insn *insn = emit_insn (gen_add2_insn (stack_pointer_rtx, step));
|
||||
+ add_reg_note (insn, REG_STACK_CHECK, const0_rtx);
|
||||
+
|
||||
+ if (probe_interval > ARITH_FACTOR)
|
||||
+ {
|
||||
+ RTX_FRAME_RELATED_P (insn) = 1;
|
||||
+ rtx adj = plus_constant (Pmode, stack_pointer_rtx, -probe_interval);
|
||||
+ add_reg_note (insn, REG_CFA_ADJUST_CFA,
|
||||
+ gen_rtx_SET (stack_pointer_rtx, adj));
|
||||
+ }
|
||||
+
|
||||
+ emit_stack_probe (plus_constant (Pmode, stack_pointer_rtx,
|
||||
+ (probe_interval
|
||||
+ - GET_MODE_SIZE (word_mode))));
|
||||
+ emit_insn (gen_blockage ());
|
||||
+ }
|
||||
+ dump_stack_clash_frame_info (PROBE_INLINE, size != rounded_size);
|
||||
+ }
|
||||
+ else if (rounded_size)
|
||||
+ {
|
||||
+ /* Compute the ending address. */
|
||||
+ unsigned int scratchreg = REGNO (temp1);
|
||||
+ emit_move_insn (temp1, GEN_INT (-rounded_size));
|
||||
+ rtx_insn *insn
|
||||
+ = emit_insn (gen_add3_insn (temp1, stack_pointer_rtx, temp1));
|
||||
+
|
||||
+ /* For the initial allocation, we don't have a frame pointer
|
||||
+ set up, so we always need CFI notes. If we're doing the
|
||||
+ final allocation, then we may have a frame pointer, in which
|
||||
+ case it is the CFA, otherwise we need CFI notes.
|
||||
+
|
||||
+ We can determine which allocation we are doing by looking at
|
||||
+ the temporary register. IP0 is the initial allocation, IP1
|
||||
+ is the final allocation. */
|
||||
+ if (scratchreg == IP0_REGNUM || !frame_pointer_needed)
|
||||
+ {
|
||||
+ /* We want the CFA independent of the stack pointer for the
|
||||
+ duration of the loop. */
|
||||
+ add_reg_note (insn, REG_CFA_DEF_CFA,
|
||||
+ plus_constant (Pmode, temp1,
|
||||
+ (rounded_size + (orig_size - size))));
|
||||
+ RTX_FRAME_RELATED_P (insn) = 1;
|
||||
+ }
|
||||
+
|
||||
+ /* This allocates and probes the stack.
|
||||
+
|
||||
+ It also probes at a 4k interval regardless of the value of
|
||||
+ PARAM_STACK_CLASH_PROTECTION_PROBE_INTERVAL. */
|
||||
+ insn = emit_insn (gen_probe_stack_range (stack_pointer_rtx,
|
||||
+ stack_pointer_rtx, temp1));
|
||||
+
|
||||
+ /* Now reset the CFA register if needed. */
|
||||
+ if (scratchreg == IP0_REGNUM || !frame_pointer_needed)
|
||||
+ {
|
||||
+ add_reg_note (insn, REG_CFA_DEF_CFA,
|
||||
+ plus_constant (Pmode, stack_pointer_rtx,
|
||||
+ (rounded_size + (orig_size - size))));
|
||||
+ RTX_FRAME_RELATED_P (insn) = 1;
|
||||
+ }
|
||||
+
|
||||
+ emit_insn (gen_blockage ());
|
||||
+ dump_stack_clash_frame_info (PROBE_LOOP, size != rounded_size);
|
||||
+ }
|
||||
+ else
|
||||
+ dump_stack_clash_frame_info (PROBE_INLINE, size != rounded_size);
|
||||
+
|
||||
+ /* Handle any residuals.
|
||||
+ Note that any residual must be probed. */
|
||||
+ if (residual)
|
||||
+ {
|
||||
+ aarch64_sub_sp (temp1, temp2, residual, true);
|
||||
+ add_reg_note (get_last_insn (), REG_STACK_CHECK, const0_rtx);
|
||||
+ emit_stack_probe (plus_constant (Pmode, stack_pointer_rtx,
|
||||
+ (residual - GET_MODE_SIZE (word_mode))));
|
||||
+ emit_insn (gen_blockage ());
|
||||
+ }
|
||||
+ return;
|
||||
+}
|
||||
+
|
||||
/* Add a REG_CFA_EXPRESSION note to INSN to say that register REG
|
||||
is saved at BASE + OFFSET. */
|
||||
|
||||
@@ -4686,7 +4820,54 @@ aarch64_expand_prologue (void)
|
||||
rtx ip0_rtx = gen_rtx_REG (Pmode, IP0_REGNUM);
|
||||
rtx ip1_rtx = gen_rtx_REG (Pmode, IP1_REGNUM);
|
||||
|
||||
- aarch64_sub_sp (ip0_rtx, ip1_rtx, initial_adjust, true);
|
||||
+ /* We do not fully protect aarch64 against stack clash style attacks
|
||||
+ as doing so would be prohibitively expensive with less utility over
|
||||
+ time as newer compilers are deployed.
|
||||
+
|
||||
+ We assume the guard is at least 64k. Furthermore, we assume that
|
||||
+ the caller has not pushed the stack pointer more than 1k into
|
||||
+ the guard. A caller that pushes the stack pointer than 1k into
|
||||
+ the guard is considered invalid.
|
||||
+
|
||||
+ Note that the caller's ability to push the stack pointer into the
|
||||
+ guard is a function of the number and size of outgoing arguments and/or
|
||||
+ dynamic stack allocations due to the mandatory save of the link register
|
||||
+ in the caller's frame.
|
||||
+
|
||||
+ With those assumptions the callee can allocate up to 63k of stack
|
||||
+ space without probing.
|
||||
+
|
||||
+ When probing is needed, we emit a probe at the start of the prologue
|
||||
+ and every PARAM_STACK_CLASH_PROTECTION_PROBE_INTERVAL bytes thereafter.
|
||||
+
|
||||
+ We have to track how much space has been allocated, but we do not
|
||||
+ track stores into the stack as implicit probes except for the
|
||||
+ fp/lr store. */
|
||||
+ HOST_WIDE_INT guard_size
|
||||
+ = 1 << PARAM_VALUE (PARAM_STACK_CLASH_PROTECTION_GUARD_SIZE);
|
||||
+ HOST_WIDE_INT guard_used_by_caller = 1024;
|
||||
+ if (flag_stack_clash_protection)
|
||||
+ {
|
||||
+ if (known_eq (frame_size, 0))
|
||||
+ dump_stack_clash_frame_info (NO_PROBE_NO_FRAME, false);
|
||||
+ else if (known_lt (initial_adjust, guard_size - guard_used_by_caller)
|
||||
+ && known_lt (final_adjust, guard_size - guard_used_by_caller))
|
||||
+ dump_stack_clash_frame_info (NO_PROBE_SMALL_FRAME, true);
|
||||
+ }
|
||||
+
|
||||
+ /* In theory we should never have both an initial adjustment
|
||||
+ and a callee save adjustment. Verify that is the case since the
|
||||
+ code below does not handle it for -fstack-clash-protection. */
|
||||
+ gcc_assert (known_eq (initial_adjust, 0) || callee_adjust == 0);
|
||||
+
|
||||
+ /* Only probe if the initial adjustment is larger than the guard
|
||||
+ less the amount of the guard reserved for use by the caller's
|
||||
+ outgoing args. */
|
||||
+ if (flag_stack_clash_protection
|
||||
+ && maybe_ge (initial_adjust, guard_size - guard_used_by_caller))
|
||||
+ aarch64_allocate_and_probe_stack_space (ip0_rtx, ip1_rtx, initial_adjust);
|
||||
+ else
|
||||
+ aarch64_sub_sp (ip0_rtx, ip1_rtx, initial_adjust, true);
|
||||
|
||||
if (callee_adjust != 0)
|
||||
aarch64_push_regs (reg1, reg2, callee_adjust);
|
||||
@@ -4742,7 +4923,31 @@ aarch64_expand_prologue (void)
|
||||
callee_adjust != 0 || emit_frame_chain);
|
||||
aarch64_save_callee_saves (DFmode, callee_offset, V0_REGNUM, V31_REGNUM,
|
||||
callee_adjust != 0 || emit_frame_chain);
|
||||
- aarch64_sub_sp (ip1_rtx, ip0_rtx, final_adjust, !frame_pointer_needed);
|
||||
+
|
||||
+ /* We may need to probe the final adjustment as well. */
|
||||
+ if (flag_stack_clash_protection && maybe_ne (final_adjust, 0))
|
||||
+ {
|
||||
+ /* First probe if the final adjustment is larger than the guard size
|
||||
+ less the amount of the guard reserved for use by the caller's
|
||||
+ outgoing args. */
|
||||
+ if (maybe_ge (final_adjust, guard_size - guard_used_by_caller))
|
||||
+ aarch64_allocate_and_probe_stack_space (ip1_rtx, ip0_rtx,
|
||||
+ final_adjust);
|
||||
+ else
|
||||
+ aarch64_sub_sp (ip1_rtx, ip0_rtx, final_adjust, !frame_pointer_needed);
|
||||
+
|
||||
+ /* We must also probe if the final adjustment is larger than the guard
|
||||
+ that is assumed used by the caller. This may be sub-optimal. */
|
||||
+ if (maybe_ge (final_adjust, guard_used_by_caller))
|
||||
+ {
|
||||
+ if (dump_file)
|
||||
+ fprintf (dump_file,
|
||||
+ "Stack clash aarch64 large outgoing arg, probing\n");
|
||||
+ emit_stack_probe (stack_pointer_rtx);
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ aarch64_sub_sp (ip1_rtx, ip0_rtx, final_adjust, !frame_pointer_needed);
|
||||
}
|
||||
|
||||
/* Return TRUE if we can use a simple_return insn.
|
||||
@@ -10476,6 +10681,12 @@ aarch64_override_options_internal (struct gcc_options *opts)
|
||||
&& opts->x_optimize >= aarch64_tune_params.prefetch->default_opt_level)
|
||||
opts->x_flag_prefetch_loop_arrays = 1;
|
||||
|
||||
+ /* We assume the guard page is 64k. */
|
||||
+ maybe_set_param_value (PARAM_STACK_CLASH_PROTECTION_GUARD_SIZE,
|
||||
+ 16,
|
||||
+ opts->x_param_values,
|
||||
+ global_options_set.x_param_values);
|
||||
+
|
||||
aarch64_override_options_after_change_1 (opts);
|
||||
}
|
||||
|
||||
@@ -17161,6 +17372,28 @@ aarch64_sched_can_speculate_insn (rtx_insn *insn)
|
||||
}
|
||||
}
|
||||
|
||||
+/* It has been decided that to allow up to 1kb of outgoing argument
|
||||
+ space to be allocated w/o probing. If more than 1kb of outgoing
|
||||
+ argment space is allocated, then it must be probed and the last
|
||||
+ probe must occur no more than 1kbyte away from the end of the
|
||||
+ allocated space.
|
||||
+
|
||||
+ This implies that the residual part of an alloca allocation may
|
||||
+ need probing in cases where the generic code might not otherwise
|
||||
+ think a probe is needed.
|
||||
+
|
||||
+ This target hook returns TRUE when allocating RESIDUAL bytes of
|
||||
+ alloca space requires an additional probe, otherwise FALSE is
|
||||
+ returned. */
|
||||
+
|
||||
+static bool
|
||||
+aarch64_stack_clash_protection_final_dynamic_probe (rtx residual)
|
||||
+{
|
||||
+ return (residual == CONST0_RTX (Pmode)
|
||||
+ || GET_CODE (residual) != CONST_INT
|
||||
+ || INTVAL (residual) >= 1024);
|
||||
+}
|
||||
+
|
||||
/* Implement TARGET_COMPUTE_PRESSURE_CLASSES. */
|
||||
|
||||
static int
|
||||
@@ -17669,6 +17902,10 @@ aarch64_libgcc_floating_mode_supported_p
|
||||
#undef TARGET_CONSTANT_ALIGNMENT
|
||||
#define TARGET_CONSTANT_ALIGNMENT aarch64_constant_alignment
|
||||
|
||||
+#undef TARGET_STACK_CLASH_PROTECTION_FINAL_DYNAMIC_PROBE
|
||||
+#define TARGET_STACK_CLASH_PROTECTION_FINAL_DYNAMIC_PROBE \
|
||||
+ aarch64_stack_clash_protection_final_dynamic_probe
|
||||
+
|
||||
#undef TARGET_COMPUTE_PRESSURE_CLASSES
|
||||
#define TARGET_COMPUTE_PRESSURE_CLASSES aarch64_compute_pressure_classes
|
||||
|
||||
--- gcc/config/aarch64/aarch64.md
|
||||
+++ gcc/config/aarch64/aarch64.md
|
||||
@@ -5812,7 +5812,7 @@
|
||||
)
|
||||
|
||||
(define_insn "probe_stack_range"
|
||||
- [(set (match_operand:DI 0 "register_operand" "=r")
|
||||
+ [(set (match_operand:DI 0 "register_operand" "=rk")
|
||||
(unspec_volatile:DI [(match_operand:DI 1 "register_operand" "0")
|
||||
(match_operand:DI 2 "register_operand" "r")]
|
||||
UNSPECV_PROBE_STACK_RANGE))]
|
||||
--- gcc/testsuite/gcc.target/aarch64/stack-check-12.c
|
||||
+++ gcc/testsuite/gcc.target/aarch64/stack-check-12.c
|
||||
@@ -0,0 +1,20 @@
|
||||
+/* { dg-do compile } */
|
||||
+/* { dg-options "-O2 -fstack-clash-protection --param stack-clash-protection-guard-size=12" } */
|
||||
+/* { dg-require-effective-target supports_stack_clash_protection } */
|
||||
+
|
||||
+extern void arf (unsigned long int *, unsigned long int *);
|
||||
+void
|
||||
+frob ()
|
||||
+{
|
||||
+ unsigned long int num[1000];
|
||||
+ unsigned long int den[1000];
|
||||
+ arf (den, num);
|
||||
+}
|
||||
+
|
||||
+/* This verifies that the scheduler did not break the dependencies
|
||||
+ by adjusting the offsets within the probe and that the scheduler
|
||||
+ did not reorder around the stack probes. */
|
||||
+/* { dg-final { scan-assembler-times "sub\\tsp, sp, #4096\\n\\tstr\\txzr, .sp, 4088." 3 } } */
|
||||
+
|
||||
+
|
||||
+
|
||||
--- gcc/testsuite/gcc.target/aarch64/stack-check-13.c
|
||||
+++ gcc/testsuite/gcc.target/aarch64/stack-check-13.c
|
||||
@@ -0,0 +1,28 @@
|
||||
+/* { dg-do compile } */
|
||||
+/* { dg-options "-O2 -fstack-clash-protection --param stack-clash-protection-guard-size=12" } */
|
||||
+/* { dg-require-effective-target supports_stack_clash_protection } */
|
||||
+
|
||||
+#define ARG32(X) X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X
|
||||
+#define ARG192(X) ARG32(X),ARG32(X),ARG32(X),ARG32(X),ARG32(X),ARG32(X)
|
||||
+void out1(ARG192(__int128));
|
||||
+int t1(int);
|
||||
+
|
||||
+int t3(int x)
|
||||
+{
|
||||
+ if (x < 1000)
|
||||
+ return t1 (x) + 1;
|
||||
+
|
||||
+ out1 (ARG192(1));
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+
|
||||
+/* This test creates a large (> 1k) outgoing argument area that needs
|
||||
+ to be probed. We don't test the exact size of the space or the
|
||||
+ exact offset to make the test a little less sensitive to trivial
|
||||
+ output changes. */
|
||||
+/* { dg-final { scan-assembler-times "sub\\tsp, sp, #....\\n\\tstr\\txzr, \\\[sp" 1 } } */
|
||||
+
|
||||
+
|
||||
+
|
||||
--- gcc/testsuite/gcc.target/aarch64/stack-check-14.c
|
||||
+++ gcc/testsuite/gcc.target/aarch64/stack-check-14.c
|
||||
@@ -0,0 +1,25 @@
|
||||
+/* { dg-do compile } */
|
||||
+/* { dg-options "-O2 -fstack-clash-protection --param stack-clash-protection-guard-size=12" } */
|
||||
+/* { dg-require-effective-target supports_stack_clash_protection } */
|
||||
+
|
||||
+int t1(int);
|
||||
+
|
||||
+int t2(int x)
|
||||
+{
|
||||
+ char *p = __builtin_alloca (4050);
|
||||
+ x = t1 (x);
|
||||
+ return p[x];
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/* This test has a constant sized alloca that is smaller than the
|
||||
+ probe interval. But it actually requires two probes instead
|
||||
+ of one because of the optimistic assumptions we made in the
|
||||
+ aarch64 prologue code WRT probing state.
|
||||
+
|
||||
+ The form can change quite a bit so we just check for two
|
||||
+ probes without looking at the actual address. */
|
||||
+/* { dg-final { scan-assembler-times "str\\txzr," 2 } } */
|
||||
+
|
||||
+
|
||||
+
|
||||
--- gcc/testsuite/gcc.target/aarch64/stack-check-15.c
|
||||
+++ gcc/testsuite/gcc.target/aarch64/stack-check-15.c
|
||||
@@ -0,0 +1,24 @@
|
||||
+/* { dg-do compile } */
|
||||
+/* { dg-options "-O2 -fstack-clash-protection --param stack-clash-protection-guard-size=12" } */
|
||||
+/* { dg-require-effective-target supports_stack_clash_protection } */
|
||||
+
|
||||
+int t1(int);
|
||||
+
|
||||
+int t2(int x)
|
||||
+{
|
||||
+ char *p = __builtin_alloca (x);
|
||||
+ x = t1 (x);
|
||||
+ return p[x];
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/* This test has a variable sized alloca. It requires 3 probes.
|
||||
+ One in the loop, one for the residual and at the end of the
|
||||
+ alloca area.
|
||||
+
|
||||
+ The form can change quite a bit so we just check for two
|
||||
+ probes without looking at the actual address. */
|
||||
+/* { dg-final { scan-assembler-times "str\\txzr," 3 } } */
|
||||
+
|
||||
+
|
||||
+
|
||||
--- gcc/testsuite/lib/target-supports.exp
|
||||
+++ gcc/testsuite/lib/target-supports.exp
|
||||
@@ -9201,14 +9201,9 @@ proc check_effective_target_autoincdec { } {
|
||||
#
|
||||
proc check_effective_target_supports_stack_clash_protection { } {
|
||||
|
||||
- # Temporary until the target bits are fully ACK'd.
|
||||
-# if { [istarget aarch*-*-*] } {
|
||||
-# return 1
|
||||
-# }
|
||||
-
|
||||
if { [istarget x86_64-*-*] || [istarget i?86-*-*]
|
||||
|| [istarget powerpc*-*-*] || [istarget rs6000*-*-*]
|
||||
- || [istarget s390*-*-*] } {
|
||||
+ || [istarget aarch64*-**] || [istarget s390*-*-*] } {
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
@@ -9217,9 +9212,9 @@ proc check_effective_target_supports_stack_clash_protection { } {
|
||||
# Return 1 if the target creates a frame pointer for non-leaf functions
|
||||
# Note we ignore cases where we apply tail call optimization here.
|
||||
proc check_effective_target_frame_pointer_for_non_leaf { } {
|
||||
- if { [istarget aarch*-*-*] } {
|
||||
- return 1
|
||||
- }
|
||||
+# if { [istarget aarch*-*-*] } {
|
||||
+# return 1
|
||||
+# }
|
||||
|
||||
# Solaris/x86 defaults to -fno-omit-frame-pointer.
|
||||
if { [istarget i?86-*-solaris*] || [istarget x86_64-*-solaris*] } {
|
20
gcc9-d-shared-libphobos.patch
Normal file
20
gcc9-d-shared-libphobos.patch
Normal file
@ -0,0 +1,20 @@
|
||||
2019-01-17 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* d-spec.cc (lang_specific_driver): Make -shared-libphobos
|
||||
the default rather than -static-libphobos.
|
||||
|
||||
--- gcc/d/d-spec.cc.jj 2019-01-01 12:37:49.502444257 +0100
|
||||
+++ gcc/d/d-spec.cc 2019-01-17 17:09:45.364949246 +0100
|
||||
@@ -405,9 +405,9 @@ lang_specific_driver (cl_decoded_option
|
||||
/* Add `-lgphobos' if we haven't already done so. */
|
||||
if (phobos_library != PHOBOS_NOLINK && need_phobos)
|
||||
{
|
||||
- /* Default to static linking. */
|
||||
- if (phobos_library != PHOBOS_DYNAMIC)
|
||||
- phobos_library = PHOBOS_STATIC;
|
||||
+ /* Default to shared linking. */
|
||||
+ if (phobos_library != PHOBOS_STATIC)
|
||||
+ phobos_library = PHOBOS_DYNAMIC;
|
||||
|
||||
#ifdef HAVE_LD_STATIC_DYNAMIC
|
||||
if (phobos_library == PHOBOS_DYNAMIC && static_link)
|
@ -1,14 +1,15 @@
|
||||
2017-01-20 Jakub Jelinek <jakub@redhat.com>
|
||||
2019-01-17 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* gcc.c (offload_targets_default): New variable.
|
||||
(process_command): Set it if -foffload is defaulted.
|
||||
(driver::maybe_putenv_OFFLOAD_TARGETS): Add OFFLOAD_TARGET_DEFAULT=1
|
||||
into environment if -foffload has been defaulted.
|
||||
* lto-wrapper.c (OFFLOAD_TARGET_DEFAULT_ENV): Define.
|
||||
(compile_images_for_offload_targets): If OFFLOAD_TARGET_DEFAULT
|
||||
(compile_offload_image): If OFFLOAD_TARGET_DEFAULT
|
||||
is in the environment, don't fail if corresponding mkoffload
|
||||
can't be found. Free and clear offload_names if no valid offload
|
||||
is found.
|
||||
can't be found.
|
||||
(compile_images_for_offload_targets): Likewise. Free and clear
|
||||
offload_names if no valid offload is found.
|
||||
libgomp/
|
||||
* target.c (gomp_load_plugin_for_device): If a plugin can't be
|
||||
dlopened, assume it has no devices silently.
|
||||
@ -57,18 +58,28 @@ libgomp/
|
||||
|
||||
enum lto_mode_d {
|
||||
LTO_MODE_NONE, /* Not doing LTO. */
|
||||
@@ -790,8 +791,10 @@ compile_images_for_offload_targets (unsi
|
||||
if (!target_names)
|
||||
return;
|
||||
@@ -820,6 +821,12 @@ compile_offload_image (const char *targe
|
||||
break;
|
||||
}
|
||||
|
||||
+ if (!compiler && getenv (OFFLOAD_TARGET_DEFAULT_ENV))
|
||||
+ {
|
||||
+ free_array_of_ptrs ((void **) paths, n_paths);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
if (!compiler)
|
||||
fatal_error (input_location,
|
||||
"could not find %s in %s (consider using '-B')\n", suffix + 1,
|
||||
@@ -883,6 +890,7 @@ compile_images_for_offload_targets (unsi
|
||||
unsigned num_targets = parse_env_var (target_names, &names, NULL);
|
||||
+ const char *target_names_default = getenv (OFFLOAD_TARGET_DEFAULT_ENV);
|
||||
|
||||
int next_name_entry = 0;
|
||||
+ bool hsa_seen = false;
|
||||
const char *compiler_path = getenv ("COMPILER_PATH");
|
||||
if (!compiler_path)
|
||||
goto out;
|
||||
@@ -804,18 +807,32 @@ compile_images_for_offload_targets (unsi
|
||||
@@ -895,18 +903,26 @@ compile_images_for_offload_targets (unsi
|
||||
/* HSA does not use LTO-like streaming and a different compiler, skip
|
||||
it. */
|
||||
if (strcmp (names[i], "hsa") == 0)
|
||||
@ -85,13 +96,7 @@ libgomp/
|
||||
if (!offload_names[next_name_entry])
|
||||
- fatal_error (input_location,
|
||||
- "problem with building target image for %s\n", names[i]);
|
||||
+ {
|
||||
+ if (target_names_default != NULL)
|
||||
+ continue;
|
||||
+ fatal_error (input_location,
|
||||
+ "problem with building target image for %s\n",
|
||||
+ names[i]);
|
||||
+ }
|
||||
next_name_entry++;
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
--- libada/Makefile.in.jj 2009-01-14 12:07:35.000000000 +0100
|
||||
+++ libada/Makefile.in 2009-01-15 14:25:33.000000000 +0100
|
||||
@@ -66,18 +66,40 @@ libsubdir := $(libdir)/gcc/$(target_nonc
|
||||
--- libada/Makefile.in.jj 2019-01-09 13:01:18.015608205 +0100
|
||||
+++ libada/Makefile.in 2019-01-11 18:16:23.441726931 +0100
|
||||
@@ -71,18 +71,40 @@ version := $(shell @get_gcc_base_ver@ $(
|
||||
libsubdir := $(libdir)/gcc/$(target_noncanonical)/$(version)$(MULTISUBDIR)
|
||||
ADA_RTS_DIR=$(GCC_DIR)/ada/rts$(subst /,_,$(MULTISUBDIR))
|
||||
ADA_RTS_SUBDIR=./rts$(subst /,_,$(MULTISUBDIR))
|
||||
|
||||
+DEFAULTMULTIFLAGS :=
|
||||
+ifeq ($(MULTISUBDIR),)
|
||||
@ -45,17 +45,17 @@
|
||||
"PICFLAG_FOR_TARGET=$(PICFLAG)" \
|
||||
"THREAD_KIND=$(THREAD_KIND)" \
|
||||
"TRACE=$(TRACE)" \
|
||||
@@ -88,7 +110,7 @@ LIBADA_FLAGS_TO_PASS = \
|
||||
@@ -93,7 +115,7 @@ LIBADA_FLAGS_TO_PASS = \
|
||||
"exeext=.exeext.should.not.be.used " \
|
||||
'CC=the.host.compiler.should.not.be.needed' \
|
||||
"GCC_FOR_TARGET=$(CC)" \
|
||||
- "CFLAGS=$(CFLAGS)"
|
||||
+ "CFLAGS=$(CFLAGS) $(DEFAULTMULTIFLAGS)"
|
||||
|
||||
# Rules to build gnatlib.
|
||||
.PHONY: gnatlib gnatlib-plain gnatlib-sjlj gnatlib-zcx gnatlib-shared osconstool
|
||||
--- config-ml.in.jj 2010-06-30 09:50:44.000000000 +0200
|
||||
+++ config-ml.in 2010-07-02 21:24:17.994211151 +0200
|
||||
.PHONY: libada gnatlib gnatlib-shared gnatlib-sjlj gnatlib-zcx osconstool
|
||||
|
||||
--- config-ml.in.jj 2019-01-09 12:50:16.646501448 +0100
|
||||
+++ config-ml.in 2019-01-11 18:16:23.442726914 +0100
|
||||
@@ -511,6 +511,8 @@ multi-do:
|
||||
ADAFLAGS="$(ADAFLAGS) $${flags}" \
|
||||
prefix="$(prefix)" \
|
||||
@ -63,42 +63,44 @@
|
||||
+ mandir="$(mandir)" \
|
||||
+ infodir="$(infodir)" \
|
||||
GOCFLAGS="$(GOCFLAGS) $${flags}" \
|
||||
GDCFLAGS="$(GDCFLAGS) $${flags}" \
|
||||
CXXFLAGS="$(CXXFLAGS) $${flags}" \
|
||||
LIBCFLAGS="$(LIBCFLAGS) $${flags}" \
|
||||
--- libcpp/macro.c.jj 2015-01-14 11:01:34.000000000 +0100
|
||||
+++ libcpp/macro.c 2015-01-14 14:22:19.286949884 +0100
|
||||
@@ -2947,8 +2947,6 @@ create_iso_definition (cpp_reader *pfile
|
||||
cpp_token *token;
|
||||
const cpp_token *ctoken;
|
||||
--- libcpp/macro.c.jj 2019-01-09 13:01:21.420552123 +0100
|
||||
+++ libcpp/macro.c 2019-01-11 18:18:17.736876285 +0100
|
||||
@@ -3256,8 +3256,6 @@ static cpp_macro *
|
||||
create_iso_definition (cpp_reader *pfile)
|
||||
{
|
||||
bool following_paste_op = false;
|
||||
- const char *paste_op_error_msg =
|
||||
- N_("'##' cannot appear at either end of a macro expansion");
|
||||
unsigned int num_extra_tokens = 0;
|
||||
|
||||
/* Get the first token of the expansion (or the '(' of a
|
||||
@@ -3059,7 +3057,8 @@ create_iso_definition (cpp_reader *pfile
|
||||
unsigned nparms = 0;
|
||||
cpp_hashnode **params = NULL;
|
||||
@@ -3382,7 +3380,9 @@ create_iso_definition (cpp_reader *pfile
|
||||
function-like macros, but not at the end. */
|
||||
if (following_paste_op)
|
||||
{
|
||||
- cpp_error (pfile, CPP_DL_ERROR, paste_op_error_msg);
|
||||
+ cpp_error (pfile, CPP_DL_ERROR,
|
||||
+ "'##' cannot appear at either end of a macro expansion");
|
||||
return false;
|
||||
+ "'##' cannot appear at either end of a macro "
|
||||
+ "expansion");
|
||||
goto out;
|
||||
}
|
||||
break;
|
||||
@@ -3072,7 +3071,8 @@ create_iso_definition (cpp_reader *pfile
|
||||
if (!vaopt_tracker.completed ())
|
||||
@@ -3397,7 +3397,9 @@ create_iso_definition (cpp_reader *pfile
|
||||
function-like macros, but not at the beginning. */
|
||||
if (macro->count == 1)
|
||||
{
|
||||
- cpp_error (pfile, CPP_DL_ERROR, paste_op_error_msg);
|
||||
+ cpp_error (pfile, CPP_DL_ERROR,
|
||||
+ "'##' cannot appear at either end of a macro expansion");
|
||||
return false;
|
||||
+ "'##' cannot appear at either end of a macro "
|
||||
+ "expansion");
|
||||
goto out;
|
||||
}
|
||||
|
||||
--- libcpp/expr.c.jj 2015-01-14 11:01:34.000000000 +0100
|
||||
+++ libcpp/expr.c 2015-01-14 14:35:52.851002344 +0100
|
||||
@@ -672,16 +672,17 @@ cpp_classify_number (cpp_reader *pfile,
|
||||
--- libcpp/expr.c.jj 2019-01-09 13:01:22.415535734 +0100
|
||||
+++ libcpp/expr.c 2019-01-11 18:16:23.444726882 +0100
|
||||
@@ -788,16 +788,17 @@ cpp_classify_number (cpp_reader *pfile,
|
||||
if ((result & CPP_N_WIDTH) == CPP_N_LARGE
|
||||
&& CPP_OPTION (pfile, cpp_warn_long_long))
|
||||
{
|
@ -4,7 +4,7 @@
|
||||
<a class="link" href="https://www.fsf.org" target="_top">FSF
|
||||
</a>
|
||||
</p><p>
|
||||
+ Release 8.2.1
|
||||
+ Release 9.0.0
|
||||
+ </p><p>
|
||||
Permission is granted to copy, distribute and/or modify this
|
||||
document under the terms of the GNU Free Documentation
|
||||
@ -17,7 +17,7 @@
|
||||
</p><p>
|
||||
- The API documentation, rendered into HTML, can be viewed online
|
||||
+ The API documentation, rendered into HTML, can be viewed locally
|
||||
+ <a class="link" href="api/index.html" target="_top">for the 8.2.1 release</a>,
|
||||
+ <a class="link" href="api/index.html" target="_top">for the 9.0.0 release</a>,
|
||||
+ online
|
||||
<a class="link" href="http://gcc.gnu.org/onlinedocs/" target="_top">for each GCC release</a>
|
||||
and
|
@ -1,8 +1,6 @@
|
||||
2010-02-08 Roland McGrath <roland@redhat.com>
|
||||
|
||||
* config/rs6000/sysv4.h (LINK_EH_SPEC): Pass --no-add-needed to the
|
||||
linker.
|
||||
* config/gnu-user.h (LINK_EH_SPEC): Likewise.
|
||||
* config/gnu-user.h (LINK_EH_SPEC): Pass --no-add-needed to the linker.
|
||||
* config/alpha/elf.h (LINK_EH_SPEC): Likewise.
|
||||
* config/ia64/linux.h (LINK_EH_SPEC): Likewise.
|
||||
|
||||
@ -28,7 +26,7 @@
|
||||
#define TARGET_INIT_LIBFUNCS ia64_soft_fp_init_libfuncs
|
||||
--- gcc/config/gnu-user.h.jj 2011-01-03 12:53:03.739057299 +0100
|
||||
+++ gcc/config/gnu-user.h 2011-01-04 18:14:10.932814884 +0100
|
||||
@@ -133,7 +133,7 @@ see the files COPYING3 and COPYING.RUNTI
|
||||
@@ -106,7 +106,7 @@ see the files COPYING3 and COPYING.RUNTI
|
||||
#define LIB_SPEC GNU_USER_TARGET_LIB_SPEC
|
||||
|
||||
#if defined(HAVE_LD_EH_FRAME_HDR)
|
||||
@ -36,15 +34,4 @@
|
||||
+#define LINK_EH_SPEC "--no-add-needed %{!static|static-pie:--eh-frame-hdr} "
|
||||
#endif
|
||||
|
||||
#undef LINK_GCC_C_SEQUENCE_SPEC
|
||||
--- gcc/config/rs6000/sysv4.h.jj 2011-01-03 13:02:18.255994215 +0100
|
||||
+++ gcc/config/rs6000/sysv4.h 2011-01-04 18:14:10.933888871 +0100
|
||||
@@ -816,7 +816,7 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEF
|
||||
-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}"
|
||||
|
||||
#if defined(HAVE_LD_EH_FRAME_HDR)
|
||||
-# define LINK_EH_SPEC "%{!static|static-pie:--eh-frame-hdr} "
|
||||
+# define LINK_EH_SPEC "--no-add-needed %{!static|static-pie:--eh-frame-hdr} "
|
||||
#endif
|
||||
|
||||
#define CPP_OS_LINUX_SPEC "-D__unix__ -D__gnu_linux__ -D__linux__ \
|
||||
#define GNU_USER_TARGET_LINK_GCC_C_SEQUENCE_SPEC \
|
18
gcc9-pr88044.patch
Normal file
18
gcc9-pr88044.patch
Normal file
@ -0,0 +1,18 @@
|
||||
2019-01-18 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR tree-optimization/88044
|
||||
* tree-ssa-loop-niter.c (number_of_iterations_cond): If condition
|
||||
is false in the first iteration, but !every_iteration, return false
|
||||
instead of true with niter->niter zero.
|
||||
|
||||
--- gcc/tree-ssa-loop-niter.c.jj 2019-01-10 11:43:02.254577008 +0100
|
||||
+++ gcc/tree-ssa-loop-niter.c 2019-01-18 19:51:00.245504728 +0100
|
||||
@@ -1824,6 +1824,8 @@ number_of_iterations_cond (struct loop *
|
||||
tree tem = fold_binary (code, boolean_type_node, iv0->base, iv1->base);
|
||||
if (tem && integer_zerop (tem))
|
||||
{
|
||||
+ if (!every_iteration)
|
||||
+ return false;
|
||||
niter->niter = build_int_cst (unsigned_type_for (type), 0);
|
||||
niter->max = 0;
|
||||
return true;
|
122
gcc9-pr88714.patch
Normal file
122
gcc9-pr88714.patch
Normal file
@ -0,0 +1,122 @@
|
||||
2019-01-17 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR bootstrap/88714
|
||||
* config/arm/ldrdstrd.md: If alias sets on the SImode MEMs are
|
||||
different, clear alias set on the DImode MEM. Clear MEM_EXPR.
|
||||
|
||||
* gcc.c-torture/execute/pr88714.c: New test.
|
||||
|
||||
--- gcc/config/arm/ldrdstrd.md.jj 2019-01-16 09:35:03.851334889 +0100
|
||||
+++ gcc/config/arm/ldrdstrd.md 2019-01-17 17:37:40.860791779 +0100
|
||||
@@ -39,6 +39,10 @@ (define_peephole2 ; ldrd
|
||||
/* In ARM state, the destination registers of LDRD/STRD must be
|
||||
consecutive. We emit DImode access. */
|
||||
operands[0] = gen_rtx_REG (DImode, REGNO (operands[0]));
|
||||
+ if (MEM_ALIAS_SET (operands[2])
|
||||
+ && MEM_ALIAS_SET (operands[2]) != MEM_ALIAS_SET (operands[3]))
|
||||
+ set_mem_alias_set (operands[2], 0);
|
||||
+ set_mem_expr (operands[2], NULL_TREE);
|
||||
operands[2] = adjust_address (operands[2], DImode, 0);
|
||||
/* Emit [(set (match_dup 0) (match_dup 2))] */
|
||||
emit_insn (gen_rtx_SET (operands[0], operands[2]));
|
||||
@@ -71,6 +75,10 @@ (define_peephole2 ; strd
|
||||
/* In ARM state, the destination registers of LDRD/STRD must be
|
||||
consecutive. We emit DImode access. */
|
||||
operands[0] = gen_rtx_REG (DImode, REGNO (operands[0]));
|
||||
+ if (MEM_ALIAS_SET (operands[2])
|
||||
+ && MEM_ALIAS_SET (operands[2]) != MEM_ALIAS_SET (operands[3]))
|
||||
+ set_mem_alias_set (operands[2], 0);
|
||||
+ set_mem_expr (operands[2], NULL_TREE);
|
||||
operands[2] = adjust_address (operands[2], DImode, 0);
|
||||
/* Emit [(set (match_dup 2) (match_dup 0))] */
|
||||
emit_insn (gen_rtx_SET (operands[2], operands[0]));
|
||||
@@ -106,6 +114,10 @@ (define_peephole2 ; strd of constants
|
||||
else if (TARGET_ARM)
|
||||
{
|
||||
rtx tmp = gen_rtx_REG (DImode, REGNO (operands[0]));
|
||||
+ if (MEM_ALIAS_SET (operands[2])
|
||||
+ && MEM_ALIAS_SET (operands[2]) != MEM_ALIAS_SET (operands[3]))
|
||||
+ set_mem_alias_set (operands[2], 0);
|
||||
+ set_mem_expr (operands[2], NULL_TREE);
|
||||
operands[2] = adjust_address (operands[2], DImode, 0);
|
||||
/* Emit the pattern:
|
||||
[(set (match_dup 0) (match_dup 4))
|
||||
@@ -149,6 +161,10 @@ (define_peephole2 ; strd of constants
|
||||
else if (TARGET_ARM)
|
||||
{
|
||||
rtx tmp = gen_rtx_REG (DImode, REGNO (operands[0]));
|
||||
+ if (MEM_ALIAS_SET (operands[2])
|
||||
+ && MEM_ALIAS_SET (operands[2]) != MEM_ALIAS_SET (operands[3]))
|
||||
+ set_mem_alias_set (operands[2], 0);
|
||||
+ set_mem_expr (operands[2], NULL_TREE);
|
||||
operands[2] = adjust_address (operands[2], DImode, 0);
|
||||
/* Emit the pattern
|
||||
[(set (match_dup 0) (match_dup 4))
|
||||
@@ -203,6 +219,10 @@ (define_peephole2 ; swap the destination
|
||||
else
|
||||
{
|
||||
operands[0] = gen_rtx_REG (DImode, REGNO (operands[0]));
|
||||
+ if (MEM_ALIAS_SET (operands[2])
|
||||
+ && MEM_ALIAS_SET (operands[2]) != MEM_ALIAS_SET (operands[3]))
|
||||
+ set_mem_alias_set (operands[2], 0);
|
||||
+ set_mem_expr (operands[2], NULL_TREE);
|
||||
operands[2] = adjust_address (operands[2], DImode, 0);
|
||||
}
|
||||
}
|
||||
@@ -238,6 +258,10 @@ (define_peephole2 ; swap the destination
|
||||
else
|
||||
{
|
||||
operands[0] = gen_rtx_REG (DImode, REGNO (operands[0]));
|
||||
+ if (MEM_ALIAS_SET (operands[2])
|
||||
+ && MEM_ALIAS_SET (operands[2]) != MEM_ALIAS_SET (operands[3]))
|
||||
+ set_mem_alias_set (operands[2], 0);
|
||||
+ set_mem_expr (operands[2], NULL_TREE);
|
||||
operands[2] = adjust_address (operands[2], DImode, 0);
|
||||
}
|
||||
}
|
||||
--- gcc/testsuite/gcc.c-torture/execute/pr88714.c.jj 2019-01-17 17:39:42.074828164 +0100
|
||||
+++ gcc/testsuite/gcc.c-torture/execute/pr88714.c 2019-01-17 17:21:26.810575783 +0100
|
||||
@@ -0,0 +1,43 @@
|
||||
+/* PR bootstrap/88714 */
|
||||
+
|
||||
+struct S { int a, b, c; int *d; };
|
||||
+struct T { int *e, *f, *g; } *t = 0;
|
||||
+int *o = 0;
|
||||
+
|
||||
+__attribute__((noipa))
|
||||
+void bar (int *x, int y, int z, int w)
|
||||
+{
|
||||
+ if (w == -1)
|
||||
+ {
|
||||
+ if (x != 0 || y != 0 || z != 0)
|
||||
+ __builtin_abort ();
|
||||
+ }
|
||||
+ else if (w != 0 || x != t->g || y != 0 || z != 12)
|
||||
+ __builtin_abort ();
|
||||
+}
|
||||
+
|
||||
+__attribute__((noipa)) void
|
||||
+foo (struct S *x, struct S *y, int *z, int w)
|
||||
+{
|
||||
+ *o = w;
|
||||
+ if (w)
|
||||
+ bar (0, 0, 0, -1);
|
||||
+ x->d = z;
|
||||
+ if (y->d)
|
||||
+ y->c = y->c + y->d[0];
|
||||
+ bar (t->g, 0, y->c, 0);
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main ()
|
||||
+{
|
||||
+ int a[4] = { 8, 9, 10, 11 };
|
||||
+ struct S s = { 1, 2, 3, &a[0] };
|
||||
+ struct T u = { 0, 0, &a[3] };
|
||||
+ o = &a[2];
|
||||
+ t = &u;
|
||||
+ foo (&s, &s, &a[1], 5);
|
||||
+ if (s.c != 12 || s.d != &a[1])
|
||||
+ __builtin_abort ();
|
||||
+ return 0;
|
||||
+}
|
45
gcc9-pr88901.patch
Normal file
45
gcc9-pr88901.patch
Normal file
@ -0,0 +1,45 @@
|
||||
2019-01-18 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR sanitizer/88901
|
||||
* typeck.c (cp_build_binary_op): Don't instrument
|
||||
SANITIZE_POINTER_COMPARE if processing_template_decl.
|
||||
(pointer_diff): Similarly for SANITIZE_POINTER_SUBTRACT.
|
||||
|
||||
* g++.dg/asan/pr88901.C: New test.
|
||||
|
||||
--- gcc/cp/typeck.c.jj 2019-01-18 09:13:58.580790058 +0100
|
||||
+++ gcc/cp/typeck.c 2019-01-18 11:53:45.941734135 +0100
|
||||
@@ -5233,6 +5233,7 @@ cp_build_binary_op (const op_location_t
|
||||
}
|
||||
|
||||
if ((code0 == POINTER_TYPE || code1 == POINTER_TYPE)
|
||||
+ && !processing_template_decl
|
||||
&& sanitize_flags_p (SANITIZE_POINTER_COMPARE))
|
||||
{
|
||||
op0 = save_expr (op0);
|
||||
@@ -5650,7 +5651,8 @@ pointer_diff (location_t loc, tree op0,
|
||||
else
|
||||
inttype = restype;
|
||||
|
||||
- if (sanitize_flags_p (SANITIZE_POINTER_SUBTRACT))
|
||||
+ if (!processing_template_decl
|
||||
+ && sanitize_flags_p (SANITIZE_POINTER_SUBTRACT))
|
||||
{
|
||||
op0 = save_expr (op0);
|
||||
op1 = save_expr (op1);
|
||||
--- gcc/testsuite/g++.dg/asan/pr88901.C.jj 2019-01-18 11:55:42.398826983 +0100
|
||||
+++ gcc/testsuite/g++.dg/asan/pr88901.C 2019-01-18 11:55:26.559086374 +0100
|
||||
@@ -0,0 +1,13 @@
|
||||
+// PR sanitizer/88901
|
||||
+// { dg-do compile }
|
||||
+// { dg-options "-fsanitize=address -fsanitize=pointer-compare" }
|
||||
+
|
||||
+template <typename T>
|
||||
+struct A {
|
||||
+ void foo() {
|
||||
+ auto d = [](char *x, char *y) {
|
||||
+ for (char *p = x; p + sizeof(T) <= y; p += sizeof(T))
|
||||
+ reinterpret_cast<T *>(p)->~T();
|
||||
+ };
|
||||
+ }
|
||||
+};
|
32
gcc9-utf-array-test.patch
Normal file
32
gcc9-utf-array-test.patch
Normal file
@ -0,0 +1,32 @@
|
||||
2019-01-18 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* gcc.dg/utf-array.c: Allow wchar_t to be printed as
|
||||
{long ,short ,}{unsigned ,}int.
|
||||
|
||||
--- gcc/testsuite/gcc.dg/utf-array.c.jj 2019-01-18 00:33:20.867980701 +0100
|
||||
+++ gcc/testsuite/gcc.dg/utf-array.c 2019-01-18 23:32:57.086524528 +0100
|
||||
@@ -12,13 +12,13 @@ typedef __CHAR32_TYPE__ char32_t;
|
||||
const char s_0[] = "ab";
|
||||
const char s_1[] = u"ab"; /* { dg-error "from a string literal with type array of" } */
|
||||
const char s_2[] = U"ab"; /* { dg-error "from a string literal with type array of" } */
|
||||
-const char s_3[] = L"ab"; /* { dg-error "from a string literal with type array of .int." } */
|
||||
+const char s_3[] = L"ab"; /* { dg-error "from a string literal with type array of .(long |short )?(unsigned )?int." } */
|
||||
const char s_4[] = u8"ab";
|
||||
|
||||
const char16_t s16_0[] = "ab"; /* { dg-error "from a string literal with type array of .char." } */
|
||||
const char16_t s16_1[] = u"ab";
|
||||
const char16_t s16_2[] = U"ab"; /* { dg-error "from a string literal with type array of" } */
|
||||
-const char16_t s16_3[] = L"ab"; /* { dg-error "from a string literal with type array of .int." "" { target { ! wchar_t_char16_t_compatible } } } */
|
||||
+const char16_t s16_3[] = L"ab"; /* { dg-error "from a string literal with type array of .(long |short )?(unsigned )?int." "" { target { ! wchar_t_char16_t_compatible } } } */
|
||||
const char16_t s16_4[] = u8"ab"; /* { dg-error "from a string literal with type array of .char." } */
|
||||
|
||||
const char16_t s16_5[0] = u"ab"; /* { dg-warning "chars is too long" } */
|
||||
@@ -30,7 +30,7 @@ const char16_t s16_9[4] = u"ab";
|
||||
const char32_t s32_0[] = "ab"; /* { dg-error "from a string literal with type array of .char." } */
|
||||
const char32_t s32_1[] = u"ab"; /* { dg-error "from a string literal with type array of" } */
|
||||
const char32_t s32_2[] = U"ab";
|
||||
-const char32_t s32_3[] = L"ab"; /* { dg-error "from a string literal with type array of .int." "" { target { ! wchar_t_char32_t_compatible } } } */
|
||||
+const char32_t s32_3[] = L"ab"; /* { dg-error "from a string literal with type array of .(long |short )?(unsigned )?int." "" { target { ! wchar_t_char32_t_compatible } } } */
|
||||
const char32_t s32_4[] = u8"ab"; /* { dg-error "from a string literal with type array of .char." } */
|
||||
|
||||
const char32_t s32_5[0] = U"ab"; /* { dg-warning "chars is too long" } */
|
2
sources
2
sources
@ -1,3 +1,3 @@
|
||||
SHA512 (gcc-8.2.1-20190109.tar.xz) = d699b52baa2c54a71f2fef2dd77701baa836737975938d67fb532f1a54638b1442fc04b560fd74e66b44195e4de9ce485100b9bdbac569e4c3abad053a96bc33
|
||||
SHA512 (gcc-9.0.0-20190119.tar.xz) = 22d58049867a220493ec77da591ebf4a4bc05513451f31a4e9d990035b0a6f571d495fc86ec607bb6eb7aebb310e57ccab669b764d07503ce1e6f6109b893262
|
||||
SHA512 (nvptx-newlib-aadc8eb0ec43b7cd0dd2dfb484bae63c8b05ef24.tar.xz) = 94f7089365296f7dfa485107b4143bebc850a81586f3460fd896bbbb6ba099a00217d4042133424fd2183b352132f4fd367e6a60599bdae2a26dfd48a77d0e04
|
||||
SHA512 (nvptx-tools-c28050f60193b3b95a18866a96f03334e874e78f.tar.xz) = a688cb12cf805950a5abbb13b52f45c81dbee98e310b7ed57ae20e76dbfa5964a16270148374a6426d177db71909d28360490f091c86a5d19d4faa5127beeee1
|
||||
|
Loading…
Reference in New Issue
Block a user