aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
AgeCommit message (Collapse)AuthorFilesLines
2020-11-27Daily bump.GCC Administrator1-0/+9
2020-11-26C: Do not drop qualifiers in typeof for _Atomic types. [PR65455,PR92935]Martin Uecker1-9/+0
2020-11-25 Martin Uecker <muecker@gwdg.de> gcc/c/ PR c/65455 PR c/92935 * c-parser.c (c_parser_declaration_or_fndef): Remove redundant code to drop qualifiers of _Atomic types for __auto_type. (c_parser_typeof_specifier): Do not drop qualifiers of _Atomic types for __typeof__. gcc/ PR c/65455 PR c/92935 * ginclude/stdatomic.h: Use comma operator to drop qualifiers. gcc/testsuite/ PR c/65455 PR c/92935 * gcc.dg/typeof-2.c: Adapt test.
2020-11-25Daily bump.GCC Administrator1-0/+7
2020-11-24openmp: Fix C ICE on OpenMP atomicsJakub Jelinek1-3/+7
c_parser_binary_expression was using build2 to create a temporary holder for binary expression that c_parser_atomic and c_finish_omp_atomic can then handle. The latter performs then all the needed checking. Unfortunately, build2 performs some checking too, e.g. PLUS_EXPR vs. POINTER_PLUS_EXPR or matching types of the arguments, nothing we can guarantee at the parsing time. So we need something like C++ build_min_nt*. This patch implements that inline. 2020-11-24 Jakub Jelinek <jakub@redhat.com> PR c/97958 * c-parser.c (c_parser_binary_expression): For omp atomic binary expressions, use make_node instead of build2 to avoid checking build2 performs. * c-c++-common/gomp/pr97958.c: New test.
2020-11-24Daily bump.GCC Administrator1-0/+6
2020-11-23c: Allow comparison of pointers to complete and incomplete types for C11 ↵Joseph Myers1-2/+2
[PR95630] As noted in bug 95630, C11 removed a restriction in C99 on comparing pointers to compatible complete and incomplete types (this was one of the changes in N1439, which was largely a terminological change to make incomplete types a subset of object types rather than a different kind of type). Implement that change by using pedwarn_c99 with OPT_Wpedantic for this diagnostic. Bootstrapped with no regressions for x86_64-pc-linux-gnu. gcc/c/ 2020-11-23 Joseph Myers <joseph@codesourcery.com> PR c/95630 * c-typeck.c (build_binary_op): Use pedwarn_c99 with OPT_Wpedantic for comparisons of complete and incomplete pointers. gcc/testsuite/ 2020-11-23 Joseph Myers <joseph@codesourcery.com> PR c/95630 * gcc.dg/c11-compare-incomplete-1.c, gcc.dg/c11-compare-incomplete-2.c, gcc.dg/c99-compare-incomplete-1.c, gcc.dg/c99-compare-incomplete-2.c: New tests.
2020-11-22Daily bump.GCC Administrator1-0/+4
2020-11-21Additional small changes to support opaque modesAaron Sawdey1-0/+1
After building some larger codes using opaque types and some c++ codes using opaque types it became clear I needed to go through and look for places where opaque types and modes needed to be handled. A whole pile of one-liners. gcc/ * typeclass.h: Add opaque_type_class. * builtins.c (type_to_class): Identify opaque type class. * dwarf2out.c (is_base_type): Handle opaque types. (gen_type_die_with_usage): Handle opaque types. * expr.c (count_type_elements): Opaque types should never have initializers. * ipa-devirt.c (odr_types_equivalent_p): No type-specific handling for opaque types is needed as it eventually checks the underlying mode which is what is important. * tree-streamer.c (record_common_node): Handle opaque types. * tree.c (type_contains_placeholder_1): Handle opaque types. (type_cache_hasher::equal): No additional comparison needed for opaque types. gcc/c-family * c-pretty-print.c (c_pretty_printer::simple_type_specifier): Treat opaque types like other types. (c_pretty_printer::direct_abstract_declarator): Opaque types are supported types. gcc/c * c-aux-info.c (gen_type): Support opaque types. gcc/cp * error.c (dump_type): Handle opaque types. (dump_type_prefix): Handle opaque types. (dump_type_suffix): Handle opaque types. (dump_expr): Handle opaque types. * pt.c (tsubst): Allow opaque types in templates. (unify): Allow opaque types in templates. * typeck.c (structural_comptypes): Handle comparison of opaque types.
2020-11-21Daily bump.GCC Administrator1-0/+15
2020-11-20PR middle-end/97879 - ICE on invalid mode in attribute accessMartin Sebor1-1/+2
gcc/c-family/ChangeLog: PR middle-end/97879 * c-attribs.c (handle_access_attribute): Handle ATTR_FLAG_INTERNAL. Error out on invalid modes. gcc/c/ChangeLog: PR middle-end/97879 * c-decl.c (start_function): Set ATTR_FLAG_INTERNAL in flags. gcc/ChangeLog: PR middle-end/97879 * tree-core.h (enum attribute_flags): Add ATTR_FLAG_INTERNAL. gcc/testsuite/ChangeLog: PR middle-end/97879 * gcc.dg/attr-access-3.c: New test.
2020-11-20configury: Fix up --enable-link-serialization supportJakub Jelinek1-2/+2
Eric reported that the --enable-link-serialization changes seemed to cause the binaries to be always relinked, for example from the gcc/ directory of the build tree: make [relink of gnat1, brig1, cc1plus, d21, f951, go1, lto1, ...] make [relink of gnat1, brig1, cc1plus, d21, f951, go1, lto1, ...] Furthermore as reported in PR, it can cause problems during make install where make install rebuilds the binaries again. The problem is that for make .PHONY targets are just "rebuilt" always, so it is very much undesirable for the cc1plus$(exeext) etc. dependencies to include .PHONY targets, but I was using them - cc1plus.prev which would depend on some *.serial and e.g. cc1.serial depending on c and c depending on cc1$(exeext). The following patch rewrites this so that *.serial and *.prev aren't .PHONY targets, but instead just make variables. I was worried that the order in which the language makefile fragments are included (which is quite random, what order we get from the filesystem matching */config-lang.in) would be a problem but it seems to work fine - as it uses make = rather than := variables, later definitions are just fine for earlier uses as long as the uses aren't needed during the makefile parsing, but only in the dependencies of make targets and in their commands. 2020-11-20 Jakub Jelinek <jakub@redhat.com> PR other/97911 gcc/ * configure.ac: In SERIAL_LIST use lang words without .serial suffix. Change $lang.prev from a target to variable and instead of depending on *.serial expand to the *.serial variable if the word is in the SERIAL_LIST at all, otherwise to nothing. * configure: Regenerated. gcc/c/ * Make-lang.in (c.serial): Change from goal to a variable. (.PHONY): Drop c.serial. gcc/ada/ * gcc-interface/Make-lang.in (ada.serial): Change from goal to a variable. (.PHONY): Drop ada.serial and ada.prev. (gnat1$(exeext)): Depend on $(ada.serial) rather than ada.serial. gcc/brig/ * Make-lang.in (brig.serial): Change from goal to a variable. (.PHONY): Drop brig.serial and brig.prev. (brig1$(exeext)): Depend on $(brig.serial) rather than brig.serial. gcc/cp/ * Make-lang.in (c++.serial): Change from goal to a variable. (.PHONY): Drop c++.serial and c++.prev. (cc1plus$(exeext)): Depend on $(c++.serial) rather than c++.serial. gcc/d/ * Make-lang.in (d.serial): Change from goal to a variable. (.PHONY): Drop d.serial and d.prev. (d21$(exeext)): Depend on $(d.serial) rather than d.serial. gcc/fortran/ * Make-lang.in (fortran.serial): Change from goal to a variable. (.PHONY): Drop fortran.serial and fortran.prev. (f951$(exeext)): Depend on $(fortran.serial) rather than fortran.serial. gcc/go/ * Make-lang.in (go.serial): Change from goal to a variable. (.PHONY): Drop go.serial and go.prev. (go1$(exeext)): Depend on $(go.serial) rather than go.serial. gcc/jit/ * Make-lang.in (jit.serial): Change from goal to a variable. (.PHONY): Drop jit.serial and jit.prev. ($(LIBGCCJIT_FILENAME)): Depend on $(jit.serial) rather than jit.serial. gcc/lto/ * Make-lang.in (lto1.serial, lto2.serial): Change from goals to variables. (.PHONY): Drop lto1.serial, lto2.serial, lto1.prev and lto2.prev. ($(LTO_EXE)): Depend on $(lto1.serial) rather than lto1.serial. ($(LTO_DUMP_EXE)): Depend on $(lto2.serial) rather than lto2.serial. gcc/objc/ * Make-lang.in (objc.serial): Change from goal to a variable. (.PHONY): Drop objc.serial and objc.prev. (cc1obj$(exeext)): Depend on $(objc.serial) rather than objc.serial. gcc/objcp/ * Make-lang.in (obj-c++.serial): Change from goal to a variable. (.PHONY): Drop obj-c++.serial and obj-c++.prev. (cc1objplus$(exeext)): Depend on $(obj-c++.serial) rather than obj-c++.serial.
2020-11-20C: Drop qualifiers during lvalue conversion [PR97702]Martin Uecker1-0/+3
2020-11-20 Martin Uecker <muecker@gwdg.de> gcc/ * gimplify.c (gimplify_modify_expr_rhs): Optimizie NOP_EXPRs that contain compound literals. gcc/c/ * c-typeck.c (convert_lvalue_to_rvalue): Drop qualifiers. gcc/testsuite/ * gcc.dg/cond-constqual-1.c: Adapt test. * gcc.dg/lvalue-11.c: New test. * gcc.dg/pr60195.c: Add warning.
2020-11-20Daily bump.GCC Administrator1-0/+6
2020-11-19c, tree: Fix ICE from get_parm_array_spec [PR97860]Jakub Jelinek1-0/+2
The C and C++ FEs handle zero sized arrays differently, C uses NULL TYPE_MAX_VALUE on non-NULL TYPE_DOMAIN on complete ARRAY_TYPEs with bitsize_zero_node TYPE_SIZE, while C++ FE likes to set TYPE_MAX_VALUE to the largest value (and min to the lowest). Martin has used array_type_nelts in get_parm_array_spec where the function on the C form of [0] arrays returns error_mark_node and the code crashes soon afterwards. The following patch teaches array_type_nelts about this (e.g. dwarf2out already handles that as [0]). While it will change what is_empty_type returns for certain types (e.g. struct S { int a[0]; };), as those types occupy zero bits in C, it should make an ABI difference. So, the tree.c change makes the c-decl.c code handle the [0] arrays like any other constant extents, and the c-decl.c change just makes sure that if we'd run into error_mark_node e.g. from the VLA expressions, we don't crash on those. 2020-11-19 Jakub Jelinek <jakub@redhat.com> PR c/97860 * tree.c (array_type_nelts): For complete arrays with zero min and NULL max and zero size return -1. * c-decl.c (get_parm_array_spec): Bail out of nelts is error_operand_p. * gcc.dg/pr97860.c: New test.
2020-11-19Daily bump.GCC Administrator1-0/+6
2020-11-18configury: --enable-link-serialization supportJakub Jelinek1-1/+4
When performing LTO bootstraps, especially when using tmpfs for /tmp, one can run a machine to halt when using higher levels of parallelism and a large number of FEs, because there are too many concurrent LTO link commands running at the same time and each one of them puts most of the middle-end/backend objects into /tmp. We have --enable-link-mutex configure option, but --enable-link-mutex has a big problem that it decreases number of available jobs by the number of link commands waiting for the lock, so e.g. when doing make -j32 build with 11 different big programs linked with $(LLINKER) we end up with just 22 effective jobs, and with e.g. make -j8 with those 11 different big programs we actually most likely serialize everything during linking onto a single job. The following patch implements a new configure option, --enable-link-serialization, which implements different serialization and as it doesn't use the mutex, just modifying the old option to be implemented differently would be strange. We can deprecate and later remove the old option. The new option doesn't use any shell mutexes, but uses make dependencies. The option is implemented inside of gcc/ configure and Makefiles, which means that even inside of gcc/ make all (as well as e.g. make lto-dump) will serialize and build all previous large binaries when configured this way. One can always make -j32 cc1 DO_LINK_SERIALIZATION= to avoid that. Furthermore, I've implemented the idea I wrote about, so that --enable-link-serialization is the same as --enable-link-serialization=1 and means the large link commands are serialized, one can (the default) --disable-link-serialization which will cause all links to be parallelizable, but one can also --enable-link-serialization=3 etc. which says that at most 3 of the large link commands can run concurrently. And finally I've implemented (only if the serialization is enabled) simple progress bars for the linking. With --enable-link-serialization and e.g. the 5 large links I have in my current tree (cc1, cc1plus, f951, lto1 and lto-dump), before the linking it prints Linking |==-- | 20% and after it Linking |==== | 40% (each == characters stand for already finished links, each -- characters stand for the link being started). With --enable-link-serialization=3 it will change the way the start is printed, one will get: Linking |-- | 0% at the start of cc1 link, Linking |>>-- | 0% at the start of the second large link and Linking |>>>>-- | 0% at the start of the third large link, where the >> characters stand for already pending links. The printing at the end of link command is the same as with the full serialization, i.e. for the above 3: Linking |== | 20% Linking |==== | 40% Linking |====== | 60% but one could actually get them in any order depending on which of those 3 finishes first - to get it 100% accurate I'd need to add some directory with files representing finished links or similar, doesn't seem worth it. 2020-11-18 Jakub Jelinek <jakub@redhat.com> gcc/ * configure.ac: Add $lang.prev rules, INDEX.$lang and SERIAL_LIST and SERIAL_COUNT variables to Make-hooks. (--enable-link-serialization): New configure option. * Makefile.in (DO_LINK_SERIALIZATION, LINK_PROGRESS): New variables. * doc/install.texi (--enable-link-serialization): Document. * configure: Regenerated. gcc/c/ * Make-lang.in (c.serial): New goal. (.PHONY): Add c.serial c.prev. (cc1$(exeext)): Call LINK_PROGRESS. gcc/cp/ * Make-lang.in (c++.serial): New goal. (.PHONY): Add c++.serial c++.prev. (cc1plus$(exeext)): Depend on c++.prev. Call LINK_PROGRESS. gcc/fortran/ * Make-lang.in (fortran.serial): New goal. (.PHONY): Add fortran.serial fortran.prev. (f951$(exeext)): Depend on fortran.prev. Call LINK_PROGRESS. gcc/lto/ * Make-lang.in (lto, lto1.serial, lto2.serial): New goals. (.PHONY): Add lto lto1.serial lto1.prev lto2.serial lto2.prev. (lto.all.cross, lto.start.encap): Remove dependencies. ($(LTO_EXE)): Depend on lto1.prev. Call LINK_PROGRESS. ($(LTO_DUMP_EXE)): Depend on lto2.prev. Call LINK_PROGRESS. gcc/objc/ * Make-lang.in (objc.serial): New goal. (.PHONY): Add objc.serial objc.prev. (cc1obj$(exeext)): Depend on objc.prev. Call LINK_PROGRESS. gcc/objcp/ * Make-lang.in (obj-c++.serial): New goal. (.PHONY): Add obj-c++.serial obj-c++.prev. (cc1objplus$(exeext)): Depend on obj-c++.prev. Call LINK_PROGRESS. gcc/ada/ * gcc-interface/Make-lang.in (ada.serial): New goal. (.PHONY): Add ada.serial ada.prev. (gnat1$(exeext)): Depend on ada.prev. Call LINK_PROGRESS. gcc/brig/ * Make-lang.in (brig.serial): New goal. (.PHONY): Add brig.serial brig.prev. (brig1$(exeext)): Depend on brig.prev. Call LINK_PROGRESS. gcc/go/ * Make-lang.in (go.serial): New goal. (.PHONY): Add go.serial go.prev. (go1$(exeext)): Depend on go.prev. Call LINK_PROGRESS. gcc/jit/ * Make-lang.in (jit.serial): New goal. (.PHONY): Add jit.serial jit.prev. ($(LIBGCCJIT_FILENAME)): Depend on jit.prev. Call LINK_PROGRESS. gcc/d/ * Make-lang.in (d.serial): New goal. (.PHONY): Add d.serial d.prev. (d21$(exeext)): Depend on d.prev. Call LINK_PROGRESS.
2020-11-14Daily bump.GCC Administrator1-0/+18
2020-11-13[PATCH] Implementation of asm goto outputsVladimir N. Makarov2-8/+1
gcc/ * cfgexpand.c (expand_asm_stmt): Output asm goto with outputs too. Place insns after asm goto on edges. * doc/extend.texi: Reflect the changes in asm goto documentation. * gimple.c (gimple_build_asm_1): Remove an assert checking output absence for asm goto. * gimple.h (gimple_asm_label_op, gimple_asm_set_label_op): Take possible asm goto outputs into account. * ira.c (ira): Remove critical edges for potential asm goto output reloads. (ira_nullify_asm_goto): New function. * ira.h (ira_nullify_asm_goto): New prototype. * lra-assigns.c (lra_split_hard_reg_for): Use ira_nullify_asm_goto. Check that splitting is done inside a basic block. * lra-constraints.c (curr_insn_transform): Permit output reloads for any jump insn. * lra-spills.c (lra_final_code_change): Remove USEs added in ira for asm gotos. * lra.c (lra_process_new_insns): Place output reload insns after jumps in the beginning of destination BBs. * reload.c (find_reloads): Report error for asm gotos with outputs. Modify them to keep CFG consistency to avoid crashes. * tree-into-ssa.c (rewrite_stmt): Don't put debug stmt after asm goto. gcc/c/ * c-parser.c (c_parser_asm_statement): Parse outputs for asm goto too. * c-typeck.c (build_asm_expr): Remove an assert checking output absence for asm goto. gcc/cp * parser.c (cp_parser_asm_definition): Parse outputs for asm goto too. gcc/testsuite/ * c-c++-common/asmgoto-2.c: Permit output in asm goto. * gcc.c-torture/compile/asmgoto-2.c: New. * gcc.c-torture/compile/asmgoto-3.c: New. * gcc.c-torture/compile/asmgoto-4.c: New. * gcc.c-torture/compile/asmgoto-5.c: New.
2020-11-13openmp: Support allocate for C/C++ array section reductionsJakub Jelinek1-1/+2
This adds allocate clause support for array section reductions. Furthermore, it fixes one bug that would cause inscan reductions with allocate to be rejected by C, and for now just ignores allocate for inscan/task reductions, that will need slightly more work. 2020-11-13 Jakub Jelinek <jakub@redhat.com> gcc/ * omp-low.c (scan_sharing_clauses): For now remove for reduction clauses with inscan or task modifiers decl from allocate_map. (lower_private_allocate): Handle TYPE_P (new_var). (lower_rec_input_clauses): Handle allocate clause for C/C++ array reductions. gcc/c/ * c-typeck.c (c_finish_omp_clauses): Don't clear OMP_CLAUSE_REDUCTION_INSCAN unless reduction_seen == -2. libgomp/ * testsuite/libgomp.c-c++-common/allocate-1.c (foo): Add tests for array reductions. (main): Adjust foo callers.
2020-11-13C-family, Objective-C [1/3] : Implement Wobjc-root-class [PR77404].Iain Sandoe1-1/+2
This warning catches the case that the user has left the superclass specification from a class interface. Root classes are, of course, permitted and an attribute is added to mark these so that the diagnostic is suppressed. The warning and attribute spellings have been kept in sync with the language reference implementation (clang). The diagnostic location information present in the objective-c interface and class definitions is relatively poor. This patch adds a location for the class name to the interface and makes use of it in existing warnings. Part 1 is the changes to code and added tests. Many entries in the testsuite make use of root classes so there are a large number of mechanical changes there adding "-Wno-objc-root-class" to the options. The test changes are parts 2 (objective-c) and 3 (objective-c++) in the patch series. gcc/c-family/ChangeLog: PR objc/77404 * c-attribs.c (handle_objc_root_class_attribute): New * c-objc.h (objc_start_class_interface): Add a location value for the position of the class name. * c.opt: Add Wobjc-root-class. * stub-objc.c (objc_start_class_interface): Add a location value for the position of the class name. gcc/c/ChangeLog: PR objc/77404 * c-parser.c (c_parser_objc_class_definition): Pass the location of the class name to the interface declaration. gcc/cp/ChangeLog: PR objc/77404 * parser.c (cp_parser_objc_class_interface): Pass the location of the class name to the interface declaration. gcc/objc/ChangeLog: PR objc/77404 * objc-act.c (objc_start_class_interface): Accept the location of the class name, use it in existing diagnostic. (start_class): Accept obj_root_class type attributes. Warn when the interface for an implementation does not contain a super class (unless the diagnostic is suppressed by the the command line flag or the objc_root_class type attribute). gcc/testsuite/ChangeLog: PR objc/77404 * objc.dg/attributes/root-class-01.m: New test. * objc.dg/root-class-00.m: New test. * obj-c++.dg/attributes/root-class-01.mm: New test. * obj-c++.dg/root-class-00.mm: New test. gcc/ChangeLog: PR objc/77404 * doc/extend.texi: Document the objc_root_class attribute. * doc/invoke.texi: Document -Wobjc-root-class.
2020-11-11Daily bump.GCC Administrator1-0/+18
2020-11-10Refactor copying decl section namesStrager Neds1-1/+1
gcc/ * cgraph.h (symtab_node::get_section): Constify. (symtab_node::set_section): Declare new overload. * symtab.c (symtab_node::set_section): Define new overload. (symtab_node::copy_visibility_from): Use new overload of symtab_node::set_section. (symtab_node::resolve_alias): Same. * tree.h (set_decl_section_name): Declare new overload. * tree.c (set_decl_section_name): Define new overload. * tree-emutls.c (get_emutls_init_templ_addr): Same. * cgraphclones.c (cgraph_node::create_virtual_clone): Use new overload of symtab_node::set_section. (cgraph_node::create_version_clone_with_body): Same. * trans-mem.c (ipa_tm_create_version): Same. gcc/c * c-decl.c (merge_decls): Use new overload of set_decl_section_name. gcc/cp * decl.c (duplicate_decls): Use new overload of set_decl_section_name. * method.c (use_thunk): Same. * optimize.c (maybe_clone_body): Same. * coroutines.cc (act_des_fn): Same. gcc/d * decl.cc (finish_thunk): Use new overload of set_decl_section_name
2020-11-10openmp: Implement OpenMP 5.0 base-pointer attachement and clause orderingChung-Lin Tang2-9/+23
This patch implements some parts of the target variable mapping changes specified in OpenMP 5.0, including base-pointer attachment/detachment behavior for array section list-items in map clauses, and ordering of map clauses according to map kind. 2020-11-10 Chung-Lin Tang <cltang@codesourcery.com> gcc/c-family/ChangeLog: * c-common.h (c_omp_adjust_map_clauses): New declaration. * c-omp.c (struct map_clause): Helper type for c_omp_adjust_map_clauses. (c_omp_adjust_map_clauses): New function. gcc/c/ChangeLog: * c-parser.c (c_parser_omp_target_data): Add use of new c_omp_adjust_map_clauses function. Add GOMP_MAP_ATTACH_DETACH as handled map clause kind. (c_parser_omp_target_enter_data): Likewise. (c_parser_omp_target_exit_data): Likewise. (c_parser_omp_target): Likewise. * c-typeck.c (handle_omp_array_sections): Adjust COMPONENT_REF case to use GOMP_MAP_ATTACH_DETACH map kind for C_ORT_OMP region type. (c_finish_omp_clauses): Adjust bitmap checks to allow struct decl and same struct field access to co-exist on OpenMP construct. gcc/cp/ChangeLog: * parser.c (cp_parser_omp_target_data): Add use of new c_omp_adjust_map_clauses function. Add GOMP_MAP_ATTACH_DETACH as handled map clause kind. (cp_parser_omp_target_enter_data): Likewise. (cp_parser_omp_target_exit_data): Likewise. (cp_parser_omp_target): Likewise. * semantics.c (handle_omp_array_sections): Adjust COMPONENT_REF case to use GOMP_MAP_ATTACH_DETACH map kind for C_ORT_OMP region type. Fix interaction between reference case and attach/detach. (finish_omp_clauses): Adjust bitmap checks to allow struct decl and same struct field access to co-exist on OpenMP construct. gcc/ChangeLog: * gimplify.c (is_or_contains_p): New static helper function. (omp_target_reorder_clauses): New function. (gimplify_scan_omp_clauses): Add use of omp_target_reorder_clauses to reorder clause list according to OpenMP 5.0 rules. Add handling of GOMP_MAP_ATTACH_DETACH for OpenMP cases. * omp-low.c (is_omp_target): New static helper function. (scan_sharing_clauses): Add scan phase handling of GOMP_MAP_ATTACH/DETACH for OpenMP cases. (lower_omp_target): Add lowering handling of GOMP_MAP_ATTACH/DETACH for OpenMP cases. gcc/testsuite/ChangeLog: * c-c++-common/gomp/clauses-2.c: Remove dg-error cases now valid. * gfortran.dg/gomp/map-2.f90: Likewise. * c-c++-common/gomp/map-5.c: New testcase. libgomp/ChangeLog: * libgomp.h (enum gomp_map_vars_kind): Adjust enum values to be bit-flag usable. * oacc-mem.c (acc_map_data): Adjust gomp_map_vars argument flags to 'GOMP_MAP_VARS_OPENACC | GOMP_MAP_VARS_ENTER_DATA'. (goacc_enter_datum): Likewise for call to gomp_map_vars_async. (goacc_enter_data_internal): Likewise. * target.c (gomp_map_vars_internal): Change checks of GOMP_MAP_VARS_ENTER_DATA to use bit-and (&). Adjust use of gomp_attach_pointer for OpenMP cases. (gomp_exit_data): Add handling of GOMP_MAP_DETACH. (GOMP_target_enter_exit_data): Add handling of GOMP_MAP_ATTACH. * testsuite/libgomp.c-c++-common/ptr-attach-1.c: New testcase.
2020-11-08Daily bump.GCC Administrator1-0/+5
2020-11-07C Parser: Implement mixing of labels and code.Martin Uecker1-68/+37
Implement mixing of labels and code as adopted for C2X and process some std-attributes on labels. 2020-11-06 Martin Uecker <muecker@gwdg.de> gcc/ * doc/extend.texi: Document mixing labels and code. * doc/invoke.texi: Likewise. gcc/c/ * c-parser.c (c_parser_label): Implement mixing of labels and code. (c_parser_all_labels): Likewise. gcc/testsuite/ * c-c++-common/attr-fallthrough-2.c: Update compiler flags. * c-c++-common/Wimplicit-fallthrough-20.c: Adapt test. * gcc.dg/20031223-1.c: Update compiler flags and adapt test. * gcc.dg/c11-labels-1.c: New test. * gcc.dg/c11-labels-2.c: New test. * gcc.dg/c11-labels-3.c: New test. * gcc.dg/c2x-attr-syntax-3.c: Adapt test. * gcc.dg/c2x-labels-1.c: New test. * gcc.dg/c2x-labels-2.c: New test. * gcc.dg/c2x-labels-3.c: New test. * gcc.dg/decl-9.c: Update compiler flags and add error. * gcc.dg/gomp/barrier-2.c: Update compiler flags and add warning. * gcc.dg/gomp/declare-simd-5.c: Update compiler flags and adapt test. * gcc.dg/gomp/declare-variant-2.c: Update compiler flags and add error. * gcc.dg/label-compound-stmt-1.c: Update compiler flags. * gcc.dg/parse-decl-after-label.c: Update compiler flags.
2020-11-07Daily bump.GCC Administrator1-0/+22
2020-11-06Objective-C/C++ (parsers) : Update @property attribute parsing.Iain Sandoe1-121/+159
At present, we are missing parsing and checking for around half of the property attributes in use. The existing ad hoc scheme for the parser's communication with the Objective C validation is not suitable for extending to cover all the missing cases. Additionally: 1/ We were declaring errors in two cases that the reference implementation warns (or is silent). I've elected to warn for both those cases, (Wattributes) it could be that we should implement Wobjc-xxx-property warning masks (TODO). 2/ We were emitting spurious complaints about missing property attributes when these were not being parsed because we gave up on the first syntax error. 3/ The quality of the diagnostic locations was poor (that's true for much of Objective-C, we will have to improve it as we modernise areas). We continue to attempt to keep the code, warning and error output similar (preferably identical output) between the C and C++ front ends. The interface to the Objective-C-specific parts of the parsing is simplified to a vector of parsed (but not fully-checked) property attributes, this will simplify the addition of new attributes. gcc/c-family/ChangeLog: * c-objc.h (enum objc_property_attribute_group): New (enum objc_property_attribute_kind): New. (OBJC_PROPATTR_GROUP_MASK): New. (struct property_attribute_info): Small class encapsulating parser output from property attributes. (objc_prop_attr_kind_for_rid): New (objc_add_property_declaration): Simplify interface. * stub-objc.c (enum rid): Dummy type. (objc_add_property_declaration): Simplify interface. (objc_prop_attr_kind_for_rid): New. gcc/c/ChangeLog: * c-parser.c (c_parser_objc_at_property_declaration): Improve parsing fidelity. Associate better location info with @property attributes. Clean up the interface to objc_add_property_declaration (). gcc/cp/ChangeLog: * parser.c (cp_parser_objc_at_property_declaration): Improve parsing fidelity. Associate better location info with @property attributes. Clean up the interface to objc_add_property_declaration (). gcc/objc/ChangeLog: * objc-act.c (objc_prop_attr_kind_for_rid): New. (objc_add_property_declaration): Adjust to consume the parser output using a vector of parsed attributes. gcc/testsuite/ChangeLog: * obj-c++.dg/property/at-property-1.mm: Adjust expected diagnostics. * obj-c++.dg/property/at-property-29.mm: Likewise. * obj-c++.dg/property/at-property-4.mm: Likewise. * obj-c++.dg/property/property-neg-2.mm: Likewise. * objc.dg/property/at-property-1.m: Likewise. * objc.dg/property/at-property-29.m: Likewise. * objc.dg/property/at-property-4.m: Likewise. * objc.dg/property/at-property-5.m: Likewise. * objc.dg/property/property-neg-2.m: Likewise.
2020-11-06core: Rename DECL_IS_BUILTIN -> DECL_IS_UNDECLARED_BUILTINNathan Sidwell2-11/+13
In cleaning up C++'s handling of hidden decls, I renamed its DECL_BUILTIN_P, which checks for loc == BUILTINS_LOCATION to DECL_UNDECLARED_BUILTIN_P, because the location gets updated, if user source declares the builtin, and the predicate no longer holds. The original name was confusing me. (The builtin may still retain builtin properties in the redeclaration, and other predicates can still detect that.) I discovered that tree.h had its own variant 'DECL_IS_BUILTIN', which behaves in (almost) the same manner. And therefore has the same mutating behaviour. This patch deletes the C++ one, and renames tree.h's to DECL_IS_UNDECLARED_BUILTIN, to emphasize its non-constantness. I guess _IS_ wins over _P gcc/ * tree.h (DECL_IS_BUILTIN): Rename to ... (DECL_IS_UNDECLARED_BUILTIN): ... here. No need to use SOURCE_LOCUS. * calls.c (maybe_warn_alloc_args_overflow): Adjust for rename. * cfgexpand.c (pass_expand::execute): Likewise. * dwarf2out.c (base_type_die, is_naming_typedef_decl): Likewise. * godump.c (go_decl, go_type_decl): Likewise. * print-tree.c (print_decl_identifier): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree-ssa-ccp.c (pass_post_ipa_warn::execute): Likewise. * xcoffout.c (xcoff_assign_fundamental_type_number): Likewise. gcc/c-family/ * c-ada-spec.c (collect_ada_nodes): Rename DECL_IS_BUILTIN->DECL_IS_UNDECLARED_BUILTIN. (collect_ada_node): Likewise. (dump_forward_type): Likewise. * c-common.c (set_underlying_type): Rename DECL_IS_BUILTIN->DECL_IS_UNDECLARED_BUILTIN. (user_facing_original_type, c_common_finalize_early_debug): Likewise. gcc/c/ * c-decl.c (diagnose_mismatched_decls): Rename DECL_IS_BUILTIN->DECL_IS_UNDECLARED_BUILTIN. (warn_if_shadowing, implicitly_declare, names_builtin_p) (collect_source_refs): Likewise. * c-typeck.c (inform_declaration, inform_for_arg) (convert_for_assignment): Likewise. gcc/cp/ * cp-tree.h (DECL_UNDECLARED_BUILTIN_P): Delete. * cp-objcp-common.c (names_bultin_p): Rename DECL_IS_BUILTIN->DECL_IS_UNDECLARED_BUILTIN. * decl.c (decls_match): Likewise. Replace DECL_UNDECLARED_BUILTIN_P with DECL_IS_UNDECLARED_BUILTIN. (duplicate_decls): Likewise. * decl2.c (collect_source_refs): Likewise. * name-lookup.c (anticipated_builtin_p, print_binding_level) (do_nonmember_using_decl): Likewise. * pt.c (builtin_pack_fn_p): Likewise. * typeck.c (error_args_num): Likewise. gcc/lto/ * lto-symtab.c (lto_symtab_merge_decls_1): Rename DECL_IS_BUILTIN->DECL_IS_UNDECLARED_BUILTIN. gcc/go/ * go-gcc.cc (Gcc_backend::call_expression): Rename DECL_IS_BUILTIN->DECL_IS_UNDECLARED_BUILTIN. libcc1/ * libcc1plugin.cc (address_rewriter): Rename DECL_IS_BUILTIN->DECL_IS_UNDECLARED_BUILTIN. * libcp1plugin.cc (supplement_binding): Likewise.
2020-11-06OpenACC (C/C++): Fix 'acc atomic' parsingTobias Burnus1-5/+19
gcc/c/ChangeLog: * c-parser.c (c_parser_omp_atomic): Add openacc parameter and update OpenACC matching. (c_parser_omp_construct): Update call. gcc/cp/ChangeLog: * parser.c (cp_parser_omp_atomic): Add openacc parameter and update OpenACC matching. (cp_parser_omp_construct): Update call. gcc/testsuite/ChangeLog: * c-c++-common/goacc-gomp/atomic.c: New test. * c-c++-common/goacc/atomic.c: New test.
2020-11-05Daily bump.GCC Administrator1-0/+19
2020-11-04openmp: allocate clause vs. *reduction array sections [PR97670]Jakub Jelinek1-3/+16
This patch finds the base expression of reduction array sections and uses it in checks whether allocate clause lists only variables that have been privatized. Also fixes a pasto that caused an ICE. 2020-11-04 Jakub Jelinek <jakub@redhat.com> PR c++/97670 gcc/c-family/ * c-omp.c (c_omp_split_clauses): Look through array reductions to find underlying decl to clear in the allocate_head bitmap. gcc/c/ * c-typeck.c (c_finish_omp_clauses): Look through array reductions to find underlying decl to clear in the aligned_head bitmap. gcc/cp/ * semantics.c (finish_omp_clauses): Look through array reductions to find underlying decl to clear in the aligned_head bitmap. Use DECL_UID (t) instead of DECL_UID (OMP_CLAUSE_DECL (c)) when clearing in the bitmap. Only diagnose errors about allocate vars not being privatized on the same construct on allocate clause if it has a DECL_P OMP_CLAUSE_DECL. gcc/testsuite/ * c-c++-common/gomp/allocate-4.c: New test. * g++.dg/gomp/allocate-2.C: New test. * g++.dg/gomp/allocate-3.C: New test.
2020-11-04c: Implement C2x nodiscard attributeJoseph Myers3-7/+115
C2x adds the nodiscard standard attribute, with an optional string argument, as in C++; implement it for C. Bootstrapped with no regressions for x86_64-pc-linux-gnu. gcc/c/ 2020-11-04 Joseph Myers <joseph@codesourcery.com> * c-decl.c (handle_nodiscard_attribute): New. (std_attribute_table): Add nodiscard. * c-parser.c (c_parser_std_attribute): Expect argument to nodiscard attribute to be a string. Do not special-case ignoring nodiscard. * c-typeck.c (maybe_warn_nodiscard): New. (build_compound_expr, emit_side_effect_warnings): Call maybe_warn_nodiscard. (c_process_expr_stmt, c_finish_stmt_expr): Also call emit_side_effect_warnings if warn_unused_result. gcc/testsuite/ 2020-11-04 Joseph Myers <joseph@codesourcery.com> * gcc.dg/c2x-attr-nodiscard-1.c, gcc.dg/c2x-attr-nodiscard-2.c, gcc.dg/c2x-attr-nodiscard-3.c, gcc.dg/c2x-attr-nodiscard-4.c: New tests. * gcc.dg/c2x-attr-syntax-5.c: Remove nodiscard test.
2020-10-30Daily bump.GCC Administrator1-0/+7
2020-10-29Replace free with XDELETE.Asher Gordon1-5/+5
gcc/c/ChangeLog: * c-typeck.c (free_all_tagged_tu_seen_up_to): Replace free with XDELETE. (finish_init): Likewise. (pop_init_level): Likewise.
2020-10-29Daily bump.GCC Administrator1-0/+18
2020-10-28c: Allow omitted parameter names for C2xJoseph Myers1-1/+3
C2x allows parameter names to be omitted in function definitions, as in C++; add support for this feature. As with other features that only result in previously rejected code being accepted, this feature is now accepted as an extension for previous standard versions, with a pedwarn-if-pedantic that is disabled by -Wno-c11-c2x-compat. The logic for avoiding unused-parameter warnings for unnamed parameters is in code shared between C and C++, so no changes are needed there. Bootstrapped with no regressions for x86_64-pc-linux-gnu. gcc/c/ 2020-10-28 Joseph Myers <joseph@codesourcery.com> * c-decl.c (store_parm_decls_newstyle): Use pedwarn_c11 not error_at for omitted parameter name. gcc/testsuite/ 2020-10-28 Joseph Myers <joseph@codesourcery.com> * gcc.dg/c11-parm-omit-1.c, gcc.dg/c11-parm-omit-2.c, gcc.dg/c11-parm-omit-3.c, gcc.dg/c11-parm-omit-4.c, gcc.dg/c2x-parm-omit-1.c, gcc.dg/c2x-parm-omit-2.c, gcc.dg/c2x-parm-omit-3.c, gcc.dg/c2x-parm-omit-4.c: New tests. * gcc.dg/noncompile/pr79758.c: Do not expect error for omitted parameter name.
2020-10-28openmp: Parsing and some semantic analysis of OpenMP allocate clauseJakub Jelinek2-2/+134
This patch adds parsing of OpenMP allocate clause, but still ignores it during OpenMP lowering where we should for privatized variables with allocate clause use the corresponding allocators rather than allocating them on the stack. 2020-10-28 Jakub Jelinek <jakub@redhat.com> gcc/ * tree-core.h (enum omp_clause_code): Add OMP_CLAUSE_ALLOCATE. * tree.h (OMP_CLAUSE_ALLOCATE_ALLOCATOR, OMP_CLAUSE_ALLOCATE_COMBINED): Define. * tree.c (omp_clause_num_ops, omp_clause_code_name): Add allocate clause. (walk_tree_1): Handle OMP_CLAUSE_ALLOCATE. * tree-pretty-print.c (dump_omp_clause): Likewise. * gimplify.c (gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses, gimplify_omp_for): Likewise. * tree-nested.c (convert_nonlocal_omp_clauses, convert_local_omp_clauses): Likewise. * omp-low.c (scan_sharing_clauses): Likewise. gcc/c-family/ * c-pragma.h (enum pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_ALLOCATE. * c-omp.c: Include bitmap.h. (c_omp_split_clauses): Handle OMP_CLAUSE_ALLOCATE. gcc/c/ * c-parser.c (c_parser_omp_clause_name): Handle allocate. (c_parser_omp_clause_allocate): New function. (c_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_ALLOCATE. (OMP_FOR_CLAUSE_MASK, OMP_SECTIONS_CLAUSE_MASK, OMP_PARALLEL_CLAUSE_MASK, OMP_SINGLE_CLAUSE_MASK, OMP_TASK_CLAUSE_MASK, OMP_TASKGROUP_CLAUSE_MASK, OMP_DISTRIBUTE_CLAUSE_MASK, OMP_TEAMS_CLAUSE_MASK, OMP_TARGET_CLAUSE_MASK, OMP_TASKLOOP_CLAUSE_MASK): Add PRAGMA_OMP_CLAUSE_ALLOCATE. * c-typeck.c (c_finish_omp_clauses): Handle OMP_CLAUSE_ALLOCATE. gcc/cp/ * parser.c (cp_parser_omp_clause_name): Handle allocate. (cp_parser_omp_clause_allocate): New function. (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_ALLOCATE. (OMP_FOR_CLAUSE_MASK, OMP_SECTIONS_CLAUSE_MASK, OMP_PARALLEL_CLAUSE_MASK, OMP_SINGLE_CLAUSE_MASK, OMP_TASK_CLAUSE_MASK, OMP_TASKGROUP_CLAUSE_MASK, OMP_DISTRIBUTE_CLAUSE_MASK, OMP_TEAMS_CLAUSE_MASK, OMP_TARGET_CLAUSE_MASK, OMP_TASKLOOP_CLAUSE_MASK): Add PRAGMA_OMP_CLAUSE_ALLOCATE. * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_ALLOCATE. * pt.c (tsubst_omp_clauses): Likewise. gcc/testsuite/ * c-c++-common/gomp/allocate-1.c: New test. * c-c++-common/gomp/allocate-2.c: New test. * c-c++-common/gomp/clauses-1.c (omp_allocator_handle_t): New typedef. (foo, bar, baz): Add allocate clauses where allowed.
2020-10-28Daily bump.GCC Administrator1-0/+5
2020-10-27c: Allow duplicate C2x standard attributesJoseph Myers1-52/+2
N2557, accepted into C2x at the October WG14 meeting, removes the requirement that duplicates of standard attributes cannot appear within an attribute list (so allowing e.g. [[deprecated, deprecated]], where previously that was disallowed but [[deprecated]] [[deprecated]] was OK). Remove the code checking for this (standard attributes aren't in any released version of the C standard) and update tests accordingly. Bootstrapped with no regressions on x86_64-pc-linux-gnu. gcc/c/ 2020-10-27 Joseph Myers <joseph@codesourcery.com> * c-parser.c (c_parser_std_attribute_specifier): Allow duplicate standard attributes. gcc/testsuite/ 2020-10-27 Joseph Myers <joseph@codesourcery.com> * gcc.dg/c2x-attr-deprecated-4.c, gcc.dg/c2x-attr-fallthrough-4.c, gcc.dg/c2x-attr-maybe_unused-4.c: Allow duplicate attributes.
2020-10-24Daily bump.GCC Administrator1-0/+14
2020-10-23c, c++: Implement -Wsizeof-array-div [PR91741]Marek Polacek3-19/+32
This patch implements a new warning, -Wsizeof-array-div. It warns about code like int arr[10]; sizeof (arr) / sizeof (short); where we have a division of two sizeof expressions, where the first argument is an array, and the second sizeof does not equal the size of the array element. See e.g. <https://www.viva64.com/en/examples/v706/>. Clang makes it possible to suppress the warning by parenthesizing the second sizeof like this: sizeof (arr) / (sizeof (short)); so I followed suit. In the C++ FE this was rather easy, because finish_parenthesized_expr already set TREE_NO_WARNING. In the C FE I've added a new tree code, PAREN_SIZEOF_EXPR, to discern between the non-() and () versions. This warning is enabled by -Wall. An example of the output: x.c:5:23: warning: expression does not compute the number of elements in this array; element type is ‘int’, not ‘short int’ [-Wsizeof-array-div] 5 | return sizeof (arr) / sizeof (short); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~ x.c:5:25: note: add parentheses around ‘sizeof (short int)’ to silence this warning 5 | return sizeof (arr) / sizeof (short); | ^~~~~~~~~~~~~~ | ( ) x.c:4:7: note: array ‘arr’ declared here 4 | int arr[10]; | ^~~ gcc/c-family/ChangeLog: PR c++/91741 * c-common.c (verify_tree): Handle PAREN_SIZEOF_EXPR. (c_common_init_ts): Likewise. * c-common.def (PAREN_SIZEOF_EXPR): New tree code. * c-common.h (maybe_warn_sizeof_array_div): Declare. * c-warn.c (sizeof_pointer_memaccess_warning): Unwrap NOP_EXPRs. (maybe_warn_sizeof_array_div): New function. * c.opt (Wsizeof-array-div): New option. gcc/c/ChangeLog: PR c++/91741 * c-parser.c (c_parser_binary_expression): Implement -Wsizeof-array-div. (c_parser_postfix_expression): Set PAREN_SIZEOF_EXPR. (c_parser_expr_list): Handle PAREN_SIZEOF_EXPR like SIZEOF_EXPR. * c-tree.h (char_type_p): Declare. * c-typeck.c (char_type_p): No longer static. gcc/cp/ChangeLog: PR c++/91741 * typeck.c (cp_build_binary_op): Implement -Wsizeof-array-div. gcc/ChangeLog: PR c++/91741 * doc/invoke.texi: Document -Wsizeof-array-div. gcc/testsuite/ChangeLog: PR c++/91741 * c-c++-common/Wsizeof-pointer-div.c: Add dg-warning. * c-c++-common/Wsizeof-array-div1.c: New test. * g++.dg/warn/Wsizeof-array-div1.C: New test. * g++.dg/warn/Wsizeof-array-div2.C: New test.
2020-10-23PR middle-end/97552 - missing waning passing null to a VLA argument declared ↵Martin Sebor1-2/+4
[static] gcc/ChangeLog: PR middle-end/97552 * attribs.c (init_attr_rdwr_indices): Handle static VLA parameters. gcc/c/ChangeLog: PR middle-end/97552 * c-decl.c (get_parm_array_spec): Handle static VLA parameters. gcc/testsuite/ChangeLog: PR middle-end/97552 * gcc.dg/Wvla-parameter-2.c: Adjust text of expected warning. * gcc.dg/Wnonnull-5.c: New test.
2020-09-20Daily bump.GCC Administrator1-0/+56
2020-09-19Infrastructure & C front end changes for array parameter checking (PR c/50584).Martin Sebor3-20/+232
gcc/ChangeLog: PR c/50584 * attribs.c (decl_attributes): Also pass decl along with type attributes to handlers. (init_attr_rdwr_indices): Change second argument to attribute chain. Handle internal attribute representation in addition to external. (get_parm_access): New function. (attr_access::to_internal_string): Define new member function. (attr_access::to_external_string): Define new member function. (attr_access::vla_bounds): Define new member function. * attribs.h (struct attr_access): Declare new members. (attr_access::from_mode_char): Define new member function. (get_parm_access): Declare new function. * calls.c (initialize_argument_information): Pass function type attributes to init_attr_rdwr_indices. * doc/invoke.texi (-Warray-parameter, -Wvla-parameter): Document. * tree-pretty-print.c (dump_generic_node): Correct handling of qualifiers. * tree-ssa-uninit.c (maybe_warn_pass_by_reference): Same. * tree.h (access_mode): Add new enumerator. gcc/c-family/ChangeLog: PR c/50584 * c-attribs.c (c_common_attribute_table): Add "arg spec" attribute. (handle_argspec_attribute): New function. (get_argument, get_argument_type): New functions. (append_access_attrs): Add overload. Handle internal attribute representation in addition to external. (handle_access_attribute): Handle internal attribute representation in addition to external. (build_attr_access_from_parms): New function. gcc/c-family/ChangeLog: PR c/50584 * c-common.h (warn_parm_array_mismatch): Declare new function. (has_attribute): Move declaration of an existing function. (build_attr_access_from_parms): Declare new function. * c-warn.c (parm_array_as_string): Define new function. (plus_one): Define new function. (warn_parm_ptrarray_mismatch): Define new function. (warn_parm_array_mismatch): Define new function. (vla_bound_parm_decl): New function. * c.opt (-Warray-parameter, -Wvla-parameter): New options. * c-pretty-print.c (pp_c_type_qualifier_list): Don't print array type qualifiers here... (c_pretty_printer::direct_abstract_declarator): ...but instead print them in brackets here. Also print [static]. Strip extraneous expressions from VLA bounds. gcc/c/ChangeLog: PR c/50584 * c-decl.c (lookup_last_decl): Define new function. (c_decl_attributes): Call it. (start_decl): Add argument and use it. (finish_decl): Call build_attr_access_from_parms and decl_attributes. (get_parm_array_spec): Define new function. (push_parm_decl): Call get_parm_array_spec. (start_function): Call warn_parm_array_mismatch. Build attribute access and add it to current function. * c-parser.c (c_parser_declaration_or_fndef): Diagnose mismatches in forms of array parameters. * c-tree.h (start_decl): Add argument. gcc/testsuite/ChangeLog: PR c/50584 * gcc.dg/attr-access-read-write-2.c: Adjust text of expected message. * c-c++-common/Warray-bounds-6.c: Correct C++ declaration, adjust text of expected diagnostics. * gcc.dg/Wbuiltin-declaration-mismatch-9.c: Prune expected warning. * gcc.dg/Warray-parameter-2.c: New test. * gcc.dg/Warray-parameter-3.c: New test. * gcc.dg/Warray-parameter-4.c: New test. * gcc.dg/Warray-parameter-5.c: New test. * gcc.dg/Warray-parameter.c: New test. * gcc.dg/Wvla-parameter-2.c: New test. * gcc.dg/Wvla-parameter-3.c: New test. * gcc.dg/Wvla-parameter.c: New test.
2020-09-19Change C front end to emit structured loop and switch tree nodes.Sandra Loosemore6-240/+156
2020-08-12 Sandra Loosemore <sandra@codesourcery.com> gcc/c * c-decl.c (c_break_label, c_cont_label): Delete, and replace with... (in_statement): New. (start_function): Adjust for above change. (c_push_function_context, c_pop_function_context): Likewise. * c-lang.h (struct language_function): Likewise. * c-objc-common.h (LANG_HOOKS_BLOCK_MAY_FALLTHRU): Define. * c-parser.c (objc_foreach_break_label, objc_foreach_continue_label): New. (c_parser_statement_after_labels): Adjust calls to c_finish_bc_stmt. (c_parser_switch_statement): Adjust break/switch context handling and calls to renamed functions. (c_parser_while_statement): Adjust break/switch context handling and build a WHILE_STMT. (c_parser_do_statement): Ditto, with DO_STMT respectively. (c_parser_for_statement): Ditto, with FOR_STMT respectively. (c_parser_omp_for_loop): Adjust break/switch context handling. * c-tree.h (c_break_label, c_cont_label): Delete. (IN_SWITCH_STMT, IN_ITERATION_STMT): Define. (IN_OMP_BLOCK, IN_OMP_FOR, IN_OBJC_FOREACH): Define. (in_statement, switch_statement_break_seen_p): Declare. (c_start_case, c_finish_case): Renamed to... (c_start_switch, c_finish_switch). (c_finish_bc_stmt): Adjust arguments. * c-typeck.c (build_function_call_vec): Don't try to print statements with %qE format. (struct c_switch): Rename switch_expr field to switch_stmt. Add break_stmt_seen_p field. (c_start_case): Rename to c_start_switch. Build a SWITCH_STMT instead of a SWITCH_EXPR. Update for changes to struct c_switch. (do_case): Update for changes to struct c_switch. (c_finish_case): Rename to c_finish_switch. Update for changes to struct c_switch and change of representation from SWITCH_EXPR to SWITCH_STMT. (c_finish_loop): Delete. (c_finish_bc_stmt): Update to reflect changes to break/continue state representation. Build a BREAK_STMT or CONTINUE_STMT instead of a GOTO_EXPR except for objc foreach loops. gcc/objc * objc-act.c (objc_start_method_definition): Update to reflect changes to break/continue state bookkeeping in C front end. gcc/testsuite/ * gcc.dg/gomp/block-7.c: Update expected error message wording.
2020-09-11Adjust email addressEric Botcazou1-1/+1
2020-09-02Daily bump.GCC Administrator1-0/+6
2020-09-01openmp: Check for PARM_DECL before using C_ARRAY_PARAMETER or ↵Jakub Jelinek1-1/+1
DECL_ARRAY_PARAMETER_P [PR96867] The C++ macro performs a PARM_DECL_CHECK, so will ICE if not tested on a PARM_DECL, C_ARRAY_PARAMETER doesn't, but probably should, otherwise it is testing e.g. C_DECL_VARIABLE_SIZE on VAR_DECLs. 2020-09-01 Jakub Jelinek <jakub@redhat.com> PR c++/96867 * c-typeck.c (handle_omp_array_sections_1): Test C_ARRAY_PARAMETER only on PARM_DECLs. * semantics.c (handle_omp_array_sections_1): Test DECL_ARRAY_PARAMETER_P only on PARM_DECLs. * c-c++-common/gomp/pr96867.c: New test.
2020-08-29Daily bump.GCC Administrator1-0/+6
2020-08-28PR c/96596 - ICE in match_builtin_function_types on a declaration of a ↵Martin Sebor1-1/+4
built-in with invalid array argument gcc/c/ChangeLog: PR c/96596 * c-decl.c (match_builtin_function_types): Avoid dealing with erroneous argument type. gcc/testsuite/ChangeLog: PR c/96596 * gcc.dg/Wbuiltin-declaration-mismatch-16.c: New test.