aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
AgeCommit message (Collapse)AuthorFilesLines
2021-04-30Daily bump.GCC Administrator1-0/+7
2021-04-29c: C2x changes to function type compatibilityJoseph Myers1-2/+2
WG14 N2432, the C2x removal of old-style function definitions, also changed the function type compatibility rules so that an unprototyped declaration can be compatible with a non-variadic prototyped declaration even if some function arguments are changed by the default argument promotions. I missed that change in the initial implementation for GCC of the rest of the N2432 changes, but discussion on the WG14 reflector in February suggests that this is indeed an intended change. Implement this in the C front end. Note that while this may be of use in some cases for use of pointers to unprototyped function types as a kind of generic function pointer, it's *not* possible to call such a function without a prototype visible, without getting runtime undefined behavior from the (promoted) type used in the call being incompatible with the (unpromoted) type in the prototype. Note also that GCC has a longstanding extension to allow compatibility of such a prototype with an old-style definition specifying the same type as in the prototype (which is not valid in ISO C, before old-style definitions were removed in C2x). Bootstrapped with no regressions for x86_64-pc-linux-gnu. gcc/c/ * c-typeck.c (function_types_compatible_p): For C2X, treat unprototyped function as compatible with non-variadic prototyped function even if some argument types are changed by the default argument promotions. gcc/testsuite/ * gcc.dg/c11-unproto-1.c, gcc.dg/c11-unproto-2.c, gcc.dg/c2x-unproto-1.c, gcc.dg/c2x-unproto-2.c: New tests.
2021-04-16Daily bump.GCC Administrator1-0/+12
2021-04-15Propagate type attribute when merging extern declarations at local scope.Martin Sebor1-5/+4
Resolves: PR c/99420 - bogus -Warray-parameter on a function redeclaration in function scope PR c/99972 - missing -Wunused-result on a call to a locally redeclared warn_unused_result function gcc/c/ChangeLog: PR c/99420 PR c/99972 * c-decl.c (pushdecl): Always propagate type attribute. gcc/testsuite/ChangeLog: PR c/99420 PR c/99972 * gcc.dg/Warray-parameter-9.c: New test. * gcc.dg/Wnonnull-6.c: New test. * gcc.dg/Wreturn-type3.c: New test. * gcc.dg/Wunused-result.c: New test. * gcc.dg/attr-noreturn.c: New test. * gcc.dg/attr-returns-nonnull.c: New test.
2021-04-15c: Don't drop vector attributes that affect type identity [PR98852]Richard Sandiford1-2/+8
<arm_neon.h> types are distinct from GNU vector types in at least their mangling. However, there used to be nothing explicit in the VECTOR_TYPE itself to indicate the difference: we simply treated them as distinct TYPE_MAIN_VARIANTs. This caused problems like the ones reported in PR95726. The fix for that PR was to add type attributes to the <arm_neon.h> types, in order to maintain the distinction between them and GNU vectors. However, this in turn caused PR98852, where c_common_type would unconditionally drop the attributes on the source types. This meant that: <arm_neon.h> vector + <arm_neon.h> vector had a GNU vector type rather than an <arm_neon.h> vector type. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96377#c2 for Jakub's analysis of the history of this c_common_type code. TBH I'm not sure which case the build_type_attribute_variant code is handling, but I think we should at least avoid dropping attributes that affect type identity. I've tried to audit the C and target-specific attributes to look for other types that might be affected by this, but I couldn't see any. We are only dealing with: gcc_assert (code1 == VECTOR_TYPE || code1 == COMPLEX_TYPE || code1 == FIXED_POINT_TYPE || code1 == REAL_TYPE || code1 == INTEGER_TYPE); which excludes most affects_type_identity attributes. The closest was s390_vector_bool, but the handler for that attribute changes the type node and drops the attribute itself (*no_add_attrs = true). I put the main list handling into a separate function (remove_attributes_matching) because a later patch will need it for something else. gcc/ PR c/98852 * attribs.h (affects_type_identity_attributes): Declare. * attribs.c (remove_attributes_matching): New function. (affects_type_identity_attributes): Likewise. gcc/c/ PR c/98852 * c-typeck.c (c_common_type): Do not drop attributes that affect type identity. gcc/testsuite/ PR c/98852 * gcc.target/aarch64/advsimd-intrinsics/pr98852.c: New test.
2021-04-11Daily bump.GCC Administrator1-0/+6
2021-04-10c: Avoid clobbering TREE_TYPE (error_mark_node) [PR99990]Jakub Jelinek1-1/+1
The following testcase ICEs during error recovery, because finish_decl overwrites TREE_TYPE (error_mark_node), which better should stay always to be error_mark_node. 2021-04-10 Jakub Jelinek <jakub@redhat.com> PR c/99990 * c-decl.c (finish_decl): Don't overwrite TREE_TYPE of error_mark_node. * gcc.dg/pr99990.c: New test.
2021-03-26Daily bump.GCC Administrator1-0/+6
2021-03-25c-family: Fix up -Wduplicated-branches for union members [PR99565]Jakub Jelinek1-1/+1
Honza has fairly recently changed operand_equal_p to compare DECL_FIELD_OFFSET for COMPONENT_REFs when comparing addresses. As the first testcase in this patch shows, while that is very nice for optimizations, for the -Wduplicated-branches warning it causes regressions. Pedantically a union in both C and C++ has only one active member at a time, so using some other union member even if it has the same type is UB, so I think the warning shouldn't warn when it sees access to different fields that happen to have the same offset and should consider them different. In my first attempt to fix this I've keyed the old behavior on OEP_LEXICOGRAPHIC, but unfortunately that has various problems, the warning has a quick non-lexicographic compare in build_conditional_expr* and another lexicographic more expensive one later during genericization and turning the first one into lexicographic would mean wasting compile time on large conditionals. So, this patch instead introduces a new OEP_ flag and makes sure to pass it to operand_equal_p in all -Wduplicated-branches cases. The cvt.c changes are because on the other testcase we were warning with UNKNOWN_LOCATION, so the user wouldn't really know where the questionable code is. 2021-03-25 Jakub Jelinek <jakub@redhat.com> PR c++/99565 * tree-core.h (enum operand_equal_flag): Add OEP_ADDRESS_OF_SAME_FIELD. * fold-const.c (operand_compare::operand_equal_p): Don't compare field offsets if OEP_ADDRESS_OF_SAME_FIELD. * c-warn.c (do_warn_duplicated_branches): Pass also OEP_ADDRESS_OF_SAME_FIELD to operand_equal_p. * c-typeck.c (build_conditional_expr): Pass OEP_ADDRESS_OF_SAME_FIELD to operand_equal_p. * call.c (build_conditional_expr_1): Pass OEP_ADDRESS_OF_SAME_FIELD to operand_equal_p. * cvt.c (convert_to_void): Preserve location_t on COND_EXPR or or COMPOUND_EXPR. * g++.dg/warn/Wduplicated-branches6.C: New test. * g++.dg/warn/Wduplicated-branches7.C: New test.
2021-03-20Daily bump.GCC Administrator1-0/+10
2021-03-19c: Fix up -Wunused-but-set-* warnings for _Atomics [PR99588]Jakub Jelinek1-6/+60
As the following testcases show, compared to -D_Atomic= case we have many -Wunused-but-set-* warning false positives. When an _Atomic variable/parameter is read, we call mark_exp_read on it in convert_lvalue_to_rvalue, but build_atomic_assign does not. For consistency with the non-_Atomic case where we mark_exp_read the lhs for lhs op= ... but not for lhs = ..., this patch does that too. But furthermore we need to pattern match the trees emitted by _Atomic store, so that _Atomic store itself is not marked as being a variable read, but when the result of the store is used, we mark it. 2021-03-19 Jakub Jelinek <jakub@redhat.com> PR c/99588 * c-typeck.c (mark_exp_read): Recognize what build_atomic_assign with modifycode NOP_EXPR produces and mark the _Atomic var as read if found. (build_atomic_assign): For modifycode of NOP_EXPR, use COMPOUND_EXPRs rather than STATEMENT_LIST. Otherwise call mark_exp_read on lhs. Set TREE_SIDE_EFFECTS on the TARGET_EXPR. * gcc.dg/Wunused-var-5.c: New test. * gcc.dg/Wunused-var-6.c: New test.
2021-03-16Daily bump.GCC Administrator1-0/+6
2021-03-15OpenMP: Fix 'omp declare target' handling for vars [PR99509]Tobias Burnus1-3/+19
For variables with 'declare target' attribute, varpool_node::get_create marks variables as offload; however, if the node already exists, it is not updated. C/C++ may tag decl with 'declare target implicit', which may only be after varpool creation turned into 'declare target' or 'declare target link'; in this case, the tagging has to happen in the FE. gcc/c/ChangeLog: PR c++/99509 * c-decl.c (finish_decl): For 'omp declare target implicit' vars, ensure that the varpool node is marked as offloadable. gcc/cp/ChangeLog: PR c++/99509 * decl.c (cp_finish_decl): For 'omp declare target implicit' vars, ensure that the varpool node is marked as offloadable. libgomp/ChangeLog: PR c++/99509 * testsuite/libgomp.c-c++-common/declare_target-1.c: New test.
2021-03-06Daily bump.GCC Administrator1-0/+5
2021-03-05OpenACC: C/C++ - fix async parsing [PR99137]Tobias Burnus1-1/+1
gcc/c/ChangeLog: PR c/99137 * c-parser.c (c_parser_oacc_clause_async): Reject comma expressions. gcc/cp/ChangeLog: PR c/99137 * parser.c (cp_parser_oacc_clause_async): Reject comma expressions. gcc/testsuite/ChangeLog: PR c/99137 * c-c++-common/goacc/asyncwait-1.c: Update dg-error; add additional test.
2021-02-25Daily bump.GCC Administrator1-0/+5
2021-02-24PR middle-end/97172 - ICE: tree code 'ssa_name' is not supported in LTO streamsMartin Sebor1-0/+4
gcc/ChangeLog: PR middle-end/97172 * attribs.c (attr_access::free_lang_data): Clear attribute arg spec from function arguments. gcc/c/ChangeLog: PR middle-end/97172 * c-decl.c (free_attr_access_data): Clear attribute arg spec. gcc/testsuite/ChangeLog: PR middle-end/97172 * gcc.dg/pr97172-2.c: New test.
2021-02-19Daily bump.GCC Administrator1-0/+6
2021-02-18c: Fix ICE with -fexcess-precision=standard [PR99136]Jakub Jelinek1-1/+3
The following testcase ICEs on i686-linux, because c_finish_return wraps c_fully_folded retval back into EXCESS_PRECISION_EXPR, but when the function return type is void, we don't call convert_for_assignment on it that would then be fully folded again, but just put the retval into RETURN_EXPR's operand, so nothing removes it anymore and during gimplification we ICE as EXCESS_PRECISION_EXPR is not handled. This patch fixes it by not adding that EXCESS_PRECISION_EXPR in functions returning void, the return value is ignored and all we need is evaluate any side-effects of the expression. 2021-02-18 Jakub Jelinek <jakub@redhat.com> PR c/99136 * c-typeck.c (c_finish_return): Don't wrap retval into EXCESS_PRECISION_EXPR in functions that return void. * gcc.dg/pr99136.c: New test.
2021-02-12Daily bump.GCC Administrator1-0/+4
2021-02-10c, c++: Plug -Wduplicated-cond memory leaks [PR99057]Marek Polacek1-12/+6
Freeing the condition chain needs to use vec_free which does ->release, or we leak memory. gcc/c/ChangeLog: * c-parser.c (c_parser_if_statement): Use vec_free. gcc/cp/ChangeLog: * parser.c (cp_parser_selection_statement): Use vec_free.
2021-02-05Daily bump.GCC Administrator1-0/+9
2021-02-04PR c/97882 - Segmentation Fault on improper redeclaration of functionMartin Sebor2-16/+30
gcc/c/ChangeLog: PR c/97882 * c-decl.c (locate_old_decl): Add type to diagnostic output. (diagnose_mismatched_decls): Same. (start_function): Introduce temporaries for better readability. * c-typeck.c (comptypes_internal): Only consider complete enum types in comparisons with integers. gcc/testsuite/ChangeLog: PR c/97882 * gcc.dg/decl-8.c: Adjust text of expected diagnostic. * gcc.dg/label-decl-4.c: Same. * gcc.dg/mismatch-decl-1.c: Same. * gcc.dg/old-style-then-proto-1.c: Same. * gcc.dg/parm-mismatch-1.c: Same. * gcc.dg/pr35445.c: Same. * gcc.dg/redecl-11.c: Same. * gcc.dg/redecl-12.c: Same. * gcc.dg/redecl-13.c: Same. * gcc.dg/redecl-15.c: Same. * gcc.dg/tls/thr-init-1.c: Same. * objc.dg/id-1.m: Same. * objc.dg/tls/diag-3.m: Same. * gcc.dg/pr97882.c: New test. * gcc.dg/qual-return-7.c: New test. * gcc.dg/qual-return-8.c: New test.
2021-02-02Daily bump.GCC Administrator1-0/+6
2021-02-01Reset front end trees before they make it into the middle end (PR ↵Martin Sebor1-0/+24
middle-end/97172). gcc/ChangeLog: PR middle-end/97172 * attribs.c (attr_access::free_lang_data): Define new function. * attribs.h (attr_access::free_lang_data): Declare new function. gcc/c/ChangeLog: PR middle-end/97172 * c-decl.c (free_attr_access_data): New function. (c_parse_final_cleanups): Call free_attr_access_data. gcc/testsuite/ChangeLog: PR middle-end/97172 * gcc.dg/pr97172.c: New test.
2021-01-17Daily bump.GCC Administrator1-0/+9
2021-01-16openmp: Add support for the OpenMP 5.0 task detach clauseKwok Cheung Yeung2-2/+113
2021-01-16 Kwok Cheung Yeung <kcy@codesourcery.com> gcc/ * builtin-types.def (BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR_INT): Rename to... (BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR_INT_PTR): ...this. Add extra argument. * gimplify.c (omp_default_clause): Ensure that event handle is firstprivate in a task region. (gimplify_scan_omp_clauses): Handle OMP_CLAUSE_DETACH. (gimplify_adjust_omp_clauses): Likewise. * omp-builtins.def (BUILT_IN_GOMP_TASK): Change function type to BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR_INT_PTR. * omp-expand.c (expand_task_call): Add GOMP_TASK_FLAG_DETACH to flags if detach clause specified. Add detach argument when generating call to GOMP_task. * omp-low.c (scan_sharing_clauses): Setup data environment for detach clause. (finish_taskreg_scan): Move field for variable containing the event handle to the front of the struct. * tree-core.h (enum omp_clause_code): Add OMP_CLAUSE_DETACH. Fix ordering. * tree-nested.c (convert_nonlocal_omp_clauses): Handle OMP_CLAUSE_DETACH clause. (convert_local_omp_clauses): Handle OMP_CLAUSE_DETACH clause. * tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE_DETACH. * tree.c (omp_clause_num_ops): Add entry for OMP_CLAUSE_DETACH. Fix ordering. (omp_clause_code_name): Add entry for OMP_CLAUSE_DETACH. Fix ordering. (walk_tree_1): Handle OMP_CLAUSE_DETACH. gcc/c-family/ * c-pragma.h (pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_DETACH. Redefine PRAGMA_OACC_CLAUSE_DETACH. gcc/c/ * c-parser.c (c_parser_omp_clause_detach): New. (c_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_DETACH clause. (OMP_TASK_CLAUSE_MASK): Add mask for PRAGMA_OMP_CLAUSE_DETACH. * c-typeck.c (c_finish_omp_clauses): Handle PRAGMA_OMP_CLAUSE_DETACH clause. Prevent use of detach with mergeable and overriding the data sharing mode of the event handle. gcc/cp/ * parser.c (cp_parser_omp_clause_detach): New. (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_DETACH. (OMP_TASK_CLAUSE_MASK): Add mask for PRAGMA_OMP_CLAUSE_DETACH. * pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_DETACH clause. * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_DETACH clause. Prevent use of detach with mergeable and overriding the data sharing mode of the event handle. gcc/fortran/ * dump-parse-tree.c (show_omp_clauses): Handle detach clause. * frontend-passes.c (gfc_code_walker): Walk detach expression. * gfortran.h (struct gfc_omp_clauses): Add detach field. (gfc_c_intptr_kind): New. * openmp.c (gfc_free_omp_clauses): Free detach clause. (gfc_match_omp_detach): New. (enum omp_mask1): Add OMP_CLAUSE_DETACH. (enum omp_mask2): Remove OMP_CLAUSE_DETACH. (gfc_match_omp_clauses): Handle OMP_CLAUSE_DETACH for OpenMP. (OMP_TASK_CLAUSES): Add OMP_CLAUSE_DETACH. (resolve_omp_clauses): Prevent use of detach with mergeable and overriding the data sharing mode of the event handle. * trans-openmp.c (gfc_trans_omp_clauses): Handle detach clause. * trans-types.c (gfc_c_intptr_kind): New. (gfc_init_kinds): Initialize gfc_c_intptr_kind. * types.def (BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR_INT): Rename to... (BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR_INT_PTR): ...this. Add extra argument. gcc/testsuite/ * c-c++-common/gomp/task-detach-1.c: New. * g++.dg/gomp/task-detach-1.C: New. * gcc.dg/gomp/task-detach-1.c: New. * gfortran.dg/gomp/task-detach-1.f90: New. include/ * gomp-constants.h (GOMP_TASK_FLAG_DETACH): New. libgomp/ * fortran.c (omp_fulfill_event_): New. * libgomp.h (struct gomp_task): Add detach and completion_sem fields. (struct gomp_team): Add task_detach_queue and task_detach_count fields. * libgomp.map (OMP_5.0.1): Add omp_fulfill_event and omp_fulfill_event_. * libgomp_g.h (GOMP_task): Add extra argument. * omp.h.in (enum omp_event_handle_t): New. (omp_fulfill_event): New. * omp_lib.f90.in (omp_event_handle_kind): New. (omp_fulfill_event): New. * omp_lib.h.in (omp_event_handle_kind): New. (omp_fulfill_event): Declare. * priority_queue.c (priority_tree_find): New. (priority_list_find): New. (priority_queue_find): New. * priority_queue.h (priority_queue_predicate): New. (priority_queue_find): New. * task.c (gomp_init_task): Initialize detach field. (task_fulfilled_p): New. (GOMP_task): Add detach argument. Ignore detach argument if GOMP_TASK_FLAG_DETACH not set in flags. Initialize completion_sem field. Copy address of completion_sem into detach argument and into the start of the data record. Wait for detach event if task not deferred. (gomp_barrier_handle_tasks): Queue tasks with unfulfilled events. Remove completed tasks and requeue dependent tasks. (omp_fulfill_event): New. * team.c (gomp_new_team): Initialize task_detach_queue and task_detach_count fields. (free_team): Free task_detach_queue field. * testsuite/libgomp.c-c++-common/task-detach-1.c: New testcase. * testsuite/libgomp.c-c++-common/task-detach-2.c: New testcase. * testsuite/libgomp.c-c++-common/task-detach-3.c: New testcase. * testsuite/libgomp.c-c++-common/task-detach-4.c: New testcase. * testsuite/libgomp.c-c++-common/task-detach-5.c: New testcase. * testsuite/libgomp.c-c++-common/task-detach-6.c: New testcase. * testsuite/libgomp.fortran/task-detach-1.f90: New testcase. * testsuite/libgomp.fortran/task-detach-2.f90: New testcase. * testsuite/libgomp.fortran/task-detach-3.f90: New testcase. * testsuite/libgomp.fortran/task-detach-4.f90: New testcase. * testsuite/libgomp.fortran/task-detach-5.f90: New testcase. * testsuite/libgomp.fortran/task-detach-6.f90: New testcase.
2021-01-16Daily bump.GCC Administrator1-0/+6
2021-01-15openmp: Change the way of building of reduction array typeJakub Jelinek1-1/+3
The PR98597 patch regresses on _Atomic-3.c, as in the C FE building an array type with qualified elements results in a type incompatible with when an array type with unqualified elements is qualified afterwards. This patch adds a workaround for that. 2021-01-15 Jakub Jelinek <jakub@redhat.com> * c-typeck.c (c_finish_omp_clauses): For reduction build array with unqualified element type and then call c_build_qualified_type on the ARRAY_TYPE.
2021-01-08Daily bump.GCC Administrator1-0/+5
2021-01-07fix GIMPLE parser for loopsRichard Biener1-2/+3
We do not tolerate "growing" a vector to a lower size. 2021-01-07 Richard Biener <rguenther@suse.de> gcc/c/ * gimple-parser.c (c_parser_gimple_compound_statement): Only reallocate loop array if it is too small.
2021-01-04Update copyright years.Jakub Jelinek18-18/+18
2021-01-04Update Copyright in ChangeLog filesJakub Jelinek1-1/+1
Do this separately from all other Copyright updates, as ChangeLog files can be modified only separately.
2020-12-17Daily bump.GCC Administrator1-0/+11
2020-12-16C: Drop qualifiers of assignment expressions. [PR98047]Martin Uecker1-10/+3
ISO C17 6.5.15.1 specifies that the result is the type the LHS would have after lvalue conversion. 2020-12-16 Martin Uecker <muecker@gwdg.de> gcc/c/ PR c/98047 * c-typeck.c (build_modify_expr): Drop qualifiers. gcc/testsuite/ PR c/98047 * gcc.dg/qual-assign-7.c: New test.
2020-12-16C: Avoid incorrect warning for volatile in compound expressions [PR98260]Martin Uecker1-2/+8
2020-12-16 Martin Uecker <muecker@gwdg.de> gcc/c/ PR c/98260 * c-parser.c (c_parser_expression): Look into nop expression when marking expressions as read. gcc/testsuite/ PR c/98260 * gcc.dg/unused-9.c: New test.
2020-12-15Daily bump.GCC Administrator1-0/+7
2020-12-14sanitizer: do not ICE for pointer cmp/subMartin Liska1-3/+3
gcc/c/ChangeLog: PR sanitizer/98204 * c-typeck.c (pointer_diff): Do not emit a top-level sanitization. (build_binary_op): Likewise. gcc/testsuite/ChangeLog: PR sanitizer/98204 * c-c++-common/asan/pr98204.c: New test.
2020-12-10Daily bump.GCC Administrator1-0/+11
2020-12-09OpenMP: C/C++ parse 'omp allocate'Tobias Burnus1-0/+52
gcc/c-family/ChangeLog: * c-pragma.c (omp_pragmas): Add 'allocate'. * c-pragma.h (enum pragma_kind): Add PRAGMA_OMP_ALLOCATE. gcc/c/ChangeLog: * c-parser.c (c_parser_omp_allocate): New. (c_parser_omp_construct): Call it. gcc/cp/ChangeLog: * parser.c (cp_parser_omp_allocate): New. (cp_parser_omp_construct, cp_parser_pragma): Call it. gcc/testsuite/ChangeLog: * c-c++-common/gomp/allocate-5.c: New test.
2020-12-09c/98200 - improve error recovery for GIMPLE FERichard Biener1-0/+2
This avoids ICEing by making sure to propagate error early. 2020-12-09 Richard Biener <rguenther@suse.de> PR c/98200 gcc/c/ * gimple-parser.c (c_parser_gimple_postfix_expression): Return early on error. gcc/testsuite/ * gcc.dg/gimplefe-error-8.c: New testcase.
2020-12-08Daily bump.GCC Administrator1-0/+6
2020-12-07C: Fix atomic loads. [PR97981]Martin Uecker1-3/+3
To handle atomic loads correctly, we need to move the code that drops qualifiers in lvalue conversion after the code that handles atomics. 2020-12-07 Martin Uecker <muecker@gwdg.de> gcc/c/ PR c/97981 * c-typeck.c (convert_lvalue_to_rvalue): Move the code that drops qualifiers to the end of the function. gcc/testsuite/ PR c/97981 * gcc.dg/pr97981.c: New test. * gcc.dg/pr60195.c: Adapt test.
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