[Bug middle-end/65958] -fstack-check breaks alloca on architectures using generic stack checking

2017-01-11 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65958

Martin Sebor  changed:

   What|Removed |Added

 CC||aoliva at gcc dot gnu.org

--- Comment #10 from Martin Sebor  ---
*** Bug 14236 has been marked as a duplicate of this bug. ***

[Bug middle-end/65958] -fstack-check breaks alloca on architectures using generic stack checking

2015-12-04 Thread ebotcazou at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65958

--- Comment #7 from Eric Botcazou  ---
Author: ebotcazou
Date: Fri Dec  4 11:57:15 2015
New Revision: 231260

URL: https://gcc.gnu.org/viewcvs?rev=231260=gcc=rev
Log:
PR middle-end/65958
* gimplify.c (struct gimplify_ctx): Turn boolean fields into 1-bit
fields, add keep_stack and reorder them.
(gimplify_bind_expr): Save gimplify_ctxp->keep_stack on entry then
set it to false.  Do not insert a stack save/restore pair if it has
been set to true by the gimplification of the statements.
Restore it to the saved value on exit if it is still false.
(gimplify_vla_decl): Do not set gimplify_ctxp->save_stack here.
(gimplify_call_expr) : New case.  Set
either save_stack or keep_stack depending on CALL_ALLOCA_FOR_VAR_P.
* doc/extend.texi (Variable Length): Document new behavior.
* doc/generic.texi (Blocks): Document new handling of VLAs.

Added:
trunk/gcc/testsuite/gcc.dg/vla-24.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/doc/extend.texi
trunk/gcc/doc/generic.texi
trunk/gcc/gimplify.c
trunk/gcc/testsuite/ChangeLog

[Bug middle-end/65958] -fstack-check breaks alloca on architectures using generic stack checking

2015-12-04 Thread ebotcazou at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65958

Eric Botcazou  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #8 from Eric Botcazou  ---
Fixed in GCC 6 for all architectures (and doubly so for ARM and Aarch64).

[Bug middle-end/65958] -fstack-check breaks alloca on architectures using generic stack checking

2015-12-04 Thread ebotcazou at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65958

--- Comment #6 from Eric Botcazou  ---
Author: ebotcazou
Date: Fri Dec  4 11:52:04 2015
New Revision: 231259

URL: https://gcc.gnu.org/viewcvs?rev=231259=gcc=rev
Log:
PR middle-end/65958
* config/aarch64/aarch64-protos.h (aarch64_output_probe_stack-range):
Declare.
* config/aarch64/aarch64.md: Declare UNSPECV_BLOCKAGE and
UNSPEC_PROBE_STACK_RANGE.
(blockage): New instruction.
(probe_stack_range_): Likewise.
* config/aarch64/aarch64.c (aarch64_emit_probe_stack_range): New
function.
(aarch64_output_probe_stack_range): Likewise.
(aarch64_expand_prologue): Invoke aarch64_emit_probe_stack_range if
static builtin stack checking is enabled.
* config/aarch64/aarch64-linux.h (STACK_CHECK_STATIC_BUILTIN):
Define to 1.

Added:
trunk/gcc/testsuite/gcc.target/aarch64/stack-checking.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/aarch64/aarch64-linux.h
trunk/gcc/config/aarch64/aarch64-protos.h
trunk/gcc/config/aarch64/aarch64.c
trunk/gcc/config/aarch64/aarch64.md
trunk/gcc/testsuite/ChangeLog

[Bug middle-end/65958] -fstack-check breaks alloca on architectures using generic stack checking

2015-12-04 Thread ebotcazou at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65958

--- Comment #9 from Eric Botcazou  ---
Author: ebotcazou
Date: Fri Dec  4 18:25:54 2015
New Revision: 231295

URL: https://gcc.gnu.org/viewcvs?rev=231295=gcc=rev
Log:
PR middle-end/65958
* config/arm/unspecs.md (unspec): Remove UNSPEC_PROBE_STACK_RANGE.
(unspecv): Add VUNSPEC_PROBE_STACK_RANGE.
* config/arm/arm.md (probe_stack_range): Adjust.
* config/aarch64/aarch64.md (unspec): Remove UNSPEC_PROBE_STACK_RANGE.
(unspecv): Add UNSPECV_PROBE_STACK_RANGE.
(probe_stack_range_): Adjust.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/aarch64/aarch64.md
trunk/gcc/config/arm/arm.md
trunk/gcc/config/arm/unspecs.md

[Bug middle-end/65958] -fstack-check breaks alloca on architectures using generic stack checking

2015-09-17 Thread ebotcazou at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65958

--- Comment #5 from Eric Botcazou  ---
Author: ebotcazou
Date: Thu Sep 17 11:06:57 2015
New Revision: 227860

URL: https://gcc.gnu.org/viewcvs?rev=227860=gcc=rev
Log:
PR middle-end/65958
* config/arm/linux-elf.h (STACK_CHECK_STATIC_BUILTIN): Define.
* config/arm/arm-protos.h (output_probe_stack_range): Declare.
* config/arm/arm.c: Include common/common-target.h.
(use_return_insn): Return 0 if the static chain register was saved
above a non-APCS frame.
(arm_compute_static_chain_stack_bytes): Adjust for stack checking.
(struct scratch_reg): New.
(get_scratch_register_on_entry): New function.
(release_scratch_register_on_entry): Likewise.
(arm_emit_probe_stack_range): Likewise.
(output_probe_stack_range): Likewise.
(arm_expand_prologue): Factor out code dealing with the IP register
for nested function and adjust it for stack checking.
Invoke arm_emit_probe_stack_range if static builtin stack checking
is enabled.
(thumb1_expand_prologue): Sorry out if static builtin stack checking
is enabled.
(arm_expand_epilogue): Add the saved static chain register, if any, to
the amount of pre-pushed registers to pop.
(arm_frame_pointer_required): Return true if static stack checking is
enabled and we want to catch the exception with the EABI unwinder.
* config/arm/unspecs.md (UNSPEC_PROBE_STACK): New constant.
(UNSPEC_PROBE_STACK_RANGE): Likewise.
* config/arm/arm.md (probe_stack): New insn.
(probe_stack_range): Likewise.

Added:
trunk/gcc/testsuite/gcc.target/arm/stack-checking.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/arm/arm-protos.h
trunk/gcc/config/arm/arm.c
trunk/gcc/config/arm/arm.md
trunk/gcc/config/arm/linux-elf.h
trunk/gcc/config/arm/unspecs.md
trunk/gcc/testsuite/ChangeLog