aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
AgeCommit message (Collapse)AuthorFilesLines
2020-07-20Correct handling of constant representations containing embedded nuls.Martin Sebor1-14/+14
Resolves: PR middle-end/95189 - memcmp being wrongly stripped like strcm PR middle-end/95886 - suboptimal memcpy with embedded zero bytes gcc/ChangeLog: PR middle-end/95189 PR middle-end/95886 * builtins.c (inline_expand_builtin_string_cmp): Rename... (inline_expand_builtin_bytecmp): ...to this. (builtin_memcpy_read_str): Don't expect data to be nul-terminated. (expand_builtin_memory_copy_args): Handle object representations with embedded nul bytes. (expand_builtin_memcmp): Same. (expand_builtin_strcmp): Adjust call to naming change. (expand_builtin_strncmp): Same. * expr.c (string_constant): Create empty strings with nonzero size. * fold-const.c (c_getstr): Rename locals and update comments. * tree.c (build_string): Accept null pointer argument. (build_string_literal): Same. * tree.h (build_string): Provide a default. (build_string_literal): Same. gcc/testsuite/ChangeLog: PR middle-end/95189 PR middle-end/95886 * gcc.dg/memcmp-pr95189.c: New test. * gcc.dg/strncmp-3.c: New test. * gcc.target/i386/memcpy-pr95886.c: New test.
2020-07-14core: add tree-node commentsNathan Sidwell1-1/+5
As we've moved to 64-bit systems, the padding information has become conditionally inaccurate. I also hit cases where invalid tree codes did not get flagged as invalid. gcc/ * tree-core.h (tree_decl_with_vis, tree_function_decl): Note additional padding on 64-bits * tree.c (cache_integer_cst): Note why no caching of enum literals. (get_tree_code_name): Robustify error case.
2020-07-13ipa-devirt: Fix crash in obj_type_ref_class [PR95114]Richard Sandiford1-3/+4
The testcase has failed since r9-5035, because obj_type_ref_class tries to look up an ODR type when no ODR type information is available. (The information was available earlier in the compilation, but was freed during pass_ipa_free_lang_data.) We then crash dereferencing the null get_odr_type result. The test passes with -O2. However, it fails again if -fdump-tree-all is used, since obj_type_ref_class is called indirectly from the dump routines. Other code creates ODR type entries on the fly by passing “true” as the insert parameter. But obj_type_ref_class can't do that unconditionally, since it should have no side-effects when used from the dumping code. Following a suggestion from Honza, this patch adds parameters to say whether the routines are being called from dump routines and uses those to derive the insert parameter. gcc/ PR middle-end/95114 * tree.h (virtual_method_call_p): Add a default-false parameter that indicates whether the function is being called from dump routines. (obj_type_ref_class): Likewise. * tree.c (virtual_method_call_p): Likewise. * ipa-devirt.c (obj_type_ref_class): Likewise. Lazily add ODR type information for the type when the parameter is false. * tree-pretty-print.c (dump_generic_node): Update calls to virtual_method_call_p and obj_type_ref_class accordingly. gcc/testsuite/ PR middle-end/95114 * g++.target/aarch64/pr95114.C: New test.
2020-06-28Underline argument in -Wnonnull and in C++ extend warning to the this ↵Martin Sebor1-3/+10
pointer [PR c++/86568]. Resolves: PR c++/86568 - -Wnonnull warnings should highlight the relevant argument not the closing parenthesis gcc/c-family/ChangeLog: PR c++/86568 * c-common.c (struct nonnull_arg_ctx): Add members. (check_function_nonnull): Use nonnull_arg_ctx as argument. Handle C++ member functions specially. Consider the this pointer implicitly nonnull. (check_nonnull_arg): Use location of argument when available. (check_function_arguments): Use nonnull_arg_ctx as argument. gcc/ChangeLog: PR c++/86568 * calls.c (maybe_warn_rdwr_sizes): Use location of argument if available. * tree-ssa-ccp.c (pass_post_ipa_warn::execute): Same. Adjust indentation. * tree.c (get_nonnull_args): Consider the this pointer implicitly nonnull. * var-tracking.c (deps_vec): New type. (var_loc_dep_vec): New function. (VAR_LOC_DEP_VEC): Use it. gcc/testsuite/ChangeLog: PR c++/86568 * g++.dg/warn/Wnonnull5.C: New test. * c-c++-common/pr28656.c: Adjust text of expected warning. * c-c++-common/pr66208.c: Same. * g++.dg/cpp0x/nullptr22.C: Same. * g++.dg/ext/attr-nonnull.C: Same. * g++.dg/ext/attrib49.C: Same. * g++.dg/pr71973-2.C: Same. * g++.dg/warn/Wnonnull3.C: Same. * g++.dg/warn/Wnonnull4.C: Same. * obj-c++.dg/attributes/method-nonnull-1.mm: Same. * objc.dg/attributes/method-nonnull-1.m: Same.
2020-06-09tree-inline: Fix VLA handling [PR95552]Jason Merrill1-0/+6
The problem in this testcase comes from cloning the constructor into complete and base variants. When we clone the body the first time, walk_tree_1 calls copy_tree_body_r on the type of the artificial TYPE_DECL we made for the VLA type without calling it on the decl itself, so we overwrite the type of the TYPE_DECL without copying the decl first. This has been broken since we started inserting a TYPE_DECL for anonymous VLAs in r7-457. This patch fixes walk_tree_1 to call the function on the TYPE_DECL, as we do for other decls of a DECL_EXPR. gcc/ChangeLog: PR c++/95552 * tree.c (walk_tree_1): Call func on the TYPE_DECL of a DECL_EXPR. gcc/testsuite/ChangeLog: PR c++/95552 * g++.dg/ext/vla23.C: New test.
2020-06-03Optimize ODR enum streamingJan Hubicka1-27/+6
it turns out that half of the global decl stream of cc1 LTO build consits TREE_LISTS, identifiers and integer cosntats representing TYPE_VALUES of enums. Those are streamed only to produce ODR warning and used otherwise, so this patch moves the info to a separate section that is represented and streamed more effectively. This also adds place for more info that may be used for ODR diagnostics (i.e. at the moment we do not warn when the declarations differs i.e. by the associated member functions and their types) and the type inheritance graph rather then poluting the global stream. I was bit unsure what enums we want to store into the section. All parsed enums is probably too expensive, only those enums streamed to represent IL is bit hard to get, so I went for those seen by free lang data. As a plus we now get bit more precise warning because also the location of mismatched enum CONST_DECL is streamed. It changes: [WPA] read 4608466 unshared trees [WPA] read 2942094 mergeable SCCs of average size 1.365328 [WPA] 8625389 tree bodies read in total [WPA] tree SCC table: size 524287, 247652 elements, collision ratio: 0.383702 [WPA] tree SCC max chain length 2 (size 1) [WPA] Compared 2694442 SCCs, 228 collisions (0.000085) [WPA] Merged 2694419 SCCs [WPA] Merged 3731982 tree bodies [WPA] Merged 633335 types [WPA] 122077 types prevailed (155548 associated trees) ... [WPA] Compression: 110593119 input bytes, 287696614 uncompressed bytes (ratio: 2.601397) [WPA] Size of mmap'd section decls: 85628556 bytes [WPA] Size of mmap'd section function_body: 13842928 bytes [WPA] read 1720989 unshared trees [WPA] read 1252217 mergeable SCCs of average size 1.858507 [WPA] 4048243 tree bodies read in total [WPA] tree SCC table: size 524287, 226524 elements, collision ratio: 0.491759 [WPA] tree SCC max chain length 2 (size 1) [WPA] Compared 1025693 SCCs, 196 collisions (0.000191) [WPA] Merged 1025670 SCCs [WPA] Merged 2063373 tree bodies [WPA] Merged 633497 types [WPA] 122299 types prevailed (155827 associated trees) ... [WPA] Compression: 103428770 input bytes, 281151423 uncompressed bytes (ratio: 2.718310) [WPA] Size of mmap'd section decls: 49390917 bytes [WPA] Size of mmap'd section function_body: 13858258 bytes ... [WPA] Size of mmap'd section odr_types: 29054816 bytes So number of SCCs streamed drops to 38% and the number of unshared trees (that are bit misnamed since it is mostly integer_cst) to 37%. Things speeds up correspondingly, but I did not save time report from previous build. The enum values are still quite surprisingly large. I may take a look into ways getting it smaller incrementally, but it streams reasonably fast: Time variable usr sys wall GGC phase opt and generate : 25.20 ( 68%) 10.88 ( 72%) 36.13 ( 69%) 868060 kB ( 52%) phase stream in : 4.46 ( 12%) 0.90 ( 6%) 5.38 ( 10%) 790724 kB ( 48%) phase stream out : 6.69 ( 18%) 3.32 ( 22%) 10.03 ( 19%) 8 kB ( 0%) ipa lto gimple in : 0.79 ( 2%) 1.86 ( 12%) 2.39 ( 5%) 252612 kB ( 15%) ipa lto gimple out : 2.48 ( 7%) 0.78 ( 5%) 3.26 ( 6%) 0 kB ( 0%) ipa lto decl in : 1.71 ( 5%) 0.46 ( 3%) 2.34 ( 4%) 417883 kB ( 25%) ipa lto decl out : 3.28 ( 9%) 0.07 ( 0%) 3.27 ( 6%) 0 kB ( 0%) whopr wpa I/O : 0.40 ( 1%) 2.24 ( 15%) 2.77 ( 5%) 8 kB ( 0%) lto stream decompression : 1.38 ( 4%) 0.31 ( 2%) 1.36 ( 3%) 0 kB ( 0%) ipa ODR types : 0.18 ( 0%) 0.02 ( 0%) 0.25 ( 0%) 0 kB ( 0%) ipa inlining heuristics : 11.64 ( 31%) 1.45 ( 10%) 13.12 ( 25%) 453160 kB ( 27%) ipa pure const : 1.74 ( 5%) 0.00 ( 0%) 1.76 ( 3%) 0 kB ( 0%) ipa icf : 1.72 ( 5%) 5.33 ( 35%) 7.06 ( 13%) 16593 kB ( 1%) whopr partitioning : 2.22 ( 6%) 0.01 ( 0%) 2.23 ( 4%) 5689 kB ( 0%) TOTAL : 37.17 15.20 52.46 1660886 kB LTO-bootstrapped/regtested x86_64-linux, will comit it shortly. gcc/ChangeLog: 2020-06-03 Jan Hubicka <hubicka@ucw.cz> * ipa-devirt.c: Include data-streamer.h, lto-streamer.h and streamer-hooks.h. (odr_enums): New static var. (struct odr_enum_val): New struct. (class odr_enum): New struct. (odr_enum_map): New hashtable. (odr_types_equivalent_p): Drop code testing TYPE_VALUES. (add_type_duplicate): Likewise. (free_odr_warning_data): Do not free TYPE_VALUES. (register_odr_enum): New function. (ipa_odr_summary_write): New function. (ipa_odr_read_section): New function. (ipa_odr_summary_read): New function. (class pass_ipa_odr): New pass. (make_pass_ipa_odr): New function. * ipa-utils.h (register_odr_enum): Declare. * lto-section-in.c: (lto_section_name): Add odr_types section. * lto-streamer.h (enum lto_section_type): Add odr_types section. * passes.def: Add odr_types pass. * lto-streamer-out.c (DFS::DFS_write_tree_body): Do not stream TYPE_VALUES. (hash_tree): Likewise. * tree-streamer-in.c (lto_input_ts_type_non_common_tree_pointers): Likewise. * tree-streamer-out.c (write_ts_type_non_common_tree_pointers): Likewise. * timevar.def (TV_IPA_ODR): New timervar. * tree-pass.h (make_pass_ipa_odr): Declare. * tree.c (free_lang_data_in_type): Regiser ODR types. gcc/lto/ChangeLog: 2020-06-03 Jan Hubicka <hubicka@ucw.cz> * lto-common.c (compare_tree_sccs_1): Do not compare TYPE_VALUES. gcc/testsuite/ChangeLog: 2020-06-03 Jan Hubicka <hubicka@ucw.cz> * g++.dg/lto/pr84805_0.C: Update.
2020-05-28Add support for __builtin_bswap128Eric Botcazou1-0/+2
This patch introduces a new builtin named __builtin_bswap128 on targets where TImode is supported, i.e. 64-bit targets only in practice. The implementation simply reuses the existing double word path in optab, so no routine is added to libgcc (which means that you get two calls to _bswapdi2 in the worst case). gcc/ChangeLog: * builtin-types.def (BT_UINT128): New primitive type. (BT_FN_UINT128_UINT128): New function type. * builtins.def (BUILT_IN_BSWAP128): New GCC builtin. * doc/extend.texi (__builtin_bswap128): Document it. * builtins.c (expand_builtin): Deal with BUILT_IN_BSWAP128. (is_inexpensive_builtin): Likewise. * fold-const-call.c (fold_const_call_ss): Likewise. * fold-const.c (tree_call_nonnegative_warnv_p): Likewise. * tree-ssa-ccp.c (evaluate_stmt): Likewise. * tree-vect-stmts.c (vect_get_data_ptr_increment): Likewise. (vectorizable_call): Likewise. * optabs.c (expand_unop): Always use the double word path for it. * tree-core.h (enum tree_index): Add TI_UINT128_TYPE. * tree.h (uint128_type_node): New global type. * tree.c (build_common_tree_nodes): Build it if TImode is supported. gcc/testsuite/ChangeLog: * gcc.dg/builtin-bswap-10.c: New test. * gcc.dg/builtin-bswap-11.c: Likewise. * gcc.dg/builtin-bswap-12.c: Likewise. * gcc.target/i386/builtin-bswap-5.c: Likewise.
2020-05-26Simplify types of TYPE_VALUES in enumeral typesJan Hubicka1-2/+22
streaming code assumes that INTEGER_CST never appears in non-trivial component. This is not true and we sometimes stream such components which sort of silently works but breaks our IL invariant about tree sharing. This patch fixes one instance of this problem where ENUMERAL_TYPE lists all its valids in TYPE_VALUES that with some FEs (like Ada and C++) are having the enumeral type as a type while in other FEs (like C) are simple integer types. I convert them all to integers which also increases chance that they will be shared with other integer constants at stream time. gcc/ * tree.c (free_lang_data_in_type): Simpify types of TYPE_VALUES in enumeral types.
2020-05-18PR middle-end/94940 - spurious -Warray-bounds for a zero length array member ↵Martin Sebor1-10/+18
of union gcc/testsuite/ChangeLog: PR middle-end/94940 * gcc.dg/Warray-bounds-61.c: New test. gcc/ChangeLog: PR middle-end/94940 * tree-vrp.c (vrp_prop::check_mem_ref): Remove unreachable code. * tree.c (component_ref_size): Correct the handling or array members of unions. Drop a pointless test. Rename a local variable.
2020-05-12tree: Add vector_element_bits(_tree) [PR94980 1/3]Richard Sandiford1-0/+24
A lot of code that wants to know the number of bits in a vector element gets that information from the element's TYPE_SIZE, which is always equal to TYPE_SIZE_UNIT * BITS_PER_UNIT. This doesn't work for SVE and AVX512-style packed boolean vectors, where several elements can occupy a single byte. This patch introduces a new pair of helpers for getting the true (possibly sub-byte) size. I made a token attempt to convert obvious element size calculations, but I'm sure I missed some. 2020-05-12 Richard Sandiford <richard.sandiford@arm.com> gcc/ PR tree-optimization/94980 * tree.h (vector_element_bits, vector_element_bits_tree): Declare. * tree.c (vector_element_bits, vector_element_bits_tree): New. * match.pd: Use the new functions instead of determining the vector element size directly from TYPE_SIZE(_UNIT). * tree-vect-data-refs.c (vect_gather_scatter_fn_p): Likewise. * tree-vect-patterns.c (vect_recog_mask_conversion_pattern): Likewise. * tree-vect-stmts.c (vect_is_simple_cond): Likewise. * tree-vect-generic.c (expand_vector_piecewise): Likewise. (expand_vector_conversion): Likewise. (expand_vector_addition): Likewise for a TYPE_SIZE_UNIT used as a divisor. Convert the dividend to bits to compensate. * tree-vect-loop.c (vectorizable_live_operation): Call vector_element_bits instead of open-coding it.
2020-05-09Remove last use of expr_alignEric Botcazou1-45/+0
It was in the ada/gcc-interface repository and is outdated. * tree.h (expr_align): Delete. * tree.c (expr_align): Likewise. ada/ * gcc-interface/utils2.c: Include builtins.h. (known_alignment) <ADDR_EXPR>: Use DECL_ALIGN for DECL_P operands and get_object_alignment for the rest.
2020-05-08tree: Avoid variable sharing in get_narrower [PR94724]Jakub Jelinek1-1/+1
On Thu, May 07, 2020 at 02:45:29PM +0200, Thomas Schwinge wrote: > >>+ for (tree op = win; TREE_CODE (op) == COMPOUND_EXPR; > > ..., and new 'op' variable here. > > >>+ op = TREE_OPERAND (op, 1)) > >>+ v.safe_push (op); > >>+ FOR_EACH_VEC_ELT_REVERSE (v, i, op) > >>+ ret = build2_loc (EXPR_LOCATION (op), COMPOUND_EXPR, > >>+ TREE_TYPE (win), TREE_OPERAND (op, 0), > >>+ ret); > >>+ return ret; > >> } > >> while (TREE_CODE (op) == NOP_EXPR) > >> { There is no reason for the shadowing and op at this point acts as a temporary and will be overwritten in FOR_EACH_VEC_ELT_REVERSE anyway. So, we can just s/tree // here. 2020-05-08 Jakub Jelinek <jakub@redhat.com> PR middle-end/94724 * tree.c (get_narrower): Reuse the op temporary instead of shadowing it.
2020-05-04Revert "tree: Don't reuse types if TYPE_USER_ALIGN differ [PR94775]"Marek Polacek1-3/+1
This reverts commit 6318fe77395fc0dd59419bc4d69cd06ac0158e54. Revert: 2020-04-30 Marek Polacek <polacek@redhat.com> PR c++/94775 * tree.c (check_base_type): Return true only if TYPE_USER_ALIGN match. (check_aligned_type): Check if TYPE_USER_ALIGN match.
2020-04-30tree: Don't reuse types if TYPE_USER_ALIGN differ [PR94775]Marek Polacek1-1/+3
Here we trip on the TYPE_USER_ALIGN (t) assert in strip_typedefs: it gets "const d[0]" with TYPE_USER_ALIGN=0 but the result built by build_cplus_array_type is "const char[0]" with TYPE_USER_ALIGN=1. When we strip_typedefs the element of the array "const d", we see it's a typedef_variant_p, so we look at its DECL_ORIGINAL_TYPE, which is char, but we need to add the const qualifier, so we call cp_build_qualified_type -> build_qualified_type where get_qualified_type checks to see if we already have such a type by walking the variants list, which in this case is: char -> c -> const char -> const char -> d -> const d Because check_base_type only checks TYPE_ALIGN and not TYPE_USER_ALIGN, we choose the first const char, which has TYPE_USER_ALIGN set. If the element type of an array has TYPE_USER_ALIGN, the array type gets it too. So we can make check_base_type stricter. I was afraid that it might make us reuse types less often, but measuring showed that we build the same amount of types with and without the patch, while bootstrapping. PR c++/94775 * tree.c (check_base_type): Return true only if TYPE_USER_ALIGN match. (check_aligned_type): Check if TYPE_USER_ALIGN match. * g++.dg/warn/Warray-bounds-10.C: New test.
2020-04-29lto/94822 - fix ICE in component_ref_sizeRichard Biener1-17/+18
This ICE appears because gcc will stream it to the function_body section when processing the variable with the initial value of the constructor type, and the error_mark_node to the decls section. When recompiling, the value obtained with DECL_INITIAL will be error_mark. 2020-04-29 Richard Biener <rguenther@suse.de> Li Zekun <lizekun1@huawei.com> PR lto/94822 * tree.c (component_ref_size): Guard against error_mark_node DECL_INITIAL as it happens with LTO. * gcc.dg/lto/pr94822_0.c: New testcase. * gcc.dg/lto/pr94822_1.c: Alternate file. * gcc.dg/lto/pr94822.h: Likewise.
2020-04-28tree: Fix up TREE_SIDE_EFFECTS on internal calls [PR94809]Jakub Jelinek1-0/+1
On the following testcase, match.pd during GENERIC folding changes the -1U / x < y into __imag__ .MUL_OVERFLOW (x, y), but unfortunately unlike for normal calls nothing sets TREE_SIDE_EFFECTS on the call. There is the process_call_operands function that non-internal call creation calls and it is usable for internal calls too, e.g. TREE_SIDE_EFFECTS is derived from checking whether the call has side-effects (non-ECF_{CONST,PURE}; we have those for internal calls) and from whether any of the arguments has TREE_SIDE_EFFECTS. 2020-04-28 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/94809 * tree.c (build_call_expr_internal_loc_array): Call process_call_operands. * gcc.c-torture/execute/pr94809.c: New test.
2020-04-23tree: Fix up get_narrower [PR94724]Jakub Jelinek1-8/+12
In the recent get_narrower change, I wanted it to be efficient and avoid recursion if there are many nested COMPOUND_EXPRs. That builds the COMPOUND_EXPR nest with the right arguments, but as build2_loc computes some flags like TREE_SIDE_EFFECTS, TREE_CONSTANT and TREE_READONLY, when it is called with something that will not be the argument in the end, those flags are computed incorrectly. So, this patch instead uses an auto_vec and builds them in the reverse order so when they are built, they are built with the correct operands. 2020-04-23 Jakub Jelinek <jakub@redhat.com> PR middle-end/94724 * tree.c (get_narrower): Instead of creating COMPOUND_EXPRs temporarily with non-final second operand and updating it later, push COMPOUND_EXPRs into a vector and process it in reverse, creating COMPOUND_EXPRs with the final operands. * gcc.c-torture/execute/pr94724.c: New test.
2020-04-04c++: Fix further protected_set_expr_location related -fcompare-debug issues ↵Jakub Jelinek1-24/+14
[PR94441] My recent protected_set_expr_location changes work well when that function is called unconditionally, but as the testcase shows, the C++ FE has a few spots that do: if (!EXPR_HAS_LOCATION (stmt)) protected_set_expr_location (stmt, locus); or similar. Now, if we have for -g0 stmt of some expression that can have location and has != UNKNOWN_LOCATION, while -g instead has a STATEMENT_LIST containing some DEBUG_BEGIN_STMTs + that expression with that location, we don't call protected_set_expr_location in the -g0 case, but do call it in the -g case, because on the STATEMENT_LIST !EXPR_HAS_LOCATION. The following patch introduces a helper function which digs up the single expression of a STATEMENT_LIST and uses that expression in the EXPR_HAS_LOCATION check (plus changes protected_set_expr_location to also use that helper). Or do we want a further wrapper, perhaps C++ FE only, that would do this protected_set_expr_location_if_unset (stmt, locus)? 2020-04-04 Jakub Jelinek <jakub@redhat.com> PR debug/94441 * tree-iterator.h (expr_single): Declare. * tree-iterator.c (expr_single): New function. * tree.h (protected_set_expr_location_if_unset): Declare. * tree.c (protected_set_expr_location): Use expr_single. (protected_set_expr_location_if_unset): New function. * parser.c (cp_parser_omp_for_loop): Use protected_set_expr_location_if_unset. * cp-gimplify.c (genericize_if_stmt, genericize_cp_loop): Likewise. * g++.dg/opt/pr94441.C: New test.
2020-04-03middle-end/94465 - handle released SSA names in array_ref_low_boundRichard Biener1-1/+3
array_ref_low_bound is used in dumping ARRAY_REFs which in turn is called when basic blocks are deleted. cleanup_control_flow_pre consciously decides to remove unreachable basic-blocks in arbitrary order so the following makes array_ref_low_bound forgiving in the case the SSA name with the index definition has been released already. 2020-04-03 Richard Biener <rguenther@suse.de> PR middle-end/94465 * tree.c (array_ref_low_bound): Deal with released SSA names in index position.
2020-03-26tree: Fix -fcompare-debug issues due to protected_set_expr_location [PR94323]Jakub Jelinek1-0/+27
The following testcase FAILs since recently when the C++ FE started calling protected_set_expr_location more often. With -g, it is called on a STATEMENT_LIST that contains a DEBUG_BEGIN_STMT and CLEANUP_POINT_EXPR, and as STATEMENT_LISTs have !CAN_HAVE_LOCATION_P, nothing is set. Without -g, it is called instead on the CLEANUP_POINT_EXPR directly and changes its location. The following patch recurses on the single non-DEBUG_BEGIN_STMT statement of a STATEMENT_LIST if any to make the two behave the same. 2020-03-26 Jakub Jelinek <jakub@redhat.com> PR debug/94323 * tree.c (protected_set_expr_location): Recurse on STATEMENT_LIST that contains exactly one non-DEBUG_BEGIN_STMT statement. * g++.dg/debug/pr94323.C: New test.
2020-03-23c++: Handle COMPOUND_EXPRs in get_narrower and ↵Jakub Jelinek1-0/+15
warnings_for_convert_and_check [PR91993] As the testcases shows, the -Wconversion warning behaves quite differently when -fsanitize=undefined vs. when not sanitizing, but in the end it is not something specific to sanitizing, if a user uses return static_cast<uc>(static_cast<uc>((d++, a) << 1U) | b) | c; instead of return static_cast<uc>(static_cast<uc>(a << 1U) | b) | c; and thus there is some COMPOUND_EXPR involved, cp_build_binary_op behaves significantly different, e.g. shorten_binary_op will have different result (uc for the case without COMPOUND_EXPR, int with it), but it isn't limited to that. > How about improving get_narrower to handle COMPOUND_EXPR? I'd think that > would do the trick without affecting evaluation order. Not completely, had to change also warnings_for_convert_and_check, but with that it works. The float-cast-overflow* changes are needed because now with -O1+ we emit lots of -Woverflow warnings on the testcase, but we do emit those warnings on the testcase even when compiling just with -O1 and without -fsanitize=float-cast-overflow, so it seems to me a change in the right direction, having -fsanitize= or explicit comma expressions smaller effect on the warnings that are emitted. 2020-03-23 Jakub Jelinek <jakub@redhat.com> PR c++/91993 * tree.c (get_narrower): Handle COMPOUND_EXPR by recursing on ultimate rhs and if returned something different, reconstructing the COMPOUND_EXPRs. * c-warn.c (warnings_for_convert_and_check): For expr and/or result being COMPOUND_EXPRs, skip to ultimate rhs. * g++.dg/warn/Wconversion-pr91993.C: New test. * g++.dg/ubsan/pr91993.C: New test. * c-c++-common/ubsan/float-cast-overflow-1.c: Add -Wno-overflow to dg-options. * c-c++-common/ubsan/float-cast-overflow-2.c: Likewise. * c-c++-common/ubsan/float-cast-overflow-4.c: Likewise.
2020-03-17Fix up duplicated duplicated words mostly in commentsJakub Jelinek1-1/+1
In the r10-7197-gbae7b38cf8a21e068ad5c0bab089dedb78af3346 commit I've noticed duplicated word in a message, which lead me to grep for those and we have a tons of them. I've used grep -v 'long long\|optab optab\|template template\|double double' *.[chS] */*.[chS] *.def config/*/* 2>/dev/null | grep ' \([a-zA-Z]\+\) \1 ' Note, the command will not detect the doubled words at the start or end of line or when one of the words is at the end of line and the next one at the start of another one. Some of it is fairly obvious, e.g. all the "the the" cases which is something I've posted and committed patch for already e.g. in 2016, other cases are often valid, e.g. "that that" seems to look mostly ok to me. Some cases are quite hard to figure out, I've left out some of them from the patch (e.g. "and and" in some cases isn't talking about bitwise/logical and and so looks incorrect, but in other cases it is talking about those operations). In most cases the right solution seems to be to remove one of the duplicated words, but not always. I think most important are the ones with user visible messages (in the patch 3 of the first 4 hunks), the rest is just comments (and internal documentation; for that see the doc/tm.texi changes). 2020-03-17 Jakub Jelinek <jakub@redhat.com> * lra-spills.c (remove_pseudos): Fix up duplicated word issue in a dump message. * tree-sra.c (create_access_replacement): Fix up duplicated word issue in a comment. * read-rtl-function.c (find_param_by_name, function_reader::parse_enum_value, function_reader::get_insn_by_uid): Likewise. * spellcheck.c (get_edit_distance_cutoff): Likewise. * tree-data-ref.c (create_ifn_alias_checks): Likewise. * tree.def (SWITCH_EXPR): Likewise. * selftest.c (assert_str_contains): Likewise. * ipa-param-manipulation.h (class ipa_param_body_adjustments): Likewise. * tree-ssa-math-opts.c (convert_expand_mult_copysign): Likewise. * tree-ssa-loop-split.c (find_vdef_in_loop): Likewise. * langhooks.h (struct lang_hooks_for_decls): Likewise. * ipa-prop.h (struct ipa_param_descriptor): Likewise. * tree-ssa-strlen.c (handle_builtin_string_cmp, handle_store): Likewise. * tree-ssa-dom.c (simplify_stmt_for_jump_threading): Likewise. * tree-ssa-reassoc.c (reassociate_bb): Likewise. * tree.c (component_ref_size): Likewise. * hsa-common.c (hsa_init_compilation_unit_data): Likewise. * gimple-ssa-sprintf.c (get_string_length, format_string, format_directive): Likewise. * omp-grid.c (grid_process_kernel_body_copy): Likewise. * input.c (string_concat_db::get_string_concatenation, test_lexer_string_locations_ucn4): Likewise. * cfgexpand.c (pass_expand::execute): Likewise. * gimple-ssa-warn-restrict.c (builtin_memref::offset_out_of_bounds, maybe_diag_overlap): Likewise. * rtl.c (RTX_CODE_HWINT_P_1): Likewise. * shrink-wrap.c (spread_components): Likewise. * tree-ssa-dse.c (initialize_ao_ref_for_dse, valid_ao_ref_for_dse): Likewise. * tree-call-cdce.c (shrink_wrap_one_built_in_call_with_conds): Likewise. * dwarf2out.c (dwarf2out_early_finish): Likewise. * gimple-ssa-store-merging.c: Likewise. * ira-costs.c (record_operand_costs): Likewise. * tree-vect-loop.c (vectorizable_reduction): Likewise. * target.def (dispatch): Likewise. (validate_dims, gen_ccmp_first): Fix up duplicated word issue in documentation text. * doc/tm.texi: Regenerated. * config/i386/x86-tune.def (X86_TUNE_PARTIAL_FLAG_REG_STALL): Fix up duplicated word issue in a comment. * config/i386/i386.c (ix86_test_loading_unspec): Likewise. * config/i386/i386-features.c (remove_partial_avx_dependency): Likewise. * config/msp430/msp430.c (msp430_select_section): Likewise. * config/gcn/gcn-run.c (load_image): Likewise. * config/aarch64/aarch64-sve.md (sve_ld1r<mode>): Likewise. * config/aarch64/aarch64.c (aarch64_gen_adjusted_ldpstp): Likewise. * config/aarch64/falkor-tag-collision-avoidance.c (single_dest_per_chain): Likewise. * config/nvptx/nvptx.c (nvptx_record_fndecl): Likewise. * config/fr30/fr30.c (fr30_arg_partial_bytes): Likewise. * config/rs6000/rs6000-string.c (expand_cmp_vec_sequence): Likewise. * config/rs6000/rs6000-p8swap.c (replace_swapped_load_constant): Likewise. * config/rs6000/rs6000-c.c (rs6000_target_modify_macros): Likewise. * config/rs6000/rs6000.c (rs6000_option_override_internal): Likewise. * config/rs6000/rs6000-logue.c (rs6000_emit_probe_stack_range_stack_clash): Likewise. * config/nds32/nds32-md-auxiliary.c (nds32_split_ashiftdi3): Likewise. Fix various other issues in the comment. c-family/ * c-common.c (resolve_overloaded_builtin): Fix up duplicated word issue in a diagnostic message. cp/ * pt.c (tsubst): Fix up duplicated word issue in a diagnostic message. (lookup_template_class_1, tsubst_expr): Fix up duplicated word issue in a comment. * parser.c (cp_parser_statement, cp_parser_linkage_specification, cp_parser_placeholder_type_specifier, cp_parser_constraint_requires_parens): Likewise. * name-lookup.c (suggest_alternative_in_explicit_scope): Likewise. fortran/ * array.c (gfc_check_iter_variable): Fix up duplicated word issue in a comment. * arith.c (gfc_arith_concat): Likewise. * resolve.c (gfc_resolve_ref): Likewise. * frontend-passes.c (matmul_lhs_realloc): Likewise. * module.c (gfc_match_submodule, load_needed): Likewise. * trans-expr.c (gfc_init_se): Likewise.
2020-03-11Fix GIMPLE verification failure in LTO mode on Ada codeEric Botcazou1-0/+10
The issue is that tree_is_indexable doesn't return the same result for a FIELD_DECL with QUAL_UNION_TYPE and the QUAL_UNION_TYPE, resulting in two instances of the QUAL_UNION_TYPE in the bytecode. The result for the type is the correct one (false, since it is variably modified) while the result for the field is falsely true because: else if (TREE_CODE (t) == FIELD_DECL && lto_variably_modified_type_p (DECL_CONTEXT (t))) return false; is not satisfied. The reason for this is that the DECL_QUALIFIER of fields of a QUAL_UNION_TYPE depends on a discriminant in Ada, which means that the size of the type does too (CONTAINS_PLACEHOLDER_P), which in turn means that it is reset to a mere PLACEHOLDER_EXPR by free_lang_data, which finally means that the size of DECL_CONTEXT is too, so RETURN_TRUE_IF_VAR is false. In other words, the CONTAINS_PLACEHOLDER_P property of the DECL_QUALIFIER of fields of a QUAL_UNION_TYPE hides the variably_modified_type_p property of these fields, if you look from the outside. PR middle-end/93961 * tree.c (variably_modified_type_p) <RECORD_TYPE>: Recurse into fields whose type is a qualified union.
2020-02-18Typo fixes - functoin -> function [PR93796]Jakub Jelinek1-1/+1
2020-02-18 Jakub Jelinek <jakub@redhat.com> PR driver/93796 * params.opt (-param=ipa-max-switch-predicate-bounds=): Fix help typo, functoin -> function. * tree.c (free_lang_data_in_decl): Fix comment typo, functoin -> function. * ipa-visibility.c (cgraph_externally_visible_p): Likewise.
2020-01-26checking: avoid verify_type_variant crash on incomplete type.Jason Merrill1-1/+1
Here, we end up calling gen_type_die_with_usage for a type that's in the middle of finish_struct_1, after we set TYPE_NEEDS_CONSTRUCTING on it but before we copy all the flags to the variants--and, significantly, before we set its TYPE_SIZE. It seems reasonable to only look at TYPE_NEEDS_CONSTRUCTING on complete types, since we aren't going to try to create an object of an incomplete type any other way. PR c++/92601 * tree.c (verify_type_variant): Only verify TYPE_NEEDS_CONSTRUCTING of complete types.
2020-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r279813
2019-12-13PR middle-end/91582 - missing heap overflow detection for strcpyMartin Sebor1-4/+4
PR middle-end/91582 - missing heap overflow detection for strcpy PR middle-end/92868 - ICE: tree check: expected integer_cst, have ssa_name gcc/ChangeLog: PR middle-end/91582 PR middle-end/92868 * builtins.c (addr_decl_size): New function. (gimple_call_alloc_size): Add arguments. (compute_objsize): Add an argument. Set *PDECL even for allocated objects. Correct checking for negative wide_int. Correct handling of negative outer offsets into unknown regions or with unknown inner offsets. Extend offsets to at most sizetype precision. Only handle constant subobject sizes. * builtins.h (gimple_call_alloc_size): Add arguments. * tree.c (component_ref_size): Always return sizetype. * tree-ssa-strlen.c (strinfo::alloc): New member. (get_addr_stridx): Add argument. (get_stridx): Use ptrdiff_t. Add argument. (new_strinfo): Set new member. (get_string_length): Handle alloca and VLA. (dump_strlen_info): Dump more state. (maybe_invalidate): Print more info. Decrease indentation. (unshare_strinfo): Set new member. (valid_builtin_call): Handle alloca and VLA. (maybe_warn_overflow): Check and set no-warning bit. Improve handling of offsets. Print allocated objects. (handle_builtin_strlen): Handle strinfo records with null lengths. (handle_builtin_strcpy): Add argument. Call maybe_warn_overflow. (is_strlen_related_p): Handle dynamically allocated objects. (get_range): Add argument. (handle_builtin_malloc): Rename... (handle_alloc): ...to this and handle all allocation functions. (handle_builtin_memset): Call maybe_warn_overflow. (count_nonzero_bytes): Handle more MEM_REF forms. (strlen_check_and_optimize_call): Call handle_alloc_call. Pass arguments to more callees. (handle_integral_assign): Add argument. Create strinfo entries for MEM_REF assignments. (check_and_optimize_stmt): Handle more MEM_REF forms. gcc/testsuite/ChangeLog: PR middle-end/91582 * c-c++-common/Wrestrict.c: Adjust expected warnings. * gcc/testsuite/c-c++-common/Wstringop-truncation-4.c: Enable more warnings. * gcc/testsuite/c-c++-common/Wstringop-truncation.c: Remove an xfail. * gcc.dg/Warray-bounds-46.c: Disable -Wstringop-overflow. * gcc.dg/Warray-bounds-47.c: Same. * gcc.dg/Warray-bounds-52.c: New test. * gcc.dg/Wstringop-overflow-27.c: New test. * gcc.dg/Wstringop-overflow-28.c: New test. * gcc.dg/Wstringop-overflow-29.c: New test. * gcc.dg/attr-alloc_size.c (test): Disable -Warray-bounds. * gcc.dg/attr-copy-2.c: Adjust expected warnings. * gcc.dg/builtin-stringop-chk-5.c: Adjust text of expected messages. * gcc.dg/strlenopt-86.c: Relax test. * gcc.target/i386/pr82002-1.c: Prune expected warnings. From-SVN: r279392
2019-12-09tree.c (build_array_type_1): Add SET_CANONICAL parameter and compute ↵Eric Botcazou1-15/+12
TYPE_CANONICAL from the element type... * tree.c (build_array_type_1): Add SET_CANONICAL parameter and compute TYPE_CANONICAL from the element type only if it is true. Remove a few obsolete lines and adjust recursive call. (fld_process_array_type): Adjust call to build_array_type_1. (build_array_type): Likewise. (build_nonshared_array_type): Likewise. From-SVN: r279133
2019-12-01Fix bugs relating to flexibly-sized objects in nios2 backend.Sandra Loosemore1-0/+35
2019-12-01 Sandra Loosemore <sandra@codesourcery.com> Fix bugs relating to flexibly-sized objects in nios2 backend. PR target/92499 gcc/c/ * c-decl.c (flexible_array_type_p): Move to common code. gcc/ * config/nios2/nios2.c (nios2_in_small_data_p): Do not consider objects of flexible types to be small if they have internal linkage or are declared extern. * config/nios2/nios2.h (ASM_OUTPUT_ALIGNED_LOCAL): Replace with... (ASM_OUTPUT_ALIGNED_DECL_LOCAL): ...this. Use targetm.in_small_data_p instead of the size of the object initializer. * tree.c (flexible_array_type_p): Move from C front end, and generalize to handle fields in non-C structures. * tree.h (flexible_array_type_p): Declare. gcc/testsuite/ * gcc.target/nios2/pr92499-1.c: New. * gcc.target/nios2/pr92499-2.c: New. * gcc.target/nios2/pr92499-3.c: New. From-SVN: r278891
2019-11-30[C] Add a target hook that allows targets to verify type usageRichard Sandiford1-0/+15
This patch adds a new target hook to check whether there are any target-specific reasons why a type cannot be used in a certain source-language context. It works in a similar way to existing hooks like TARGET_INVALID_CONVERSION and TARGET_INVALID_UNARY_OP. The reason for adding the hook is to report invalid uses of SVE types. Throughout a TU, the SVE vector and predicate types represent values that can be stored in an SVE vector or predicate register. At certain points in the TU we might be able to generate code that assumes the registers have a particular size, but often we can't. In some cases we might even make multiple different assumptions in the same TU (e.g. when implementing an ifunc for multiple vector lengths). But SVE types themselves are the same type throughout. The register size assumptions change how we generate code, but they don't change the definition of the types. This means that the types do not have a fixed size at the C level even when -msve-vector-bits=N is in effect. It also means that the size does not work in the same way as for C VLAs, where the abstract machine evaluates the size at a particular point and then carries that size forward to later code. The SVE ACLE deals with this by making it invalid to use C and C++ constructs that depend on the size or layout of SVE types. The spec refers to the types as "sizeless" types and defines their semantics as edits to the standards. See: https://gcc.gnu.org/ml/gcc-patches/2018-10/msg00868.html for a fuller description and: https://gcc.gnu.org/ml/gcc/2019-11/msg00088.html for a recent update on the status. However, since all current sizeless types are target-specific built-in types, there's no real reason for the frontends to handle them directly. They can just hand off the checks to target code instead. It's then possible for the errors to refer to "SVE types" rather than "sizeless types", which is likely to be more meaningful to users. There is a slight overlap between the new tests and the ones for gnu_vector_type_p in r277950, but here the emphasis is on testing sizelessness. 2019-11-30 Richard Sandiford <richard.sandiford@arm.com> gcc/ * target.h (type_context_kind): New enum. (verify_type_context): Declare. * target.def (verify_type_context): New target hook. * doc/tm.texi.in (TARGET_VERIFY_TYPE_CONTEXT): Likewise. * doc/tm.texi: Regenerate. * tree.c (verify_type_context): New function. * config/aarch64/aarch64-protos.h (aarch64_sve::verify_type_context): Declare. * config/aarch64/aarch64-sve-builtins.cc (verify_type_context): New function. * config/aarch64/aarch64.c (aarch64_verify_type_context): Likewise. (TARGET_VERIFY_TYPE_CONTEXT): Define. gcc/c-family/ * c-common.c (pointer_int_sum): Use verify_type_context to check whether the target allows pointer arithmetic for the types involved. (c_sizeof_or_alignof_type, c_alignof_expr): Use verify_type_context to check whether the target allows sizeof and alignof operations for the types involved. gcc/c/ * c-decl.c (start_decl): Allow initialization of variables whose size is a POLY_INT_CST. (finish_decl): Use verify_type_context to check whether the target allows variables with a particular type to have static or thread-local storage duration. Don't raise a second error if such variables do not have a constant size. (grokdeclarator): Use verify_type_context to check whether the target allows fields or array elements to have a particular type. * c-typeck.c (pointer_diff): Use verify_type_context to test whether the target allows pointer difference for the types involved. (build_unary_op): Likewise for pointer increment and decrement. gcc/testsuite/ * gcc.target/aarch64/sve/acle/general-c/sizeless-1.c: New test. * gcc.target/aarch64/sve/acle/general-c/sizeless-2.c: Likewise. From-SVN: r278877
2019-11-29Remove unused decimal floating-point pointer typesJulian Brown1-3/+0
gcc/ * builtin-types.def (BT_DFLOAT32_PTR, BT_DFLOAT64_PTR, BT_DFLOAT128_PTR) Remove. * tree-core.h (TI_DFLOAT32_PTR_TYPE, TI_DFLOAT64_PTR_TYPE, TI_DFLOAT128_PTR_TYPE): Remove. * tree.c (build_common_type_nodes): Remove dfloat32_ptr_type_node, dfloat64_ptr_type_node and dfloat128_ptr_type_node initialisation. * tree.h (dfloat32_ptr_type_node, dfloat64_ptr_type_node, dfloat128_ptr_type_node): Remove macros. gcc/jit/ * jit-builtins.c (BT_DFLOAT32_PTR, BT_DFLOAT64_PTR, BT_DFLOAT128_PTR): Remove commented-out cases. Reviewed-by: Joseph Myers <joseph@codesourcery.com> From-SVN: r278826
2019-11-25Prevent all uses of DFP when unsupported (PR c/91985).Joseph Myers1-17/+20
Code that directly uses _Decimal* types on architectures not supporting DFP is properly diagnosed ("error: decimal floating-point not supported for this target"), via a call to targetm.decimal_float_supported_p, if the _Decimal32, _Decimal64 or _Decimal128 keywords are used to access it. Use via mode attributes is also diagnosed ("unable to emulate 'SD'"); so is use of the FLOAT_CONST_DECIMAL64 pragma. However, it is possible to access those types via typeof applied to constants or built-in functions without such an error. I expect that there are ways to get an ICE from this; certainly it uses a completely undefined ABI. This patch arranges for the types not to exist in the compiler at all when DFP is not supported. As is done with unsupported _FloatN / _FloatNx types, the global tree nodes are left as NULL_TREE, and the built-in function machinery is made to use error_mark_node for them in that case in builtin-types.def, so that the built-in functions are unavailable. Code handling constants is adjusted to give an error, and other code that might not work with the global tree nodes being NULL_TREE is also updated. Bootstrapped with no regressions for x86_64-pc-linux-gnu. Also tested with no regressions for cross to aarch64-linux-gnu, as a configuration without DFP support. PR c/91985 gcc: * builtin-types.def (BT_DFLOAT32, BT_DFLOAT64, BT_DFLOAT128) (BT_DFLOAT32_PTR, BT_DFLOAT64_PTR, BT_DFLOAT128_PTR): Define to error_mark_node if corresponding global tree node is NULL. * tree.c (build_common_tree_nodes): Do not initialize dfloat32_type_node, dfloat64_type_node or dfloat128_type_node if decimal floating-point not supported. gcc/c: * c-decl.c (finish_declspecs): Use int instead of decimal floating-point types if decimal floating-point not supported. gcc/c-family: * c-common.c (c_common_type_for_mode): Handle decimal floating-point types being NULL_TREE. * c-format.c (get_format_for_type_1): Handle specified types being NULL_TREE. * c-lex.c (interpret_float): Give an error for decimal floating-point constants when decimal floating-point not supported. gcc/lto: * lto-lang.c (lto_type_for_mode): Handle decimal floating-point types being NULL_TREE. gcc/testsuite: * gcc.dg/c2x-no-dfp-1.c, gcc.dg/gnu2x-builtins-no-dfp-1.c: New tests. * gcc.dg/fltconst-pedantic-dfp.c: Expect errors when decimal floating-point not supported. From-SVN: r278684
2019-11-18Add an empty constructor shortcut to build_vector_from_ctorRichard Sandiford1-0/+3
Empty vector constructors are equivalent to zero vectors. If we handle that case directly, we can support it for variable-length vectors and can hopefully make things more efficient for fixed-length vectors. This is needed by a later C++ patch. 2019-11-18 Richard Sandiford <richard.sandiford@arm.com> gcc/ * tree.c (build_vector_from_ctor): Directly return a zero vector for empty constructors. From-SVN: r278413
2019-11-14Pass the data vector mode to get_mask_modeRichard Sandiford1-4/+4
This patch passes the data vector mode to get_mask_mode, rather than its size and nunits. This is a bit simpler and allows targets to distinguish between modes that happen to have the same size and number of elements. 2019-11-14 Richard Sandiford <richard.sandiford@arm.com> gcc/ * target.def (get_mask_mode): Take a vector mode itself as argument, instead of properties about the vector mode. * doc/tm.texi: Regenerate. * targhooks.h (default_get_mask_mode): Update to reflect new get_mode_mask interface. * targhooks.c (default_get_mask_mode): Likewise. Use related_int_vector_mode. * optabs-query.c (can_vec_mask_load_store_p): Update call to get_mask_mode. * tree-vect-stmts.c (check_load_store_masking): Likewise, checking first that the original mode really is a vector. * tree.c (build_truth_vector_type_for): Likewise. * config/aarch64/aarch64.c (aarch64_get_mask_mode): Update for new get_mode_mask interface. (aarch64_expand_sve_vcond): Update call accordingly. * config/gcn/gcn.c (gcn_vectorize_get_mask_mode): Update for new get_mode_mask interface. * config/i386/i386.c (ix86_get_mask_mode): Likewise. From-SVN: r278233
2019-11-14Remove build_{same_sized_,}truth_vector_typeRichard Sandiford1-21/+9
build_same_sized_truth_vector_type was confusingly named, since for SVE and AVX512 the returned vector isn't the same byte size (although it does have the same number of elements). What it really returns is the "truth" vector type for a given data vector type. The more general truth_type_for provides the same thing when passed a vector and IMO has a more descriptive name, so this patch replaces all uses of build_same_sized_truth_vector_type with that. It does the same for a call to build_truth_vector_type, leaving truth_type_for itself as the only remaining caller. It's then more natural to pass build_truth_vector_type the original vector type rather than its size and nunits, especially since the given size isn't the size of the returned vector. This in turn allows a future patch to simplify the interface of get_mask_mode. Doing this also fixes a bug in which truth_type_for would pass a size of zero for BLKmode vector types. 2019-11-14 Richard Sandiford <richard.sandiford@arm.com> gcc/ * tree.h (build_truth_vector_type): Delete. (build_same_sized_truth_vector_type): Likewise. * tree.c (build_truth_vector_type): Rename to... (build_truth_vector_type_for): ...this. Make static and take a vector type as argument. (truth_type_for): Update accordingly. (build_same_sized_truth_vector_type): Delete. * tree-vect-generic.c (expand_vector_divmod): Use truth_type_for instead of build_same_sized_truth_vector_type. * tree-vect-loop.c (vect_create_epilog_for_reduction): Likewise. (vect_record_loop_mask, vect_get_loop_mask): Likewise. * tree-vect-patterns.c (build_mask_conversion): Likeise. * tree-vect-slp.c (vect_get_constant_vectors): Likewise. * tree-vect-stmts.c (vect_get_vec_def_for_operand): Likewise. (vect_build_gather_load_calls, vectorizable_call): Likewise. (scan_store_can_perm_p, vectorizable_scan_store): Likewise. (vectorizable_store, vectorizable_condition): Likewise. (get_mask_type_for_scalar_type, get_same_sized_vectype): Likewise. (vect_get_mask_type_for_stmt): Use truth_type_for instead of build_truth_vector_type. * config/aarch64/aarch64-sve-builtins.cc (gimple_folder::convert_pred): Use truth_type_for instead of build_same_sized_truth_vector_type. * config/rs6000/rs6000-call.c (fold_build_vec_cmp): Likewise. gcc/c/ * c-typeck.c (build_conditional_expr): Use truth_type_for instead of build_same_sized_truth_vector_type. (build_vec_cmp): Likewise. gcc/cp/ * call.c (build_conditional_expr_1): Use truth_type_for instead of build_same_sized_truth_vector_type. * typeck.c (build_vec_cmp): Likewise. gcc/d/ * d-codegen.cc (build_boolop): Use truth_type_for instead of build_same_sized_truth_vector_type. From-SVN: r278232
2019-11-14Add build_truth_vector_type_for_modeRichard Sandiford1-11/+22
Callers of vect_halve_mask_nunits and vect_double_mask_nunits already know what mode the resulting vector type should have, so we might as well create the vector type directly with that mode, just like build_vector_type_for_mode lets us build normal vectors with a known mode. This avoids the current awkwardness of having to recompute the mode starting from vec_info::vector_size, which hard-codes the assumption that all vectors have to be the same size. A later patch gets rid of build_truth_vector_type and build_same_sized_truth_vector_type, so the net effect of the series is to reduce the number of type functions by one. 2019-11-14 Richard Sandiford <richard.sandiford@arm.com> gcc/ * tree.h (build_truth_vector_type_for_mode): Declare. * tree.c (build_truth_vector_type_for_mode): New function, split out from... (build_truth_vector_type): ...here. (build_opaque_vector_type): Fix head comment. * tree-vectorizer.h (supportable_narrowing_operation): Remove vec_info parameter. (vect_halve_mask_nunits): Replace vec_info parameter with the mode of the new vector. (vect_double_mask_nunits): Likewise. * tree-vect-loop.c (vect_halve_mask_nunits): Likewise. (vect_double_mask_nunits): Likewise. * tree-vect-loop-manip.c: Include insn-config.h, rtl.h and recog.h. (vect_maybe_permute_loop_masks): Remove vinfo parameter. Update call to vect_halve_mask_nunits, getting the required mode from the unpack patterns. (vect_set_loop_condition_masked): Update call accordingly. * tree-vect-stmts.c (supportable_narrowing_operation): Remove vec_info parameter and update call to vect_double_mask_nunits. (vectorizable_conversion): Update call accordingly. (simple_integer_narrowing): Likewise. Remove vec_info parameter. (vectorizable_call): Update call accordingly. (supportable_widening_operation): Update call to vect_halve_mask_nunits. * config/aarch64/aarch64-sve-builtins.cc (register_builtin_types): Use build_truth_vector_type_mode instead of build_truth_vector_type. From-SVN: r278231
2019-11-12Remove gcc/params.* files.Martin Liska1-1/+0
2019-11-12 Martin Liska <mliska@suse.cz> * Makefile.in: Remove PARAMS_H and params.list and params.options. * params-enum.h: Remove. * params-list.h: Remove. * params-options.h: Remove. * params.c: Remove. * params.def: Remove. * params.h: Remove. * asan.c: Do not include params.h. * auto-profile.c: Likewise. * bb-reorder.c: Likewise. * builtins.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfgloopanal.c: Likewise. * cgraph.c: Likewise. * combine.c: Likewise. * common/config/aarch64/aarch64-common.c: Likewise. * common/config/gcn/gcn-common.c: Likewise. * common/config/ia64/ia64-common.c: Likewise. * common/config/powerpcspe/powerpcspe-common.c: Likewise. * common/config/rs6000/rs6000-common.c: Likewise. * common/config/sh/sh-common.c: Likewise. * config/aarch64/aarch64.c: Likewise. * config/alpha/alpha.c: Likewise. * config/arm/arm.c: Likewise. * config/avr/avr.c: Likewise. * config/csky/csky.c: Likewise. * config/i386/i386-builtins.c: Likewise. * config/i386/i386-expand.c: Likewise. * config/i386/i386-features.c: Likewise. * config/i386/i386-options.c: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/rs6000/rs6000-logue.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/s390/s390.c: Likewise. * config/sparc/sparc.c: Likewise. * config/visium/visium.c: Likewise. * coverage.c: Likewise. * cprop.c: Likewise. * cse.c: Likewise. * cselib.c: Likewise. * dse.c: Likewise. * emit-rtl.c: Likewise. * explow.c: Likewise. * final.c: Likewise. * fold-const.c: Likewise. * gcc.c: Likewise. * gcse.c: Likewise. * ggc-common.c: Likewise. * ggc-page.c: Likewise. * gimple-loop-interchange.cc: Likewise. * gimple-loop-jam.c: Likewise. * gimple-loop-versioning.cc: Likewise. * gimple-ssa-split-paths.c: Likewise. * gimple-ssa-sprintf.c: Likewise. * gimple-ssa-store-merging.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-ssa-warn-alloca.c: Likewise. * gimple-ssa-warn-restrict.c: Likewise. * graphite-isl-ast-to-gimple.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-scop-detection.c: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * haifa-sched.c: Likewise. * hsa-gen.c: Likewise. * ifcvt.c: Likewise. * ipa-cp.c: Likewise. * ipa-fnsummary.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline.c: Likewise. * ipa-polymorphic-call.c: Likewise. * ipa-profile.c: Likewise. * ipa-prop.c: Likewise. * ipa-split.c: Likewise. * ipa-sra.c: Likewise. * ira-build.c: Likewise. * ira-conflicts.c: Likewise. * loop-doloop.c: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lra-assigns.c: Likewise. * lra-constraints.c: Likewise. * modulo-sched.c: Likewise. * opt-suggestions.c: Likewise. * opts.c: Likewise. * postreload-gcse.c: Likewise. * predict.c: Likewise. * reload.c: Likewise. * reorg.c: Likewise. * resource.c: Likewise. * sanopt.c: Likewise. * sched-deps.c: Likewise. * sched-ebb.c: Likewise. * sched-rgn.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched.c: Likewise. * shrink-wrap.c: Likewise. * stmt.c: Likewise. * targhooks.c: Likewise. * toplev.c: Likewise. * tracer.c: Likewise. * trans-mem.c: Likewise. * tree-chrec.c: Likewise. * tree-data-ref.c: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-parloops.c: Likewise. * tree-predcom.c: Likewise. * tree-profile.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-dse.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-scopedtables.c: Likewise. * tree-ssa-sink.c: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-threadbackward.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * value-prof.c: Likewise. * var-tracking.c: Likewise. 2019-11-12 Martin Liska <mliska@suse.cz> * gimple-parser.c: Do not include params.h. 2019-11-12 Martin Liska <mliska@suse.cz> * name-lookup.c: Do not include params.h. * typeck.c: Likewise. 2019-11-12 Martin Liska <mliska@suse.cz> * lto-common.c: Do not include params.h. * lto-partition.c: Likewise. * lto.c: Likewise. From-SVN: r278086
2019-11-12Apply mechanical replacement (generated patch).Martin Liska1-11/+12
2019-11-12 Martin Liska <mliska@suse.cz> * asan.c (asan_sanitize_stack_p): Replace old parameter syntax with the new one, include opts.h if needed. Use SET_OPTION_IF_UNSET macro. (asan_sanitize_allocas_p): Likewise. (asan_emit_stack_protection): Likewise. (asan_protect_global): Likewise. (instrument_derefs): Likewise. (instrument_builtin_call): Likewise. (asan_expand_mark_ifn): Likewise. * auto-profile.c (auto_profile): Likewise. * bb-reorder.c (copy_bb_p): Likewise. (duplicate_computed_gotos): Likewise. * builtins.c (inline_expand_builtin_string_cmp): Likewise. * cfgcleanup.c (try_crossjump_to_edge): Likewise. (try_crossjump_bb): Likewise. * cfgexpand.c (defer_stack_allocation): Likewise. (stack_protect_classify_type): Likewise. (pass_expand::execute): Likewise. * cfgloopanal.c (expected_loop_iterations_unbounded): Likewise. (estimate_reg_pressure_cost): Likewise. * cgraph.c (cgraph_edge::maybe_hot_p): Likewise. * combine.c (combine_instructions): Likewise. (record_value_for_reg): Likewise. * common/config/aarch64/aarch64-common.c (aarch64_option_validate_param): Likewise. (aarch64_option_default_params): Likewise. * common/config/ia64/ia64-common.c (ia64_option_default_params): Likewise. * common/config/powerpcspe/powerpcspe-common.c (rs6000_option_default_params): Likewise. * common/config/rs6000/rs6000-common.c (rs6000_option_default_params): Likewise. * common/config/sh/sh-common.c (sh_option_default_params): Likewise. * config/aarch64/aarch64.c (aarch64_output_probe_stack_range): Likewise. (aarch64_allocate_and_probe_stack_space): Likewise. (aarch64_expand_epilogue): Likewise. (aarch64_override_options_internal): Likewise. * config/alpha/alpha.c (alpha_option_override): Likewise. * config/arm/arm.c (arm_option_override): Likewise. (arm_valid_target_attribute_p): Likewise. * config/i386/i386-options.c (ix86_option_override_internal): Likewise. * config/i386/i386.c (get_probe_interval): Likewise. (ix86_adjust_stack_and_probe_stack_clash): Likewise. (ix86_max_noce_ifcvt_seq_cost): Likewise. * config/ia64/ia64.c (ia64_adjust_cost): Likewise. * config/rs6000/rs6000-logue.c (get_stack_clash_protection_probe_interval): Likewise. (get_stack_clash_protection_guard_size): Likewise. * config/rs6000/rs6000.c (rs6000_option_override_internal): Likewise. * config/s390/s390.c (allocate_stack_space): Likewise. (s390_emit_prologue): Likewise. (s390_option_override_internal): Likewise. * config/sparc/sparc.c (sparc_option_override): Likewise. * config/visium/visium.c (visium_option_override): Likewise. * coverage.c (get_coverage_counts): Likewise. (coverage_compute_profile_id): Likewise. (coverage_begin_function): Likewise. (coverage_end_function): Likewise. * cse.c (cse_find_path): Likewise. (cse_extended_basic_block): Likewise. (cse_main): Likewise. * cselib.c (cselib_invalidate_mem): Likewise. * dse.c (dse_step1): Likewise. * emit-rtl.c (set_new_first_and_last_insn): Likewise. (get_max_insn_count): Likewise. (make_debug_insn_raw): Likewise. (init_emit): Likewise. * explow.c (compute_stack_clash_protection_loop_data): Likewise. * final.c (compute_alignments): Likewise. * fold-const.c (fold_range_test): Likewise. (fold_truth_andor): Likewise. (tree_single_nonnegative_warnv_p): Likewise. (integer_valued_real_single_p): Likewise. * gcse.c (want_to_gcse_p): Likewise. (prune_insertions_deletions): Likewise. (hoist_code): Likewise. (gcse_or_cprop_is_too_expensive): Likewise. * ggc-common.c: Likewise. * ggc-page.c (ggc_collect): Likewise. * gimple-loop-interchange.cc (MAX_NUM_STMT): Likewise. (MAX_DATAREFS): Likewise. (OUTER_STRIDE_RATIO): Likewise. * gimple-loop-jam.c (tree_loop_unroll_and_jam): Likewise. * gimple-loop-versioning.cc (loop_versioning::max_insns_for_loop): Likewise. * gimple-ssa-split-paths.c (is_feasible_trace): Likewise. * gimple-ssa-store-merging.c (imm_store_chain_info::try_coalesce_bswap): Likewise. (imm_store_chain_info::coalesce_immediate_stores): Likewise. (imm_store_chain_info::output_merged_store): Likewise. (pass_store_merging::process_store): Likewise. * gimple-ssa-strength-reduction.c (find_basis_for_base_expr): Likewise. * graphite-isl-ast-to-gimple.c (class translate_isl_ast_to_gimple): Likewise. (scop_to_isl_ast): Likewise. * graphite-optimize-isl.c (get_schedule_for_node_st): Likewise. (optimize_isl): Likewise. * graphite-scop-detection.c (build_scops): Likewise. * haifa-sched.c (set_modulo_params): Likewise. (rank_for_schedule): Likewise. (model_add_to_worklist): Likewise. (model_promote_insn): Likewise. (model_choose_insn): Likewise. (queue_to_ready): Likewise. (autopref_multipass_dfa_lookahead_guard): Likewise. (schedule_block): Likewise. (sched_init): Likewise. * hsa-gen.c (init_prologue): Likewise. * ifcvt.c (bb_ok_for_noce_convert_multiple_sets): Likewise. (cond_move_process_if_block): Likewise. * ipa-cp.c (ipcp_lattice::add_value): Likewise. (merge_agg_lats_step): Likewise. (devirtualization_time_bonus): Likewise. (hint_time_bonus): Likewise. (incorporate_penalties): Likewise. (good_cloning_opportunity_p): Likewise. (ipcp_propagate_stage): Likewise. * ipa-fnsummary.c (decompose_param_expr): Likewise. (set_switch_stmt_execution_predicate): Likewise. (analyze_function_body): Likewise. (compute_fn_summary): Likewise. * ipa-inline-analysis.c (estimate_growth): Likewise. * ipa-inline.c (caller_growth_limits): Likewise. (inline_insns_single): Likewise. (inline_insns_auto): Likewise. (can_inline_edge_by_limits_p): Likewise. (want_early_inline_function_p): Likewise. (big_speedup_p): Likewise. (want_inline_small_function_p): Likewise. (want_inline_self_recursive_call_p): Likewise. (edge_badness): Likewise. (recursive_inlining): Likewise. (compute_max_insns): Likewise. (early_inliner): Likewise. * ipa-polymorphic-call.c (csftc_abort_walking_p): Likewise. * ipa-profile.c (ipa_profile): Likewise. * ipa-prop.c (determine_known_aggregate_parts): Likewise. (ipa_analyze_node): Likewise. (ipcp_transform_function): Likewise. * ipa-split.c (consider_split): Likewise. * ipa-sra.c (allocate_access): Likewise. (process_scan_results): Likewise. (ipa_sra_summarize_function): Likewise. (pull_accesses_from_callee): Likewise. * ira-build.c (loop_compare_func): Likewise. (mark_loops_for_removal): Likewise. * ira-conflicts.c (build_conflict_bit_table): Likewise. * loop-doloop.c (doloop_optimize): Likewise. * loop-invariant.c (gain_for_invariant): Likewise. (move_loop_invariants): Likewise. * loop-unroll.c (decide_unroll_constant_iterations): Likewise. (decide_unroll_runtime_iterations): Likewise. (decide_unroll_stupid): Likewise. (expand_var_during_unrolling): Likewise. * lra-assigns.c (spill_for): Likewise. * lra-constraints.c (EBB_PROBABILITY_CUTOFF): Likewise. * modulo-sched.c (sms_schedule): Likewise. (DFA_HISTORY): Likewise. * opts.c (default_options_optimization): Likewise. (finish_options): Likewise. (common_handle_option): Likewise. * postreload-gcse.c (eliminate_partially_redundant_load): Likewise. (if): Likewise. * predict.c (get_hot_bb_threshold): Likewise. (maybe_hot_count_p): Likewise. (probably_never_executed): Likewise. (predictable_edge_p): Likewise. (predict_loops): Likewise. (expr_expected_value_1): Likewise. (tree_predict_by_opcode): Likewise. (handle_missing_profiles): Likewise. * reload.c (find_equiv_reg): Likewise. * reorg.c (redundant_insn): Likewise. * resource.c (mark_target_live_regs): Likewise. (incr_ticks_for_insn): Likewise. * sanopt.c (pass_sanopt::execute): Likewise. * sched-deps.c (sched_analyze_1): Likewise. (sched_analyze_2): Likewise. (sched_analyze_insn): Likewise. (deps_analyze_insn): Likewise. * sched-ebb.c (schedule_ebbs): Likewise. * sched-rgn.c (find_single_block_region): Likewise. (too_large): Likewise. (haifa_find_rgns): Likewise. (extend_rgns): Likewise. (new_ready): Likewise. (schedule_region): Likewise. (sched_rgn_init): Likewise. * sel-sched-ir.c (make_region_from_loop): Likewise. * sel-sched-ir.h (MAX_WS): Likewise. * sel-sched.c (process_pipelined_exprs): Likewise. (sel_setup_region_sched_flags): Likewise. * shrink-wrap.c (try_shrink_wrapping): Likewise. * targhooks.c (default_max_noce_ifcvt_seq_cost): Likewise. * toplev.c (print_version): Likewise. (process_options): Likewise. * tracer.c (tail_duplicate): Likewise. * trans-mem.c (tm_log_add): Likewise. * tree-chrec.c (chrec_fold_plus_1): Likewise. * tree-data-ref.c (split_constant_offset): Likewise. (compute_all_dependences): Likewise. * tree-if-conv.c (MAX_PHI_ARG_NUM): Likewise. * tree-inline.c (remap_gimple_stmt): Likewise. * tree-loop-distribution.c (MAX_DATAREFS_NUM): Likewise. * tree-parloops.c (MIN_PER_THREAD): Likewise. (create_parallel_loop): Likewise. * tree-predcom.c (determine_unroll_factor): Likewise. * tree-scalar-evolution.c (instantiate_scev_r): Likewise. * tree-sra.c (analyze_all_variable_accesses): Likewise. * tree-ssa-ccp.c (fold_builtin_alloca_with_align): Likewise. * tree-ssa-dse.c (setup_live_bytes_from_ref): Likewise. (dse_optimize_redundant_stores): Likewise. (dse_classify_store): Likewise. * tree-ssa-ifcombine.c (ifcombine_ifandif): Likewise. * tree-ssa-loop-ch.c (ch_base::copy_headers): Likewise. * tree-ssa-loop-im.c (LIM_EXPENSIVE): Likewise. * tree-ssa-loop-ivcanon.c (try_unroll_loop_completely): Likewise. (try_peel_loop): Likewise. (tree_unroll_loops_completely): Likewise. * tree-ssa-loop-ivopts.c (avg_loop_niter): Likewise. (CONSIDER_ALL_CANDIDATES_BOUND): Likewise. (MAX_CONSIDERED_GROUPS): Likewise. (ALWAYS_PRUNE_CAND_SET_BOUND): Likewise. * tree-ssa-loop-manip.c (can_unroll_loop_p): Likewise. * tree-ssa-loop-niter.c (MAX_ITERATIONS_TO_TRACK): Likewise. * tree-ssa-loop-prefetch.c (PREFETCH_BLOCK): Likewise. (L1_CACHE_SIZE_BYTES): Likewise. (L2_CACHE_SIZE_BYTES): Likewise. (should_issue_prefetch_p): Likewise. (schedule_prefetches): Likewise. (determine_unroll_factor): Likewise. (volume_of_references): Likewise. (add_subscript_strides): Likewise. (self_reuse_distance): Likewise. (mem_ref_count_reasonable_p): Likewise. (insn_to_prefetch_ratio_too_small_p): Likewise. (loop_prefetch_arrays): Likewise. (tree_ssa_prefetch_arrays): Likewise. * tree-ssa-loop-unswitch.c (tree_unswitch_single_loop): Likewise. * tree-ssa-math-opts.c (gimple_expand_builtin_pow): Likewise. (convert_mult_to_fma): Likewise. (math_opts_dom_walker::after_dom_children): Likewise. * tree-ssa-phiopt.c (cond_if_else_store_replacement): Likewise. (hoist_adjacent_loads): Likewise. (gate_hoist_loads): Likewise. * tree-ssa-pre.c (translate_vuse_through_block): Likewise. (compute_partial_antic_aux): Likewise. * tree-ssa-reassoc.c (get_reassociation_width): Likewise. * tree-ssa-sccvn.c (vn_reference_lookup_pieces): Likewise. (vn_reference_lookup): Likewise. (do_rpo_vn): Likewise. * tree-ssa-scopedtables.c (avail_exprs_stack::lookup_avail_expr): Likewise. * tree-ssa-sink.c (select_best_block): Likewise. * tree-ssa-strlen.c (new_stridx): Likewise. (new_addr_stridx): Likewise. (get_range_strlen_dynamic): Likewise. (class ssa_name_limit_t): Likewise. * tree-ssa-structalias.c (push_fields_onto_fieldstack): Likewise. (create_variable_info_for_1): Likewise. (init_alias_vars): Likewise. * tree-ssa-tail-merge.c (find_clusters_1): Likewise. (tail_merge_optimize): Likewise. * tree-ssa-threadbackward.c (thread_jumps::profitable_jump_thread_path): Likewise. (thread_jumps::fsm_find_control_statement_thread_paths): Likewise. (thread_jumps::find_jump_threads_backwards): Likewise. * tree-ssa-threadedge.c (record_temporary_equivalences_from_stmts_at_dest): Likewise. * tree-ssa-uninit.c (compute_control_dep_chain): Likewise. * tree-switch-conversion.c (switch_conversion::check_range): Likewise. (jump_table_cluster::can_be_handled): Likewise. * tree-switch-conversion.h (jump_table_cluster::case_values_threshold): Likewise. (SWITCH_CONVERSION_BRANCH_RATIO): Likewise. (param_switch_conversion_branch_ratio): Likewise. * tree-vect-data-refs.c (vect_mark_for_runtime_alias_test): Likewise. (vect_enhance_data_refs_alignment): Likewise. (vect_prune_runtime_alias_test_list): Likewise. * tree-vect-loop.c (vect_analyze_loop_costing): Likewise. (vect_get_datarefs_in_loop): Likewise. (vect_analyze_loop): Likewise. * tree-vect-slp.c (vect_slp_bb): Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c (find_switch_asserts): Likewise. (vrp_prop::check_mem_ref): Likewise. * tree.c (wide_int_to_tree_1): Likewise. (cache_integer_cst): Likewise. * var-tracking.c (EXPR_USE_DEPTH): Likewise. (reverse_op): Likewise. (vt_find_locations): Likewise. 2019-11-12 Martin Liska <mliska@suse.cz> * gimple-parser.c (c_parser_parse_gimple_body): Replace old parameter syntax with the new one, include opts.h if needed. Use SET_OPTION_IF_UNSET macro. 2019-11-12 Martin Liska <mliska@suse.cz> * name-lookup.c (namespace_hints::namespace_hints): Replace old parameter syntax with the new one, include opts.h if needed. Use SET_OPTION_IF_UNSET macro. * typeck.c (comptypes): Likewise. 2019-11-12 Martin Liska <mliska@suse.cz> * lto-partition.c (lto_balanced_map): Replace old parameter syntax with the new one, include opts.h if needed. Use SET_OPTION_IF_UNSET macro. * lto.c (do_whole_program_analysis): Likewise. From-SVN: r278085
2019-11-09tree.c (fld_incomplete_type_of): Clear TYPE_FINAL_P, TYPE_EMPTY_P, ↵Jan Hubicka1-1/+10
ENUM_IS_OPAQUE and ENUM_IS_SCOPED. * tree.c (fld_incomplete_type_of): Clear TYPE_FINAL_P, TYPE_EMPTY_P, ENUM_IS_OPAQUE and ENUM_IS_SCOPED. (free_lang_data_in_binfo): Clear TREE_PUBLIC in BINFO (free_lang_data_in_type): Clear ENUM_IS_OPAQUE and ENUM_IS_SCOPED. From-SVN: r278008
2019-11-07optc-save-gen.awk: Generate cl_target_option_free and ↵Jan Hubicka1-0/+4
cl_optimization_option_free. * optc-save-gen.awk: Generate cl_target_option_free and cl_optimization_option_free. * opth-en.awk: Declare cl_target_option_free and cl_optimization_option_free. * tree.c (free_node): Use it. From-SVN: r277926
2019-11-05PR tree-optimization/92373 - ICE in -Warray-bounds on access to member array ↵Martin Sebor1-22/+27
in an initialized char buffer gcc/testsuite/ChangeLog: PR tree-optimization/92373 * gcc.dg/Warray-bounds-55.c: New test. * gcc.dg/Wzero-length-array-bounds-2.c: New test. gcc/ChangeLog: PR tree-optimization/92373 * tree.c (component_ref_size): Only consider initializers of objects of matching struct types. Return null for instances of interior zero-length arrays. From-SVN: r277871
2019-11-01PR middle-end/91679 - missing -Warray-bounds accessing a member array in a ↵Martin Sebor1-31/+194
local buffer PR middle-end/91679 - missing -Warray-bounds accessing a member array in a local buffer PR middle-end/91647 - new FAILs for Warray-bounds-8 and Wstringop-overflow-3.C PR middle-end/91463 - missing -Warray-bounds accessing past the end of a statically initialized flexible array member PR middle-end/92312 - bogus -Wstringop-overflow storing into a trailing array backed by larger buffer gcc/ChangeLog: PR middle-end/91679 PR middle-end/91647 PR middle-end/91463 PR middle-end/92312 * c-family/c-pretty-print.c (direct_abstract_declarator): Print bound in zero-length arrays. * gcc/c-family/c.opt (-Wzero-length-bounds): New option. * gcc/doc/invoke.texi (-Wzero-length-bounds): Document. * gimple-match-head.c (try_conditional_simplification): Use memcpy instead of a hand-rolled loop to avoid PR 92323. * tree-vrp.c (vrp_prop::check_array_ref): Handle trailing arrays with initializers. (vrp_prop::check_mem_ref): Handle declared struct objects. * tree.c (last_field): New function. (array_at_struct_end_p): Handle MEM_REF. (get_initializer_for): New helper. (component_ref_size): Add argument. Rename locals. Call get_initializer_for instead of fold_ctor_reference. Correct handling of flexible array members. * wide-int.h (generic_wide_int <storage>::sign_mask): Assert invariant. gcc/testsuite/ChangeLog: PR middle-end/91679 PR middle-end/91647 PR middle-end/91463 PR middle-end/92312 * c-c++-common/Warray-bounds-2.c: Disable VRP. Adjust expected messages. * g++.dg/warn/Warray-bounds-8.C: Remove xfails. * gcc.dg/Warray-bounds-48.c: New test. * gcc.dg/Warray-bounds-49.c: New test. * gcc.dg/Wstringop-overflow-16.c: Adjust text of expected messages. * gcc.dg/Wstringop-overflow-21.c: New test. * gcc.dg/Wzero-length-array-bounds.c: New test. * gcc.dg/pr36902.c: Remove xfail. * gcc.dg/strlenopt-57.c: Add an expected warning. From-SVN: r277728
2019-10-31re PR middle-end/92231 (ICE in gimple_fold_stmt_to_constant_1)Jakub Jelinek1-1/+2
PR middle-end/92231 * tree.h (fndecl_built_in_p): Use fndecl_built_in_p instead of DECL_BUILT_IN in comment. Remove redundant ()s around return argument. * tree.c (free_lang_data_in_decl): Check if var is FUNCTION_DECL before calling fndecl_built_in_p. * gimple-fold.c (gimple_fold_stmt_to_constant_1): Check if TREE_OPERAND (fn, 0) is a FUNCTION_DECL before calling fndecl_built_in_p on it. lto/ * lto-lang.c (handle_const_attribute): Don't call fndecl_built_in_p on *node that is not FUNCTION_DECL. testsuite/ * gcc.c-torture/compile/pr92231.c: New test. From-SVN: r277660
2019-10-31re PR c++/90947 (Simple lookup table of array of strings is miscompiled)Jakub Jelinek1-67/+0
PR c++/90947 * tree.h (type_initializer_zero_p): Remove. * tree.c (type_initializer_zero_p): Remove. cp/ * cp-tree.h (type_initializer_zero_p): Declare. * decl.c (reshape_init_array_1): Formatting fix. * tree.c (type_initializer_zero_p): New function. Moved from ../tree.c, use next_initializable_field, formatting fix. Return false for TYPE_NON_AGGREGATE_CLASS types. From-SVN: r277656
2019-10-30Come up with an abstraction.Martin Liska1-279/+0
2019-10-30 Martin Liska <mliska@suse.cz> * fold-const.c (operand_equal_p): Move to ... (operand_compare::operand_equal_p): ... here. (operand_compare::verify_hash_value): New. (add_expr): Move to ... (operand_compare::hash_operand): ... here. * fold-const.h (operand_equal_p): Move to the class. (class operand_compare): New. * tree.c (add_expr): Remove. From-SVN: r277614
2019-10-30operand_equal_p: add support for OBJ_TYPE_REF.Martin Liska1-0/+6
2019-10-30 Martin Liska <mliska@suse.cz> * fold-const.c (operand_equal_p): Support OBJ_TYPE_REF. * tree.c (add_expr): Hash parts of OBJ_TYPE_REF. From-SVN: r277612
2019-10-25Fix typo in dump_tree_statistics.Martin Liska1-1/+1
2019-10-25 Martin Liska <mliska@suse.cz> * tree.c (dump_tree_statistics): Use sorted index 'j' and not 'i'. From-SVN: r277440
2019-10-19Implement C++20 P1301 [[nodiscard("should have a reason")]].JeanHeyd Meneide1-16/+1
2019-10-17 JeanHeyd Meneide <phdofthehouse@gmail.com> gcc/ * escaped_string.h (escaped_string): New header. * tree.c (escaped_string): Remove escaped_string class. gcc/c-family * c-lex.c (c_common_has_attribute): Update nodiscard value. gcc/cp/ * tree.c (handle_nodiscard_attribute) Added C++2a nodiscard string message. (std_attribute_table) Increase nodiscard argument handling max_length from 0 to 1. * parser.c (cp_parser_check_std_attribute): Add requirement that nodiscard only be seen once in attribute-list. (cp_parser_std_attribute): Check that empty parenthesis lists are not specified for attributes that have max_length > 0 (e.g. [[attr()]]). * cvt.c (maybe_warn_nodiscard): Add nodiscard message to output, if applicable. (convert_to_void): Allow constructors to be nodiscard-able (P1771). gcc/testsuite/g++.dg/cpp0x * gen-attrs-67.C: Test new error message for empty-parenthesis-list. gcc/testsuite/g++.dg/cpp2a * nodiscard-construct.C: New test. * nodiscard-once.C: New test. * nodiscard-reason-nonstring.C: New test. * nodiscard-reason-only-one.C: New test. * nodiscard-reason.C: New test. Reviewed-by: Jason Merrill <jason@redhat.com> From-SVN: r277200
2019-10-04re PR debug/91968 (DW_AT_low_pc missing for DW_TAG_label with LTO)Richard Biener1-2/+3
2019-10-04 Richard Biener <rguenther@suse.de> PR lto/91968 * tree.c (find_decls_types_r): Do not remove LABEL_DECLs from BLOCK_VARS. From-SVN: r276571
2019-09-19PR middle-end/91631 - buffer overflow into an array member of a declared ↵Martin Sebor1-0/+70
object not detected gcc/ChangeLog: PR middle-end/91631 * builtins.c (component_size): Correct trailing array computation, rename to component_ref_size and move... (compute_objsize): Adjust. * gimple-ssa-warn-restrict.c (builtin_memref::refsize): New member. (builtin_access::strict): Do not consider mememmove. (builtin_access::write_off): New function. (builtin_memref::builtin_memref): Initialize refsize. (builtin_memref::set_base_and_offset): Adjust refoff and compute refsize. (builtin_memref::offset_out_of_bounds): Use ooboff input values. Handle refsize. (builtin_access::builtin_access): Intialize dstoff to destination refeence offset here instead of in maybe_diag_overlap. Adjust referencess even to unrelated objects. Adjust sizrange of bounded string functions to reflect bound. For strcat, adjust destination sizrange by that of source. (builtin_access::strcat_overlap): Adjust offsets and sizes to reflect the increase in destination sizrange above. (builtin_access::overlap): Do not set dstoff here but instead in builtin_access::builtin_access. (check_bounds_or_overlap): Use builtin_access::write_off. (maybe_diag_access_bounds): Add argument. Add informational notes. (dump_builtin_memref, dump_builtin_access): New functions. * tree.c (component_ref_size): ...to here. * tree.h (component_ref_size): Declare. * tree-ssa-strlen (handle_builtin_strcat): Include the terminating nul in the size of the source string. gcc/testsuite/ChangeLog: PR middle-end/91631 * /c-c++-common/Warray-bounds-3.c: Correct expected offsets. * /c-c++-common/Warray-bounds-4.c: Same. * gcc.dg/Warray-bounds-39.c: Remove xfails. * gcc.dg/Warray-bounds-45.c: New test. * gcc.dg/Warray-bounds-46.c: New test. From-SVN: r275981