[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 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>) > +

[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 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 I believe

[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 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 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); } Cl

[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/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/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 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

[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 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

[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] 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 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 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 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 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 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++/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++/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++/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] 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++/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++/107529] New: constexpr evaluator doesn't check for destroyed objects

2022-11-04 Thread vanyacpp at gmail dot com via Gcc-bugs
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_at(p

[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
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 argument

[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 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
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 + 10

[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 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 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

[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 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([0], , sizeof(t)); > So I suspect this should be marked as invalid. The questions is how GCC

[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 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 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 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 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 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 quite confusing

[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 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 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] 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 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 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

[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() G

[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 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 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 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 rtl-optimization/3507] appalling optimisation with sub/cmp on multiple targets

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

[Bug middle-end/95014] gcc fails to merge two identical returns

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

[Bug middle-end/99797] accessing uninitialized automatic variables

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

[Bug analyzer/94355] support for C++ new expression

2021-04-12 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94355 --- Comment #7 from Ivan Sorokin --- For me the support for operator new works well for trivially constructible types. For a non-trivially constructible type I got a false positive: struct foo { foo(); }; int main() { delete new foo(); }

[Bug analyzer/94355] support for C++ new expression

2021-04-12 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94355 --- Comment #6 from Ivan Sorokin --- I played with -fanalyzer on godbolt (GCC trunk). I noticed that -fanalyzer doesn't report double free in this (convoluted) case: #include int main() { int* p = new int; delete p; free(p); }

[Bug c++/100039] New: GCC can not bind lvalue to lvalue reference in brace-initialized-temporary expression

2021-04-11 Thread vanyacpp at gmail dot com via Gcc-bugs
Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: vanyacpp at gmail dot com Target Milestone: --- Consider this program: typedef int& ref; int main() { int a; ref{a}; } This is accepted by clang,

[Bug sanitizer/99418] sanitizer checks for accessing multidimentional VLA-array

2021-03-09 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99418 --- Comment #8 from Ivan Sorokin --- If I understand #c5 correctly the minimal reproducer should be this: void g(int&); void f() { int a[10]; int& p = a[10]; // (1) g(a[10]); // (2) } Both (1) and (2) are undefined and

[Bug sanitizer/99418] sanitizer checks for accessing multidimentional VLA-array

2021-03-09 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99418 --- Comment #7 from Ivan Sorokin --- (In reply to Martin Liška from comment #3) > That said, can we close it as resolved? I'm sorry for not being clear from the beginning. The original report was about -fsanitize=bounds sanitizer which

[Bug sanitizer/99418] sanitizer checks for accessing multidimentional VLA-array

2021-03-09 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99418 --- Comment #6 from Ivan Sorokin --- (In reply to Jakub Jelinek from comment #4) > Asan can't by design detect neither #c0 nor #c1, only ubsan can. > The reason why ubsan has that off by one stuff is that in C/C++, > [n - 1][m] is not undefined

[Bug sanitizer/99418] sanitizer checks for accessing multidimentional VLA-array

2021-03-06 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99418 --- Comment #2 from Ivan Sorokin --- It looks like this is related to ignore_off_by_one parameter of ubsan_instrument_bounds. As can be seen in gimple the problematic .UBSAN_BOUNDS checks against array size plus 1.

[Bug sanitizer/99418] sanitizer checks for accessing multidimentional VLA-array

2021-03-06 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99418 --- Comment #1 from Ivan Sorokin --- Here is the reduced example. It doesn't SIGSEGV, but it doesn't report any sanitizer errors either: $ g++ -g -fsanitize=bounds 3.cpp $ cat 3.cpp #include void escape(int& a) {} void test(size_t n, size_t

[Bug sanitizer/99418] New: sanitizer checks for accessing multidimentional VLA-array

2021-03-05 Thread vanyacpp at gmail dot com via Gcc-bugs
Priority: P3 Component: sanitizer Assignee: unassigned at gcc dot gnu.org Reporter: vanyacpp at gmail dot com CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org, jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, marxin at gcc dot

[Bug middle-end/99087] New: suboptimal codegen for division by constant 3

2021-02-13 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: --- These two are functionally the same, but generate different code with g++ -O2: unsigned long long foo(unsigned long long a) { return a / 3; } unsigned long long

[Bug target/91400] __builtin_cpu_supports conjunction is optimized poorly

2021-02-04 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91400 --- Comment #2 from Ivan Sorokin --- I've sent a patch to gcc-patches mailing list: https://gcc.gnu.org/pipermail/gcc-patches/2021-February/564663.html

[Bug c++/82640] gcc doesn't show errors on anonymous local variables

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

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

2021-01-27 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98774 --- Comment #3 from Ivan Sorokin --- (In reply to Hongtao.liu from comment #1) > It's fixed in current trunk https://godbolt.org/z/63576n I can confirm that now GCC does use packed multiplication mulpd. Although it is used somewhat

[Bug c++/98814] Add fix-it hints for missing asterisk

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

[Bug tree-optimization/98775] missing optimization opportunity on nbody

2021-01-20 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98775 --- Comment #1 from Ivan Sorokin --- Created attachment 50016 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50016=edit nbody-unrolled.cpp

[Bug tree-optimization/98775] New: missing optimization opportunity on nbody

2021-01-20 Thread vanyacpp at gmail dot com via Gcc-bugs
-optimization Assignee: unassigned at gcc dot gnu.org Reporter: vanyacpp at gmail dot com Target Milestone: --- Created attachment 50015 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50015=edit nbody.cpp On the attached sample (208 LOC), clang 11.0 generates the c

[Bug tree-optimization/98774] New: gcc -O3 does not vectorize multiplication

2021-01-20 Thread vanyacpp at gmail dot com via Gcc-bugs
-optimization Assignee: unassigned at gcc dot gnu.org Reporter: vanyacpp at gmail dot com Target Milestone: --- Created attachment 50014 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50014=edit nbody-update-velocity.cpp In the following sample GCC (-O3 -ffast-m

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

2021-01-16 Thread vanyacpp at gmail dot com via Gcc-bugs
ity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: vanyacpp at gmail dot com Target Milestone: --- On this function clang generates slightly shorter code unsigned foo(unsigned x, unsigned y, unsigned c) { return (x | c

[Bug middle-end/98709] New: gcc optimizes bitwise operations, but doesn't optimize logical ones

2021-01-16 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 10.2 produces very good code for this function noticing that both sides of conjuntion are the same: unsigned foo_bitwise

[Bug c++/98660] -Wold-style-cast should not warn on casts that look like (decltype(x))(x)

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

[Bug rtl-optimization/98555] Functions optimized to zero length break function pointer inequality

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

[Bug c++/98501] potential optimization for base<->derived pointer casts

2021-01-05 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98501 --- Comment #2 from Ivan Sorokin --- (In reply to Richard Biener from comment #1) > I think there's a duplicate of this PR. I searched the list of bugs and I found PR95663. Is it it?

[Bug c++/98501] New: potential optimization for base<->derived pointer casts

2021-01-02 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: struct base1 { int a; }; struct base2 { int b; }; struct derived : base1, base2 {}; derived& to_derived_ba

[Bug c++/80016] error is positioned incorrectly

2021-01-02 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80016 Ivan Sorokin changed: What|Removed |Added Resolution|--- |FIXED Status|ASSIGNED

[Bug tree-optimization/47579] STL size() == 0 does unnecessary shift

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

[Bug middle-end/56719] missed optimization: i > 0xffff || i*4 > 0xffff

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

[Bug rtl-optimization/48877] Inline asm for rdtsc generates silly code

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

[Bug target/94852] -ffloat-store on x64 target

2020-04-29 Thread vanyacpp at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94852 --- Comment #6 from Ivan Sorokin --- (In reply to Richard Biener from comment #1) > @item -ffloat-store > @opindex ffloat-store > Do not store floating-point variables in registers, and inhibit other > options that might change whether a

[Bug target/94852] -ffloat-store on x64 target

2020-04-29 Thread vanyacpp at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94852 --- Comment #4 from Ivan Sorokin --- (In reply to Richard Biener from comment #1) > @item -ffloat-store > @opindex ffloat-store > Do not store floating-point variables in registers, and inhibit other > options that might change whether a

[Bug target/94852] New: -ffloat-store on x64 target

2020-04-29 Thread vanyacpp at gmail dot com
Assignee: unassigned at gcc dot gnu.org Reporter: vanyacpp at gmail dot com Target Milestone: --- At the moment -ffloat-store significantly pessimizes the code generation regardless of whether -mfpmath=sse -msse2 are used or not: float f(float a, float b) { return a + b; } -O2

[Bug analyzer/94355] New: support for C++ new expression

2020-03-27 Thread vanyacpp at gmail dot com
Assignee: dmalcolm at gcc dot gnu.org Reporter: vanyacpp at gmail dot com Target Milestone: --- At the moment static analyzer warns about leaked malloc. It would be great if C++ new expression were also supported. Example: void f() { char* p = new char; } Expected diagnostic

[Bug target/91824] unnecessary sign-extension after _mm_movemask_epi8 or __builtin_popcount

2020-02-01 Thread vanyacpp at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91824 --- Comment #7 from Ivan Sorokin --- (In reply to Jakub Jelinek from comment #6) > Fixed. Thank you!

[Bug c++/93211] New: equivalence of dependent function calls doesn't check if the call is eligible for ADL

2020-01-09 Thread vanyacpp at gmail dot com
Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: vanyacpp at gmail dot com Target Milestone: --- Consider this code: // https://gcc.godbolt.org/z/3U2TTd #include template void g(T); template void f() {} // (1

[Bug c++/92707] New: type alias on type alias on lambda in unevaluated context does not work

2019-11-28 Thread vanyacpp at gmail dot com
Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: vanyacpp at gmail dot com Target Milestone: --- GCC shows an error on this code: template using foo = decltype([] {}); template using bar = foo; extern foo a; extern bar

[Bug middle-end/91824] New: unnecessary sign-extension after _mm_movemask_epi8 or __builtin_popcount

2019-09-19 Thread vanyacpp at gmail dot com
: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: vanyacpp at gmail dot com Target Milestone: --- gcc -O2 -mpopcnt leaves unnecessary cdqe: #include #include void f(uint64_t& val, __m128i mask) {

[Bug tree-optimization/91400] New: __builtin_cpu_supports conjunction is optimized poorly

2019-08-08 Thread vanyacpp at gmail dot com
Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: vanyacpp at gmail dot com Target Milestone: --- Clang 8 optimizes both f() and g() to the same code: bool f() { return __builtin_cpu_supports("popcnt") && __builtin_cpu_supports

[Bug middle-end/90345] too pessimistic check whether pointer may alias a local variable

2019-05-07 Thread vanyacpp at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90345 --- Comment #4 from Ivan Sorokin --- Making points-to analysis aware of SESE regions will definitely help here and is a nice thing to have. There is one more option. In my reduced test case the body of 'push_back' is unavailable, but when it is

[Bug middle-end/90345] New: too pessimistic check whether pointer may alias local variable

2019-05-04 Thread vanyacpp at gmail dot com
Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: vanyacpp at gmail dot com Target Milestone: --- Consider the following example (reduced from a real program): #include #include struct big_integer { void push_back(uint32_t

[Bug c++/86346] New: internal compiler error related to duduction guides

2018-06-28 Thread vanyacpp at gmail dot com
Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: vanyacpp at gmail dot com Target Milestone: --- Here is the code: template struct bool_constant {}; using true_type = bool_constant; template constexpr bool is_same_v = false; template constexpr bool is_same_v

[Bug c++/82910] New: marking data members private affects code generation of copying

2017-11-08 Thread vanyacpp at gmail dot com
Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: vanyacpp at gmail dot com Target Milestone: --- Consider the following piece of code: struct pair { private: void* first; unsigned second; }; struct other { pair get() const

[Bug target/82693] gcc/clang calling convension mismatch

2017-10-23 Thread vanyacpp at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82693 Ivan Sorokin changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|---

[Bug c++/60336] empty struct value is passed differently in C and C++

2017-10-23 Thread vanyacpp at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60336 Ivan Sorokin changed: What|Removed |Added CC||vanyacpp at gmail dot com --- Comment

[Bug target/82693] gcc/clang calling convension mismatch

2017-10-23 Thread vanyacpp at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82693 --- Comment #6 from Ivan Sorokin --- I added files to reproduce the issue: caller.cpp and callee.cpp are the files that need to be compiled with different compilers. empty.h is common header. build.sh is a shell script that compiles and run all

[Bug target/82693] gcc/clang calling convension mismatch

2017-10-23 Thread vanyacpp at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82693 Ivan Sorokin changed: What|Removed |Added Attachment #42451|0 |1 is obsolete|

  1   2   >