[Bug c++/108676] New: GCC prints function signature incorrectly

2023-02-05 Thread vanyacpp at gmail dot com via Gcc-bugs
++ Assignee: unassigned at gcc dot gnu.org Reporter: vanyacpp at gmail dot com Target Milestone: --- Consider this code: template struct X {}; template X f(); template X g(); int main() { g(); } On GCC 12.2 it gives this error message: :13:12: error: no matching

[Bug c++/108676] template parameters are misprinted in function signature

2023-02-05 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108676 --- Comment #1 from Ivan Sorokin --- I added a broken link to godbolt, here is a valid one: https://godbolt.org/z/EE5eezW1r

[Bug c++/108676] template parameters are misprinted in function signature

2023-02-06 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108676 Ivan Sorokin changed: What|Removed |Added Resolution|--- |DUPLICATE Status|NEW

[Bug c++/66968] Incorrect template argument shown in diagnostic

2023-02-06 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66968 Ivan Sorokin changed: What|Removed |Added CC||vanyacpp at gmail dot com --- Comment #9

[Bug c++/66968] Incorrect template argument shown in diagnostic

2023-02-06 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66968 --- Comment #10 from Ivan Sorokin --- One more case (from 108676): template struct X {}; template X f(); template X g(); int main() { g(); } Here 'X' is printed in the error message instead of 'X'.

[Bug c++/108219] [12 Regression] requirement fails on a valid expression since r12-5253-g4df7f8c79835d569

2023-03-03 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108219 --- Comment #5 from Ivan Sorokin --- (In reply to Patrick Palka from comment #4) > Fixed for GCC 13 so far Thank you very much!

[Bug c++/105099] New: In lookup for namespace name qualifiers only namespaces should be considered

