[Bug c++/83534] C++17: typeinfo for noexcept function lacks noexcept information
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83534 --- Comment #5 from Kamlesh Kumar --- Fixed on trunk
[Bug c++/91979] Incorrect mangling for non-template-argument nullptr expression
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91979 Kamlesh Kumar changed: What|Removed |Added CC||kamleshbhalui at gmail dot com --- Comment #2 from Kamlesh Kumar --- This fixes it. diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index a9333b8..780da9f 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -3400,7 +3400,8 @@ write_template_arg_literal (const tree value) case INTEGER_CST: gcc_assert (!same_type_p (TREE_TYPE (value), boolean_type_node) || integer_zerop (value) || integer_onep (value)); - write_integer_cst (value); + if (TREE_CODE(TREE_TYPE(value)) != NULLPTR_TYPE) + write_integer_cst (value); break; case REAL_CST: diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index aa78c86..199be43 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -861,7 +861,7 @@ CP_STATIC_IF_GLIBCPP_V3 int cplus_demangle_fill_name (struct demangle_component *p, const char *s, int len) { - if (p == NULL || s == NULL || len <= 0) + if (p == NULL || s == NULL || len < 0) return 0; p->d_printing = 0; p->type = DEMANGLE_COMPONENT_NAME;
[Bug c++/91979] Incorrect mangling for non-template-argument nullptr expression
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91979 --- Comment #4 from Kamlesh Kumar --- patch posted at https://gcc.gnu.org/ml/gcc-patches/2019-10/msg01585.html
[Bug c++/92053] Compilation fails or succeeds depending on the optimization flags
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92053 Kamlesh Kumar changed: What|Removed |Added CC||kamleshbhalui at gmail dot com --- Comment #4 from Kamlesh Kumar --- (In reply to Antony Polukhin from comment #2) > Reduced version. Note that Clang reduces to compile it with any -O, while > GCC is fine with it on -O0 https://godbolt.org/z/yTM0a4 : > Clang fails to compile it regardless of any optimization. see at https://godbolt.org/z/jP0Ct2
[Bug target/91927] -mstrict-align doesn't prevent unaligned accesses at -O2 and -O3 on AARCH64 targets
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91927 Kamlesh Kumar changed: What|Removed |Added CC||kamleshbhalui at gmail dot com --- Comment #6 from Kamlesh Kumar --- This Fixes it. diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 2e73f3515bb..155f4c45500 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -16161,15 +16161,9 @@ aarch64_builtin_support_vector_misalignment (machine_mode mode, const_tree type, int misalignment, bool is_packed) { - if (TARGET_SIMD && STRICT_ALIGNMENT) + if (STRICT_ALIGNMENT) { - /* Return if movmisalign pattern is not supported for this mode. */ - if (optab_handler (movmisalign_optab, mode) == CODE_FOR_nothing) -return false; - - /* Misalignment factor is unknown at compile time. */ - if (misalignment == -1) - return false; + return false; } return default_builtin_support_vector_misalignment (mode, type, misalignment, is_packed);
[Bug target/91766] -fvisibility=hidden during -fpic still uses GOT indirection on arm64
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91766 Kamlesh Kumar changed: What|Removed |Added CC||kamleshbhalui at gmail dot com --- Comment #9 from Kamlesh Kumar --- This fixes it. diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 2e73f3515bb..6fb87d5f49f 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -12539,6 +12539,10 @@ aarch64_override_options_internal (struct gcc_options *opts) if (opts->x_flag_strict_volatile_bitfields < 0 && abi_version_at_least (2)) opts->x_flag_strict_volatile_bitfields = 1; + /* defaults to flag_no_common unless disabled with fcommon. */ + if (!global_options_set.x_flag_no_common) + flag_no_common = 1; + if (aarch64_stack_protector_guard == SSP_GLOBAL && opts->x_aarch64_stack_protector_guard_offset_str) {
[Bug target/91766] -fvisibility=hidden during -fpic still uses GOT indirection on arm64
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91766 --- Comment #11 from Kamlesh Kumar --- is this good? diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c index 0fffe60..9fead56 100644 --- a/gcc/c-family/c-opts.c +++ b/gcc/c-family/c-opts.c @@ -814,6 +814,10 @@ c_common_post_options (const char **pfilename) && flag_unsafe_math_optimizations == 0) flag_fp_contract_mode = FP_CONTRACT_OFF; + /* defaults to flag_no_common unless disabled with fcommon. */ + if (!global_options_set.x_flag_no_common) + flag_no_common = 1; + /* If we are compiling C, and we are outside of a standards mode, we can permit the new values from ISO/IEC TS 18661-3 for FLT_EVAL_METHOD. Otherwise, we must restrict the possible values to
[Bug tree-optimization/82803] Wildly excessive calls to __tls_get_addr with optimizations enabled.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82803 Kamlesh Kumar changed: What|Removed |Added CC||kamleshbhalui at gmail dot com --- Comment #13 from Kamlesh Kumar --- Consider this little tweaked testcase in comment#1 static thread_local int s; int g() ; int f(unsigned int c) { int *px = &s + c; while (c--) *px += g(); return *px; } gcc emits single call to __tls_get_addr.
[Bug target/88877] New: rs6000 emits signed extension for unsigned int type(__floatunsidf).
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88877 Bug ID: 88877 Summary: rs6000 emits signed extension for unsigned int type(__floatunsidf). Product: gcc Version: 8.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: kamleshbhalui at gmail dot com Target Milestone: --- consider below testcase: $cat test.c void foo(){ unsigned int x=-1; double d=x; } $./cc1 test.c -msoft-float -m64 $cat test.s .foo: .LFB0: mflr 0 std 0,16(1) stdu 1,-128(1) .LCFI0: li 9,-1 stw 9,112(1) lwa 9,112(1) mr 3,9 bl .__floatunsidf nop mr 9,3 std 9,120(1) nop addi 1,1,128 .LCFI1: ld 0,16(1) mtlr 0 blr .long 0 .byte 0,0,0,1,128,0,0,1 Here, you can see that sign extension before calling the __floatunsidf routine. As per my understanding it should emit zero extension here because __floatunsidf has its argument as unsigned int type.
[Bug target/88877] rs6000 emits signed extension for unsigned int type(__floatunsidf).
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88877 --- Comment #1 from Kamlesh Kumar --- Following patch fixes the problem but would like to know the experts thought on the below patch . static machine_mode -rs6000_promote_function_mode (const_tree type ATTRIBUTE_UNUSED, +rs6000_promote_function_mode (const_tree type , machine_mode mode, - int *punsignedp ATTRIBUTE_UNUSED, + int *punsignedp , const_tree, int) { + if(type) PROMOTE_MODE (mode, *punsignedp, type); - return mode; } Here, argument 'type' being null signifies that it's a libcalls. So we will not promote the mode in this case,is that ok ?
[Bug target/88877] rs6000 emits signed extension for unsigned int type(__floatunsidf).
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88877 --- Comment #9 from Kamlesh Kumar --- following testcase produces wrong result $cat test.c #include int main () { unsigned int x=-1; double d=x; printf("%lf",d); return 0; } $./ccppc -mcpu=e6500 -mabi=elfv2 -msoft-float -m64 test.c $./a.out 9223372036854775810.00 while Expected output is: 4294967295.00
[Bug target/88877] rs6000 emits signed extension for unsigned int type(__floatunsidf).
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88877 --- Comment #13 from Kamlesh Kumar --- (In reply to Alan Modra from comment #12) > I suspect that the patch in comment #1 will break libcalls in other > situations, eg. > > void f1 (int y) > { > extern double d; > d = y; > } Thanks Alan for pointing out. One other patch i am thinking of is --- optabs.c2019-01-18 23:28:09.822024657 +0530 +++ optabs.c2019-01-18 23:28:44.805207684 +0530 @@ -4859,6 +4859,8 @@ libfunc = convert_optab_libfunc (tab, GET_MODE (to), GET_MODE (from)); gcc_assert (libfunc); start_sequence (); + if(unsignedp && !is_narrower_int_mode (GET_MODE (from), SImode)) +from = convert_to_mode (DImode, from, unsignedp); value = emit_library_call_value (libfunc, NULL_RTX, LCT_CONST, GET_MODE (to), from, GET_MODE (from)); insns = get_insns (); Here, I am promoting mode early when we have signedness information. Any thought on this?
[Bug tree-optimization/91504] Inlining misses some logical operation folding
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91504 Kamlesh Kumar changed: What|Removed |Added CC||kamleshbhalui at gmail dot com --- Comment #2 from Kamlesh Kumar --- diff --git a/gcc/match.pd b/gcc/match.pd index 93dcef9..b62ef36 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -137,6 +137,11 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (pointer_plus integer_zerop @1) (non_lvalue (convert @1))) +/* (~value & C) ^ value -> value | C */ +(simplify + (bit_xor:c (bit_and (bit_not @0) INTEGER_CST@1) @0) + (bit_ior @0 @1)) + /* ptr - 0 -> (type)ptr */ (simplify (pointer_diff @0 integer_zerop) = After above both function produces same asm. i.e. foo: movl%edi, %eax orb $4, %ah ret bar: movl%edi, %eax orb $4, %ah ret
[Bug tree-optimization/91504] Inlining misses some logical operation folding
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91504 --- Comment #3 from Kamlesh Kumar --- diff --git a/gcc/match.pd b/gcc/match.pd index 93dcef9..b62ef36 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -137,6 +137,11 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (pointer_plus integer_zerop @1) (non_lvalue (convert @1))) +/* (~value & C) ^ value -> value | C */ +(simplify + (bit_xor:c (bit_and (bit_not @0) INTEGER_CST@1) @0) + (bit_ior @0 @1)) + /* ptr - 0 -> (type)ptr */ (simplify (pointer_diff @0 integer_zerop) = After above both function produces same asm. i.e. foo: movl%edi, %eax orb $4, %ah ret bar: movl%edi, %eax orb $4, %ah ret
[Bug c/53075] -Werror=pedantic should be equivalent to -pedantic-errors
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53075 Kamlesh Kumar changed: What|Removed |Added CC||kamleshbhalui at gmail dot com --- Comment #4 from Kamlesh Kumar --- This patch resolves this. diff --git a/gcc/opts.c b/gcc/opts.c index 1417dba..2e71fef 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -3212,7 +3212,7 @@ option_name (diagnostic_context *context, int option_index, if (option_index) { /* A warning classified as an error. */ - if ((orig_diag_kind == DK_WARNING || orig_diag_kind == DK_PEDWARN) + if ((context->pedantic_errors || orig_diag_kind == DK_WARNING || orig_diag_kind == DK_PEDWARN) && diag_kind == DK_ERROR) return concat (cl_options[OPT_Werror_].opt_text, /* Skip over "-W". */
[Bug ipa/89924] [missed-optimization] Function not de-virtualized within the same TU
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89924 --- Comment #6 from Kamlesh Kumar --- https://gcc.gnu.org/ml/gcc-patches/2019-09/msg01527.html
[Bug ipa/89924] [missed-optimization] Function not de-virtualized within the same TU
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89924 --- Comment #7 from Kamlesh Kumar --- After this patch diff --git a/gcc/ipa-polymorphic-call.c b/gcc/ipa-polymorphic-call.c index 705af03..b76793f 100644 --- a/gcc/ipa-polymorphic-call.c +++ b/gcc/ipa-polymorphic-call.c @@ -1118,6 +1118,10 @@ ipa_polymorphic_call_context::ipa_polymorphic_call_context (tree fndecl, We do not make this type of flow sensitive analysis yet. */ if (instance) *instance = base_pointer; + + if (((TREE_CODE (TREE_TYPE(base_type)) == RECORD_TYPE))) +outer_type = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (base_pointer))); + return; } Gcc produces this code for above reported testcase. .file "test.cpp" .text .section .text._ZN4AintpLERK1A,"axG",@progbits,_ZN4AintpLERK1A,comdat .align 2 .p2align 4 .weak _ZN4AintpLERK1A .type _ZN4AintpLERK1A, @function _ZN4AintpLERK1A: .LFB3: .cfi_startproc movl8(%rsi), %edx movq%rdi, %rax addl%edx, 8(%rdi) ret .cfi_endproc .LFE3: .size _ZN4AintpLERK1A, .-_ZN4AintpLERK1A .text .p2align 4 .globl _Z9foo_innerPi .type _Z9foo_innerPi, @function _Z9foo_innerPi: .LFB0: .cfi_startproc sall(%rdi) ret .cfi_endproc .LFE0: .size _Z9foo_innerPi, .-_Z9foo_innerPi .p2align 4 .globl _Z17foo_virtual_innerP1A .type _Z17foo_virtual_innerP1A, @function _Z17foo_virtual_innerP1A: .LFB1: .cfi_startproc movq(%rdi), %rax movq(%rax), %rax cmpq$_ZN4AintpLERK1A, %rax jne .L5 sall8(%rdi) ret .p2align 4,,10 .p2align 3 .L5: movq%rdi, %rsi jmp *%rax .cfi_endproc .LFE1: .size _Z17foo_virtual_innerP1A, .-_Z17foo_virtual_innerP1A .p2align 4 .globl _Z3fooPi .type _Z3fooPi, @function _Z3fooPi: .LFB6: .cfi_startproc sall(%rdi) ret .cfi_endproc .LFE6: .size _Z3fooPi, .-_Z3fooPi .p2align 4 .globl _Z11foo_virtualP4Aint .type _Z11foo_virtualP4Aint, @function _Z11foo_virtualP4Aint: .LFB4: .cfi_startproc sall8(%rdi) ret .cfi_endproc .LFE4: .size _Z11foo_virtualP4Aint, .-_Z11foo_virtualP4Aint .ident "GCC: (GNU) 10.0.0 20190821 (experimental)" .section.note.GNU-stack,"",@progbits
[Bug c++/83534] C++17: typeinfo for noexcept function lacks noexcept information
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83534 Kamlesh Kumar changed: What|Removed |Added CC||kamleshbhalui at gmail dot com --- Comment #4 from Kamlesh Kumar --- patch posted https://gcc.gnu.org/ml/gcc-patches/2019-10/msg00309.html
[Bug c++/91055] alignof () evaluated before layout is complete?
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91055 Kamlesh Kumar changed: What|Removed |Added CC||kamleshbhalui at gmail dot com --- Comment #1 from Kamlesh Kumar --- This fixes it. diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index f427c4f4d3e..928dc887956 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -1791,6 +1791,11 @@ cxx_alignof_expr (tree e, tsubst_flags_t complain) if (e == error_mark_node) return error_mark_node; + if (current_class_type && TYPE_BEING_DEFINED (current_class_type)) +{ + error ("invalid application of % to a field of a class still being defined"); + return error_mark_node; +} if (processing_template_decl) { e = build_min (ALIGNOF_EXPR, size_type_node, e);
[Bug rtl-optimization/67449] Branch elimination problem on x86
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67449 Kamlesh Kumar changed: What|Removed |Added CC||kamleshbhalui at gmail dot com --- Comment #2 from Kamlesh Kumar --- I have compiled the given test case with gcc for x86-64 linux. And it works fine with the trunk and even specified version.
[Bug c++/97453] New: Implement CWG issue 2303
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97453 Bug ID: 97453 Summary: Implement CWG issue 2303 Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: kamleshbhalui at gmail dot com Target Milestone: --- https://wg21.cmeerw.net/cwg/issue2303 Testcases like below should compile. $cat test.cc template struct A; template <> struct A<> {}; template struct A : A {}; struct B : A {}; template void f(const A&); void g() { f(B{}); }
[Bug c++/97453] Implement CWG issue 2303
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97453 --- Comment #2 from Kamlesh Kumar --- patch: https://gcc.gnu.org/pipermail/gcc-patches/2020-October/556672.html