From 8b9a92f794b8ad8011e6beb11a609efa635c4600 Mon Sep 17 00:00:00 2001 From: Strager Neds Date: Tue, 10 Nov 2020 11:42:01 -0700 Subject: Refactor copying decl section names 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 --- gcc/c/c-decl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/c') diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index f19c82c..d348e39 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -2884,7 +2884,7 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype) || TREE_PUBLIC (olddecl) || TREE_STATIC (olddecl)) && DECL_SECTION_NAME (newdecl) != NULL) - set_decl_section_name (olddecl, DECL_SECTION_NAME (newdecl)); + set_decl_section_name (olddecl, newdecl); /* This isn't quite correct for something like int __thread x attribute ((tls_model ("local-exec"))); -- cgit v1.1 From bb6226419f566bb9f68d9f2dc7d3aca501efaa98 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 11 Nov 2020 00:16:36 +0000 Subject: Daily bump. --- gcc/c/ChangeLog | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'gcc/c') diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 5b0d42c..a16dba4 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,21 @@ +2020-11-10 Strager Neds + + * c-decl.c (merge_decls): Use new overload of + set_decl_section_name. + +2020-11-10 Chung-Lin Tang + + * 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. + 2020-11-07 Martin Uecker * c-parser.c (c_parser_label): Implement mixing of labels and code. -- cgit v1.1 From 3fe07cdec8c79bce53ea5aeb8e607df6eb5c8c2c Mon Sep 17 00:00:00 2001 From: Iain Sandoe Date: Sun, 25 Oct 2020 07:49:16 +0000 Subject: C-family, Objective-C [1/3] : Implement Wobjc-root-class [PR77404]. 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. --- gcc/c/c-parser.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gcc/c') diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index 377914c..f4c4cf7 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -10801,6 +10801,7 @@ c_parser_objc_class_definition (c_parser *parser, tree attributes) return; } id1 = c_parser_peek_token (parser)->value; + location_t loc1 = c_parser_peek_token (parser)->location; c_parser_consume_token (parser); if (c_parser_next_token_is (parser, CPP_OPEN_PAREN)) { @@ -10860,7 +10861,7 @@ c_parser_objc_class_definition (c_parser *parser, tree attributes) tree proto = NULL_TREE; if (c_parser_next_token_is (parser, CPP_LESS)) proto = c_parser_objc_protocol_refs (parser); - objc_start_class_interface (id1, superclass, proto, attributes); + objc_start_class_interface (id1, loc1, superclass, proto, attributes); } else objc_start_class_implementation (id1, superclass); -- cgit v1.1 From 67100cb50ea22e1fc855360b887959f874fafe2c Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 13 Nov 2020 18:57:06 +0100 Subject: openmp: Support allocate for C/C++ array section reductions 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 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. --- gcc/c/c-typeck.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gcc/c') diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index df1dad4..26a5f71 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -15199,7 +15199,8 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort) OMP_CLAUSE_LINEAR_STEP (c)); remove = true; } - else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_REDUCTION) + else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_REDUCTION + && reduction_seen == -2) OMP_CLAUSE_REDUCTION_INSCAN (c) = 0; if (remove) -- cgit v1.1 From e3b3b59683c1e7d31a9d313dd97394abebf644be Mon Sep 17 00:00:00 2001 From: "Vladimir N. Makarov" Date: Fri, 13 Nov 2020 12:45:59 -0500 Subject: [PATCH] Implementation of asm goto outputs 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. --- gcc/c/c-parser.c | 5 +---- gcc/c/c-typeck.c | 4 ---- 2 files changed, 1 insertion(+), 8 deletions(-) (limited to 'gcc/c') diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index f4c4cf7..7540a15 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -7144,10 +7144,7 @@ c_parser_asm_statement (c_parser *parser) switch (section) { case 0: - /* For asm goto, we don't allow output operands, but reserve - the slot for a future extension that does allow them. */ - if (!is_goto) - outputs = c_parser_asm_operands (parser); + outputs = c_parser_asm_operands (parser); break; case 1: inputs = c_parser_asm_operands (parser); diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index 26a5f71..413109c 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -10666,10 +10666,6 @@ build_asm_expr (location_t loc, tree string, tree outputs, tree inputs, TREE_VALUE (tail) = input; } - /* ASMs with labels cannot have outputs. This should have been - enforced by the parser. */ - gcc_assert (outputs == NULL || labels == NULL); - args = build_stmt (loc, ASM_EXPR, string, outputs, inputs, clobbers, labels); /* asm statements without outputs, including simple ones, are treated -- cgit v1.1 From 77f67db2a4709388b905397421bd3a851fbbf884 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 14 Nov 2020 00:16:38 +0000 Subject: Daily bump. --- gcc/c/ChangeLog | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'gcc/c') diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index a16dba4..289a426 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,21 @@ +2020-11-13 Vladimir N. Makarov + + * 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. + +2020-11-13 Jakub Jelinek + + * c-typeck.c (c_finish_omp_clauses): Don't clear + OMP_CLAUSE_REDUCTION_INSCAN unless reduction_seen == -2. + +2020-11-13 Iain Sandoe + + PR objc/77404 + * c-parser.c (c_parser_objc_class_definition): Pass the + location of the class name to the interface declaration. + 2020-11-10 Strager Neds * c-decl.c (merge_decls): Use new overload of -- cgit v1.1 From d326ebc94f3b2b0d962fb9e253564b39106a10da Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 18 Nov 2020 20:11:37 +0100 Subject: configury: --enable-link-serialization support 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 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. --- gcc/c/Make-lang.in | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'gcc/c') diff --git a/gcc/c/Make-lang.in b/gcc/c/Make-lang.in index 7efc7c2..c776ab6 100644 --- a/gcc/c/Make-lang.in +++ b/gcc/c/Make-lang.in @@ -37,9 +37,10 @@ # # Define the names for selecting c in LANGUAGES. c: cc1$(exeext) +c.serial: c # Tell GNU make to ignore these if they exist. -.PHONY: c gcc +.PHONY: c gcc c.serial # The C front end driver. This is different from the drivers for other # front ends, because there is no C language specific driver (i.e. nothing @@ -82,8 +83,10 @@ cc1-checksum.c : build/genchecksum$(build_exeext) checksum-options \ fi cc1$(exeext): $(C_OBJS) cc1-checksum.o $(BACKEND) $(LIBDEPS) + @$(call LINK_PROGRESS,$(INDEX.c),start) +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ $(C_OBJS) \ cc1-checksum.o $(BACKEND) $(LIBS) $(BACKENDLIBS) + @$(call LINK_PROGRESS,$(INDEX.c),end) cc1.fda: ../stage1-gcc/cc1$(exeext) ../prev-gcc/$(PERF_DATA) $(CREATE_GCOV) -binary ../stage1-gcc/cc1$(exeext) -gcov cc1.fda -profile ../prev-gcc/$(PERF_DATA) -gcov_version 1 -- cgit v1.1 From 25bb75f841c552cfd27a4344b7487efbe35b4481 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 19 Nov 2020 00:16:30 +0000 Subject: Daily bump. --- gcc/c/ChangeLog | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'gcc/c') diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 289a426..f5b173c 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,9 @@ +2020-11-18 Jakub Jelinek + + * Make-lang.in (c.serial): New goal. + (.PHONY): Add c.serial c.prev. + (cc1$(exeext)): Call LINK_PROGRESS. + 2020-11-13 Vladimir N. Makarov * c-parser.c (c_parser_asm_statement): Parse outputs for asm -- cgit v1.1 From 8156cfaa4c45f1249bbdda29d04b4fef84b7eafe Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 19 Nov 2020 20:02:41 +0100 Subject: c, tree: Fix ICE from get_parm_array_spec [PR97860] 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 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. --- gcc/c/c-decl.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gcc/c') diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index d348e39..1b02240 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -5775,6 +5775,8 @@ get_parm_array_spec (const struct c_parm *parm, tree attrs) type = TREE_TYPE (type)) { tree nelts = array_type_nelts (type); + if (error_operand_p (nelts)) + return attrs; if (TREE_CODE (nelts) != INTEGER_CST) { /* Each variable VLA bound is represented by the dollar -- cgit v1.1 From d62586ee567bbbdab9fe8bb5829f032431d57098 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 20 Nov 2020 00:16:40 +0000 Subject: Daily bump. --- gcc/c/ChangeLog | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'gcc/c') diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index f5b173c..36c8636 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,9 @@ +2020-11-19 Jakub Jelinek + + PR c/97860 + * c-decl.c (get_parm_array_spec): Bail out of nelts is + error_operand_p. + 2020-11-18 Jakub Jelinek * Make-lang.in (c.serial): New goal. -- cgit v1.1 From 32934a4f45a72144cdcd0712cc294fe88c36f13d Mon Sep 17 00:00:00 2001 From: Martin Uecker Date: Fri, 20 Nov 2020 07:21:40 +0100 Subject: C: Drop qualifiers during lvalue conversion [PR97702] 2020-11-20 Martin Uecker 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. --- gcc/c/c-typeck.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'gcc/c') diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index 413109c..286f3d9 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -2080,6 +2080,9 @@ convert_lvalue_to_rvalue (location_t loc, struct c_expr exp, exp = default_function_array_conversion (loc, exp); if (!VOID_TYPE_P (TREE_TYPE (exp.value))) exp.value = require_complete_type (loc, exp.value); + if (convert_p && !error_operand_p (exp.value) + && (TREE_CODE (TREE_TYPE (exp.value)) != ARRAY_TYPE)) + exp.value = convert (build_qualified_type (TREE_TYPE (exp.value), TYPE_UNQUALIFIED), exp.value); if (really_atomic_lvalue (exp.value)) { vec *params; -- cgit v1.1 From a774a6a2fbeaf7cbcb7a7afe433418f2d740b45b Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 20 Nov 2020 08:45:11 +0100 Subject: configury: Fix up --enable-link-serialization support 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 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. --- gcc/c/Make-lang.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/c') diff --git a/gcc/c/Make-lang.in b/gcc/c/Make-lang.in index c776ab6..4b2e616 100644 --- a/gcc/c/Make-lang.in +++ b/gcc/c/Make-lang.in @@ -37,10 +37,10 @@ # # Define the names for selecting c in LANGUAGES. c: cc1$(exeext) -c.serial: c +c.serial = cc1$(exeext) # Tell GNU make to ignore these if they exist. -.PHONY: c gcc c.serial +.PHONY: c gcc # The C front end driver. This is different from the drivers for other # front ends, because there is no C language specific driver (i.e. nothing -- cgit v1.1 From df90f070378583f295dd972db4400f324752a240 Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Fri, 20 Nov 2020 13:44:57 -0700 Subject: PR middle-end/97879 - ICE on invalid mode in attribute access 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. --- gcc/c/c-decl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gcc/c') diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index 1b02240..27f7722 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -9598,7 +9598,8 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator, current_function_decl = pushdecl (decl1); if (tree access = build_attr_access_from_parms (parms, false)) - decl_attributes (¤t_function_decl, access, 0, old_decl); + decl_attributes (¤t_function_decl, access, ATTR_FLAG_INTERNAL, + old_decl); push_scope (); declare_parm_level (); -- cgit v1.1 From 82e5048e70ef790559ba768132b4afd266a30fee Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 21 Nov 2020 00:16:29 +0000 Subject: Daily bump. --- gcc/c/ChangeLog | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'gcc/c') diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 36c8636..c97a9f7 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,18 @@ +2020-11-20 Martin Sebor + + PR middle-end/97879 + * c-decl.c (start_function): Set ATTR_FLAG_INTERNAL in flags. + +2020-11-20 Jakub Jelinek + + PR other/97911 + * Make-lang.in (c.serial): Change from goal to a variable. + (.PHONY): Drop c.serial. + +2020-11-20 Martin Uecker + + * c-typeck.c (convert_lvalue_to_rvalue): Drop qualifiers. + 2020-11-19 Jakub Jelinek PR c/97860 -- cgit v1.1 From 1e2d8575ace4e12dbe95ae2d4a49a4d89c6f67eb Mon Sep 17 00:00:00 2001 From: Aaron Sawdey Date: Tue, 17 Nov 2020 17:17:44 -0600 Subject: Additional small changes to support opaque modes 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. --- gcc/c/c-aux-info.c | 1 + 1 file changed, 1 insertion(+) (limited to 'gcc/c') diff --git a/gcc/c/c-aux-info.c b/gcc/c/c-aux-info.c index ffc8099..bdeef52 100644 --- a/gcc/c/c-aux-info.c +++ b/gcc/c/c-aux-info.c @@ -409,6 +409,7 @@ gen_type (const char *ret_val, tree t, formals_style style) data_type = concat ("unsigned ", data_type, NULL); break; + case OPAQUE_TYPE: case REAL_TYPE: data_type = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (t))); break; -- cgit v1.1 From 7a97e2fcf7ca91b77686373ebfb2263a28885570 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sun, 22 Nov 2020 00:16:24 +0000 Subject: Daily bump. --- gcc/c/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gcc/c') diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index c97a9f7..7a3c05f 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,7 @@ +2020-11-21 Aaron Sawdey + + * c-aux-info.c (gen_type): Support opaque types. + 2020-11-20 Martin Sebor PR middle-end/97879 -- cgit v1.1 From ed431431e069b59a1cfdd877134873248d8c93a6 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Mon, 23 Nov 2020 23:28:58 +0000 Subject: c: Allow comparison of pointers to complete and incomplete types for C11 [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 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 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. --- gcc/c/c-typeck.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/c') diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index 286f3d9..cdc491a 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -12266,8 +12266,8 @@ build_binary_op (location_t location, enum tree_code code, result_type = common_pointer_type (type0, type1); if (!COMPLETE_TYPE_P (TREE_TYPE (type0)) != !COMPLETE_TYPE_P (TREE_TYPE (type1))) - pedwarn (location, 0, - "comparison of complete and incomplete pointers"); + pedwarn_c99 (location, OPT_Wpedantic, + "comparison of complete and incomplete pointers"); else if (TREE_CODE (TREE_TYPE (type0)) == FUNCTION_TYPE) pedwarn (location, OPT_Wpedantic, "ISO C forbids " "ordered comparisons of pointers to functions"); -- cgit v1.1 From 8e6198d0f8ef9f7fbf68cb5340b9cbe174d4e58a Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 24 Nov 2020 00:16:44 +0000 Subject: Daily bump. --- gcc/c/ChangeLog | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'gcc/c') diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 7a3c05f..e506034 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,9 @@ +2020-11-23 Joseph Myers + + PR c/95630 + * c-typeck.c (build_binary_op): Use pedwarn_c99 with OPT_Wpedantic + for comparisons of complete and incomplete pointers. + 2020-11-21 Aaron Sawdey * c-aux-info.c (gen_type): Support opaque types. -- cgit v1.1 From 2aaf44a90283156ec0e70ad4d9030f3ba5054c6f Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 24 Nov 2020 09:04:28 +0100 Subject: openmp: Fix C ICE on OpenMP atomics 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 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. --- gcc/c/c-parser.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'gcc/c') diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index 7540a15..d86098a 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -7865,9 +7865,13 @@ c_parser_binary_expression (c_parser *parser, struct c_expr *after, && stack[1].expr.value != error_mark_node \ && (c_tree_equal (stack[0].expr.value, omp_atomic_lhs) \ || c_tree_equal (stack[1].expr.value, omp_atomic_lhs))) \ - stack[0].expr.value \ - = build2 (stack[1].op, TREE_TYPE (stack[0].expr.value), \ - stack[0].expr.value, stack[1].expr.value); \ + { \ + tree t = make_node (stack[1].op); \ + TREE_TYPE (t) = TREE_TYPE (stack[0].expr.value); \ + TREE_OPERAND (t, 0) = stack[0].expr.value; \ + TREE_OPERAND (t, 1) = stack[1].expr.value; \ + stack[0].expr.value = t; \ + } \ else \ stack[sp - 1].expr = parser_build_binary_op (stack[sp].loc, \ stack[sp].op, \ -- cgit v1.1 From 1e2c9a2761097a6758b6aaaf612d629aa7e9febf Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 25 Nov 2020 09:34:01 +0000 Subject: Daily bump. --- gcc/c/ChangeLog | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'gcc/c') diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index e506034..fde2f96 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,10 @@ +2020-11-24 Jakub Jelinek + + 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. + 2020-11-23 Joseph Myers PR c/95630 -- cgit v1.1 From 768ce4f0ceb030e38427e85e483ed44330cd5da7 Mon Sep 17 00:00:00 2001 From: Martin Uecker Date: Thu, 26 Nov 2020 08:12:12 +0100 Subject: C: Do not drop qualifiers in typeof for _Atomic types. [PR65455,PR92935] 2020-11-25 Martin Uecker 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. --- gcc/c/c-parser.c | 9 --------- 1 file changed, 9 deletions(-) (limited to 'gcc/c') diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index d86098a..87ee8f4 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -2224,10 +2224,6 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok, " initializer"); init = convert_lvalue_to_rvalue (init_loc, init, true, true); tree init_type = TREE_TYPE (init.value); - /* As with typeof, remove all qualifiers from atomic types. */ - if (init_type != error_mark_node && TYPE_ATOMIC (init_type)) - init_type - = c_build_qualified_type (init_type, TYPE_UNQUALIFIED); bool vm_type = variably_modified_type_p (init_type, NULL_TREE); if (vm_type) @@ -3743,11 +3739,6 @@ c_parser_typeof_specifier (c_parser *parser) if (was_vm) ret.expr = c_fully_fold (expr.value, false, &ret.expr_const_operands); pop_maybe_used (was_vm); - /* For use in macros such as those in , remove all - qualifiers from atomic types. (const can be an issue for more macros - using typeof than just the ones.) */ - if (ret.spec != error_mark_node && TYPE_ATOMIC (ret.spec)) - ret.spec = c_build_qualified_type (ret.spec, TYPE_UNQUALIFIED); } parens.skip_until_found_close (parser); return ret; -- cgit v1.1 From d48df6f24ba999ad662d3b7c30f7e2180e842149 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 27 Nov 2020 00:16:31 +0000 Subject: Daily bump. --- gcc/c/ChangeLog | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'gcc/c') diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index fde2f96..b97fb74 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,12 @@ +2020-11-26 Martin Uecker + + 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__. + 2020-11-24 Jakub Jelinek PR c/97958 -- cgit v1.1