2022-03-29 Thread vanyacpp at gmail dot com via Gcc-bugs
: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: vanyacpp at gmail dot com Target Milestone: --- Consider this code: namespace a { namespace c {} struct a {}; namespace b = a::c; // (1) using

[Bug sanitizer/105141] #pragma pack(1) causes incorrect UBSAN warning

2022-04-04 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105141 Ivan Sorokin changed: What|Removed |Added CC||vanyacpp at gmail dot com --- Comment

[Bug middle-end/105762] [12/13 Regression] -Warray-bounds false positives for integer-to-pointer casts since r12-2132-ga110855667782dac

2022-08-05 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105762 Ivan Sorokin changed: What|Removed |Added CC||vanyacpp at gmail dot com --- Comment

[Bug tree-optimization/98709] gcc optimizes bitwise operations, but doesn't optimize logical ones

2022-08-10 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98709 Ivan Sorokin changed: What|Removed |Added Status|NEW |RESOLVED Resolution|---

[Bug middle-end/19987] [meta-bug] fold missing optimizations in general

2022-08-10 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=19987 Bug 19987 depends on bug 98709, which changed state. Bug 98709 Summary: gcc optimizes bitwise operations, but doesn't optimize logical ones https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98709 What|Removed |Added

[Bug tree-optimization/101706] bool0^bool1^1 -> bool0 == bool1

2022-08-10 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101706 Ivan Sorokin changed: What|Removed |Added CC||vanyacpp at gmail dot com --- Comment

[Bug libstdc++/103382] condition_variable::wait() is not cancellable because it is marked noexcept

2022-09-06 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103382 Ivan Sorokin changed: What|Removed |Added Status|NEW |RESOLVED Resolution|---

[Bug c++/107161] New: gcc doesn't constant fold member if any other member is mutable

2022-10-05 Thread vanyacpp at gmail dot com via Gcc-bugs
ormal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: vanyacpp at gmail dot com Target Milestone: --- On this code: struct mytype { int a; mutable int b; }; extern mytype const p = {1, 2}; int foo() { return p.a

[Bug c++/107161] gcc doesn't constant fold member if any other member is mutable

2022-10-06 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107161 --- Comment #2 from Ivan Sorokin --- > Do constexpr/consteval work in such circumstances? Yes, constexpr works for variables like "p.a": extern constexpr mytype p = {1, 2}; int foo() { constexpr int t = p.a + 10; return t; } foo():

[Bug libstdc++/103382] New: condition_variable::wait() is not cancellable because it is marked noexcept

2021-11-23 Thread vanyacpp at gmail dot com via Gcc-bugs
: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: vanyacpp at gmail dot com Target Milestone: --- At the moment condition_variable::wait() is marked noexcept. It means that if pthread_cond_wait() acts as cancellation

[Bug libstdc++/103382] condition_variable::wait() is not cancellable because it is marked noexcept

2021-11-23 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103382 --- Comment #1 from Ivan Sorokin --- Please note there was a related issue PR67726. I hope it is possible to meet the requirements mentioned in the issue as well as enabling cancellation.

[Bug libstdc++/103382] condition_variable::wait() is not cancellable because it is marked noexcept

2021-11-24 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103382 --- Comment #3 from Ivan Sorokin --- > Huh, I thought it was noexcept. Then yes, we should remove it. Thank you very much! I'm looking forward for a fix. > There are still lots of other places where the stadnard does require > 'noexcept' and

[Bug tree-optimization/103559] Can't optimize away < 0 check on sqrt

2021-12-05 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103559 Ivan Sorokin changed: What|Removed |Added CC||vanyacpp at gmail dot com --- Comment

[Bug c++/103566] New: confusing error message for typedefs with initializers

2021-12-05 Thread vanyacpp at gmail dot com via Gcc-bugs
Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: vanyacpp at gmail dot com Target Milestone: --- On this code GCC says: typedef int foo = 42; error: typedef 'foo' is initialized (use 'decltype' instead) I believe this error message is

[Bug c++/102335] New: gcc misses -Wunused-value

2021-09-14 Thread vanyacpp at gmail dot com via Gcc-bugs
++ Assignee: unassigned at gcc dot gnu.org Reporter: vanyacpp at gmail dot com Target Milestone: --- struct mytype { int memfun [[gnu::pure]] (); }; void test() { mytype x; x.memfun();// -Wunused-value mytype().memfun(); // no -Wunused-value } https://godbolt.org/z

[Bug tree-optimization/98774] gcc -O3 does not vectorize some operations

2021-09-14 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98774 --- Comment #4 from Ivan Sorokin --- I retested the sample on GCC 11.2. https://godbolt.org/z/xrarP3zbY Compared to Clang 12.0.1 GCC still generates 6 more instructions in total and does 6 mulpd against Clang's 4 mulpd.

[Bug target/102355] New: excessive stack usage

2021-09-15 Thread vanyacpp at gmail dot com via Gcc-bugs
: unassigned at gcc dot gnu.org Reporter: vanyacpp at gmail dot com Target Milestone: --- void escape(unsigned long long& a); void foobar() { unsigned long long local; escape(local); } For the function "foobar" GCC allocates excessive stack space: foobar(

[Bug c++/61355] gcc doesn't normalize type in non-type template parameters

2021-10-10 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61355 --- Comment #6 from Ivan Sorokin --- (In reply to Patrick Palka from comment #5) > Fixed for GCC 12. Thanks!

[Bug c++/102704] New: NRVO for throw expression

2021-10-12 Thread vanyacpp at gmail dot com via Gcc-bugs
++ Assignee: unassigned at gcc dot gnu.org Reporter: vanyacpp at gmail dot com Target Milestone: --- Consider this code: struct mytype { mytype(); mytype(mytype const&); mytype(mytype&&); }; void test() { mytype e; throw e; } Currently for function test() GCC g

[Bug tree-optimization/102888] New: missing case for combining / and % into one operation

2021-10-21 Thread vanyacpp at gmail dot com via Gcc-bugs
Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: vanyacpp at gmail dot com Target Milestone: --- Normally GCC combines a/b and a%b into one operation when they are computed in the same basic-block. The example below has two functions. For one GCC is

[Bug c++/102881] gcc totally broken when trailing return type combine with decltype lambda

2021-10-22 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102881 Ivan Sorokin changed: What|Removed |Added CC||vanyacpp at gmail dot com --- Comment

[Bug c++/107528] New: constexpr evaluator doesn't check for deallocate of mismatched size

2022-11-04 Thread vanyacpp at gmail dot com via Gcc-bugs
ormal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: vanyacpp at gmail dot com Target Milestone: --- This functions causes undefined behavior and should not be evaluated at compile-time. The problem is the second argume

[Bug c++/107529] New: constexpr evaluator doesn't check for destroyed objects

2022-11-04 Thread vanyacpp at gmail dot com via Gcc-bugs
ormal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: vanyacpp at gmail dot com Target Milestone: --- I believe this function contains undefined behavior and should not be allowed to evaluate at compile-time. The call to `std::destroy

[Bug c++/108219] New: requirement fails on a valid expression

2022-12-24 Thread vanyacpp at gmail dot com via Gcc-bugs
++ Assignee: unassigned at gcc dot gnu.org Reporter: vanyacpp at gmail dot com Target Milestone: --- This code compiles OK on clang, MSVC and GCC prior to 12: template concept test = requires { new T[1]{{ 42 }}; }; struct foobar { foobar(int); }; int main

[Bug c++/104503] [12 regression][modules] bits/shared_ptr_base.h: error: must ‘#include ’ before using ‘typeid’

2022-05-10 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104503 Ivan Sorokin changed: What|Removed |Added CC||vanyacpp at gmail dot com --- Comment

[Bug middle-end/105862] New: missed inlining opportunity of _Sp_counted_deleter::_M_destroy

2022-06-06 Thread vanyacpp at gmail dot com via Gcc-bugs
Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: vanyacpp at gmail dot com Target Milestone: --- This sample is reduced from a real usage of shared_ptr. #include #include struct sp_counted_base { sp_counted_base

[Bug tree-optimization/105864] New: storing nullptr_t to memory should not generate any instructions

2022-06-06 Thread vanyacpp at gmail dot com via Gcc-bugs
Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: vanyacpp at gmail dot com Target Milestone: --- Currently storing a nullptr_t to memory causes 0 to be written to that memory. As there is no way to read this value back

[Bug c++/105864] storing nullptr_t to memory should not generate any instructions

2022-06-21 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105864 --- Comment #5 from Ivan Sorokin --- I would suggest (In reply to Andrew Pinski from comment #4) > nullptr_t t, t1 = nullptr; > __builtin_memcpy(&a[0], &t, sizeof(t)); > So I suspect this should be marked as invalid. The questions is how G

[Bug middle-end/109986] missing fold (~a | b) ^ a => ~(a & b)

2023-07-27 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109986 --- Comment #5 from Ivan Sorokin --- (In reply to CVS Commits from comment #4) > commit r14-2751-g2a3556376c69a1fb588dcf25225950575e42784f > Author: Drew Ross > Co-authored-by: Jakub Jelinek Thank you!

[Bug middle-end/98710] missing optimization (x | c) & ~(y | c) -> x & ~(y | c)

2023-09-22 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98710 --- Comment #7 from Ivan Sorokin --- (In reply to Andrew Pinski from comment #6) > Fixed. Thank you!

[Bug middle-end/98710] missing optimization (x | c) & ~(y | c) -> x & ~(y | c)

2023-09-22 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98710 --- Comment #8 from Ivan Sorokin --- > How often these show up, I have no idea. Perhaps I should have written this in the original message. The original expression "(x | c) & ~(y | c)" is obviously a reduced version of what happens in real

[Bug middle-end/111541] New: missing optimization x & ~c | (y | c) -> x | (y | c)

2023-09-22 Thread vanyacpp at gmail dot com via Gcc-bugs
ity: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: vanyacpp at gmail dot com Target Milestone: --- On this function clang generates shorter code: unsigned foo(unsigned x, unsigned y, unsigned c) { return x & ~c | (y | c); } Clang notic

[Bug tree-optimization/111718] Missed optimization of '(a+a)/a'

2023-10-07 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111718 Ivan Sorokin changed: What|Removed |Added CC||vanyacpp at gmail dot com --- Comment

[Bug rtl-optimization/109527] New: redundant register assignment

2023-04-15 Thread vanyacpp at gmail dot com via Gcc-bugs
Assignee: unassigned at gcc dot gnu.org Reporter: vanyacpp at gmail dot com Target Milestone: --- On this function short test(short* a) { *a = 1; return *a; } latest gcc -O2 generates: test(short*): mov eax, 1 mov WORD PTR [rdi], ax

[Bug analyzer/109570] New: detect fclose on unopened or NULL files

2023-04-20 Thread vanyacpp at gmail dot com via Gcc-bugs
: analyzer Assignee: dmalcolm at gcc dot gnu.org Reporter: vanyacpp at gmail dot com Target Milestone: --- While cleaning up one not particularly well written program I noticed this code fragment: FILE* file = fopen(...); if (!file) { fclose(file); return false; } Passing

[Bug analyzer/109570] detect fclose on unopened or NULL files

2023-04-20 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109570 --- Comment #1 from Ivan Sorokin --- Generalizing. Perhaps similarly free(NULL) can be detected? void* obj = malloc(...); if (!obj) { free(obj); return false; } Unliky fclose(NULL), free(NULL) is completely well defined operation, but

[Bug target/99087] suboptimal codegen for division by constant 3

2023-10-19 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99087 Ivan Sorokin changed: What|Removed |Added Status|NEW |RESOLVED Resolution|---

[Bug c++/112410] New: error when auto(x) is used in a variable initializer

2023-11-06 Thread vanyacpp at gmail dot com via Gcc-bugs
Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: vanyacpp at gmail dot com Target Milestone: --- int x = auto(42); // OK int y(auto(42)); // error On the second line GCC -std=c++23 gives an error: error: non-function 'y' declared as implicit template

[Bug libstdc++/112480] optional::reset emits inefficient code when T is trivially-destructible

2023-11-13 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112480 Ivan Sorokin changed: What|Removed |Added CC||vanyacpp at gmail dot com --- Comment

[Bug libstdc++/112480] optional::reset emits inefficient code when T is trivially-destructible

2023-11-13 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112480 --- Comment #7 from Ivan Sorokin --- (In reply to Jonathan Wakely from comment #6) > + // The following seems redundant but improves codegen, see PR 112480. > + if constexpr (is_trivially_destructible_v<_Tp>) > + this->_M_en

[Bug tree-optimization/112533] New: missed optimization (~A & C) == (~B & C) => (A & C) == (B & C)

2023-11-14 Thread vanyacpp at gmail dot com via Gcc-bugs
Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: vanyacpp at gmail dot com Target Milestone: --- On this code static bool is_even(unsigned a) { return a % 2 == 0; } bool same_evenness(uns

[Bug tree-optimization/71990] Function multiversioning prohibits inlining

2023-05-22 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71990 Ivan Sorokin changed: What|Removed |Added CC||vanyacpp at gmail dot com --- Comment #5

[Bug middle-end/109986] New: missing fold (~a | b) ^ a => ~(a & b)

2023-05-26 Thread vanyacpp at gmail dot com via Gcc-bugs
middle-end Assignee: unassigned at gcc dot gnu.org Reporter: vanyacpp at gmail dot com Target Milestone: --- int foo(int a, int b) { return (~a | b) ^ a; } This can be optimized to `return ~(a | b);`. This transformation is done by LLVM, but not by GCC.

[Bug middle-end/109986] missing fold (~a | b) ^ a => ~(a & b)

2023-05-26 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109986 --- Comment #1 from Ivan Sorokin --- (In reply to Ivan Sorokin from comment #0) > int foo(int a, int b) > { > return (~a | b) ^ a; > } > > This can be optimized to `return ~(a | b);`. This transformation is done by > LLVM, but not by GCC.

[Bug middle-end/109986] missing fold (~a | b) ^ a => ~(a & b)

2023-06-24 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109986 --- Comment #3 from Ivan Sorokin --- I tried to investigate why GCC is able to simplify `(a | b) ^ a` and `(a | ~b) ^ a` from comment 2, but not similarly looking `(~a | b) ^ a` from comment 0. `(a | b) ^ a` matches the following pattern from m

[Bug middle-end/110534] New: confusing -Wuninitialized when strict aliasing is violated

2023-07-03 Thread vanyacpp at gmail dot com via Gcc-bugs
Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: vanyacpp at gmail dot com Target Milestone: --- GCC gives -Wuninitialized on this code: #include uint16_t test() { uint32_t foo32[4] = {0, 0, 0, 0}; uint16_t* foo16

[Bug gcov-profile/110561] gcov counts closing bracket in a function as executable, lowering coverage statistics

2023-07-05 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110561 Ivan Sorokin changed: What|Removed |Added CC||vanyacpp at gmail dot com --- Comment

<    1   2