Between 20180720 (r262899) and 20180721 (r262917), Solaris bootstrap broke like this: In file included from /vol/gcc/src/hg/trunk/local/gcc/system.h:691, from /vol/gcc/src/hg/trunk/local/gcc/tree-vect-slp.c:23: /vol/gcc/src/hg/trunk/local/gcc/tree-vect-slp.c: In function '_slp_tree* vect_build_slp_tree_2(vec_info*, vec<gimple*>, unsigned int, poly_uint64*, vec<_slp_tree*>*, bool*, unsigned int*, unsigned int*, unsigned int)': /vol/gcc/src/hg/trunk/local/gcc/../include/libiberty.h:722:36: error: 'alloca' bound is unknown [-Werror=alloca-larger-than=] # define alloca(x) __builtin_alloca(x) ~~~~~~~~~~~~~~~~^~~ /vol/gcc/src/hg/trunk/local/gcc/../include/libiberty.h:356:33: note: in expansion of macro 'alloca' #define XALLOCAVEC(T, N) ((T *) alloca (sizeof (T) * (N))) ^~~~~~ /vol/gcc/src/hg/trunk/local/gcc/tree-vect-slp.c:1437:16: note: in expansion of macro 'XALLOCAVEC' bool *tem = XALLOCAVEC (bool, group_size); ^~~~~~~~~~ This is almost certainly due to 2018-07-20 Martin Sebor <msebor@redhat.com> PR middle-end/82063 * builtins.c (expand_builtin_alloca): Adjust. * calls.c (alloc_max_size): Simplify. * cgraphunit.c (cgraph_node::expand): Adjust. * common.opt (larger_than_size, warn_frame_larger_than): Remove variables. (frame_larger_than_size): Same. (-Wframe-larger-than, -Wlarger-than, -Wstack-usage): Change options to take a HOST_WIDE_INT argument and accept a byte-size suffix. Initialize. * doc/invoke.texi (GCC Command Options): Document option arguments. Explain byte-size arguments and suffixes. (-Wvla-larger-than, -Wno-alloc-size-larger-than): Update. (-Wno-alloca-larger-than, -Wno-vla-larger-than): Same. (-Wframe-larger-than, -Wlarger-than, -Wstack-usage): Same. * doc/options.texi (UInteger): Expand. (Host_Wide_Int, ByteSize): Document new properties. * final.c (final_start_function_1): Include sizes in an error message. * function.c (frame_offset_overflow): Same. * gimple-ssa-warn-alloca.c (pass_walloca::gate): Adjust. (alloca_call_type_by_arg): Change function argument to HOST_WIDE_INT. Diagnose unbounded alloca calls only for limits of less than PTRDIFF_MAX. (alloca_call_type): Adjust. Diagnose possibly out-of-bounds alloca calls and VLA size only for limits of less than PTRDIFF_MAX. Same for alloca(0). (pass_walloca::execute): Adjust. Diagnose alloca calls in loops only for limits of less than PTRDIFF_MAX. * langhooks-def.h (lhd_handle_option): Change function argument to HOST_WIDE_INT. * langhooks.c (lhd_handle_option): Same. * langhooks.h (handle_option): Same. * opt-functions.awk (switch_bit_fields): Handle Host_Wide_Int and ByteSize flags. (var_type, var_type_struct): Same. (var_set): Handle ByteSize flag. * optc-gen.awk: Add comments to output to ease debugging. Make use of HOST_WIDE_INT where appropriate. * opts-gen-save.awk: Use %lx to format unsigned long. * opth-gen.awk: Change function argument to HOST_WIDE_INT. * opts-common.c (integral_argument): Return HOST_WIDE_INT and add arguments. Parse bytes-size suffixes. (enum_arg_to_value): Change function argument to HOST_WIDE_INT. (enum_value_to_arg): Same. (decode_cmdline_option): Handle cl_host_wide_int. Adjust. (handle_option): Adjust. (generate_option): Change function argument to HOST_WIDE_INT. (cmdline_handle_error): Adjust. (read_cmdline_option): Change function argument to HOST_WIDE_INT. (set_option): Change function argument to HOST_WIDE_INT. (option_enabled): Handle cl_host_wide_int. (get_option_state): Handle CLVC_SIZE. (control_warning_option): Same. * opts.c (common_handle_option): Change function argument to HOST_WIDE_INT. Remove handling of OPT_Walloca_larger_than_ and OPT_Wvla_larger_than_. * opts.h (enum cl_var_type): Add an enumerator. * stor-layout.c (layout_decl): Print a more meaningful warning. * toplev.c (output_stack_usage): Adjust.
i686-linux bootstrap is broken too the same way.
*** Bug 86624 has been marked as a duplicate of this bug. ***
May affect all 32-bit targets.
i686 target is ok on x86-64 host. The problem is 32 bit host.
Before the changes, -Walloca-larger-than wasn't enabled by default, warn_alloca_limit (and warn_vla_limit) defaulted to 0, which means e.g. pass_walloca::gate in the second pass would return false. Note, neither of these options is meant to be included in -Wall or -Wextra. But newly the options default to HOST_WIDE_INT_MAX, but the gate really hasn't been adjusted. The options weren't enabled by default before and for a good reason, so I wonder why you've changed that. I'd vote for changing their default to Init(-1) from Init(HOST_WIDE_INT_MAX) and changing back documentation, to match previous behavior.
The rationale for the change is explained in the description of them patch: https://gcc.gnu.org/ml/gcc-patches/2018-06/msg01509.html
Yes, but I certainly disagree with that, especially enabling a code-style warning by default. tree-vect-slp.c uses alloca 3 times, the warning is only in one spot, all of them are bound, because the vectorizer will not allow excessively large group sizes. I fail to see why people would need to add workarounds for this warnings, unless they want to enable it manually and have as a code style that all alloca calls must have a clearly visible (to the compiler) bound. If this triggers on gcc itself, it will trigger on many other programs. Unbound alloca isn't always a security issue, sure, there are projects that you want to make sure it never happens there, like glibc, but I think that is already explicitly enabling the warning.
Author: msebor Date: Sun Jul 22 21:09:32 2018 New Revision: 262923 URL: https://gcc.gnu.org/viewcvs?rev=262923&root=gcc&view=rev Log: PR bootstrap/86621 - 'alloca' bound is unknown in tree-vect-slp.c:1437:16 gcc/ChangeLog: * gcc/gimple-ssa-warn-alloca.c (alloca_call_type_by_arg): Avoid diagnosing calls with unknown arguments unless -Walloca-larger-than is restricted to less than PTRDIFF_MAX bytes. Modified: trunk/gcc/ChangeLog trunk/gcc/gimple-ssa-warn-alloca.c
r262923 adds the missing logic to prevent the "unknown bound" kind of warning unless -Walloca-larger-than has been explicitly specified. i386 bootstrap should be restored (passes for me)., as should (hopefully) all other ILP32 targets.
*** Bug 86629 has been marked as a duplicate of this bug. ***
> --- Comment #9 from Martin Sebor <msebor at gcc dot gnu.org> --- > r262923 adds the missing logic to prevent the "unknown bound" kind of warning > unless -Walloca-larger-than has been explicitly specified. i386 bootstrap > should be restored (passes for me)., as should (hopefully) all other ILP32 > targets. The patch does indeed fix i386-pc-solaris2.11 and sparc-sun-solaris2.11 bootstrap. Thanks for that! Please post it to gcc-patches, though: all patches are supposed to go there for reference. However, the new patch introduced a couple of testsuite regressions: +FAIL: g++.dg/Walloca1.C -std=gnu++11 (test for warnings, line 7) +FAIL: g++.dg/Walloca1.C -std=gnu++14 (test for warnings, line 7) +FAIL: g++.dg/Walloca1.C -std=gnu++98 (test for warnings, line 7) +FAIL: gcc.dg/Wvla-larger-than-3.c (test for warnings, line 66) +FAIL: gcc.dg/attr-alloc_size-3.c (test for warnings, line 403) +FAIL: gcc.dg/attr-alloc_size-3.c (test for warnings, line 404) +FAIL: gcc.dg/attr-alloc_size-3.c (test for warnings, line 406) +FAIL: gcc.dg/attr-alloc_size-3.c (test for warnings, line 407) +FAIL: gcc.dg/attr-alloc_size-3.c (test for warnings, line 408) +FAIL: gcc.dg/attr-alloc_size-3.c (test for warnings, line 409) +FAIL: gcc.dg/attr-alloc_size-3.c (test for warnings, line 410) +FAIL: gcc.dg/attr-alloc_size-3.c (test for warnings, line 413) +FAIL: gcc.dg/attr-alloc_size-3.c (test for warnings, line 414) +FAIL: gcc.dg/attr-alloc_size-3.c (test for warnings, line 416) +FAIL: gcc.dg/attr-alloc_size-3.c (test for warnings, line 438) +FAIL: gcc.dg/attr-alloc_size-3.c (test for warnings, line 449) +FAIL: gcc.dg/attr-alloc_size-3.c (test for warnings, line 453) +FAIL: gcc.dg/attr-alloc_size-3.c (test for warnings, line 454) +FAIL: gcc.dg/attr-alloc_size-3.c (test for warnings, line 455) +FAIL: gcc.dg/attr-alloc_size-3.c (test for excess errors) +FAIL: gcc.dg/attr-alloc_size-3.c argument 2 (test for warnings, line 410) +FAIL: gcc.dg/attr-alloc_size-3.c argument 2 (test for warnings, line 455) +FAIL: gcc.dg/pr42611.c (test for warnings, line 17)
I'm tracking the test failures in bug 86631.