[Bug middle-end/116651] New: Memory allocation elision for std::vector like cases

2024-09-09 Thread antoshkka at gmail dot com via Gcc-bugs
: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Code close to the following was noted in many user applications: bool test1(const std::vector& in) { retur

[Bug middle-end/115309] New: Simple coroutine based generator is not optimized well

2024-05-31 Thread antoshkka at gmail dot com via Gcc-bugs
: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the following minimal C++ coroutine based generator: #include namespace { struct generator { struct

[Bug middle-end/114661] New: Bit operations not optimized to multiplication

2024-04-09 Thread antoshkka at gmail dot com via Gcc-bugs
Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the example: unsigned mul(unsigned char c) { if (c > 3) __builtin_unreachable(); return c << 18

[Bug middle-end/114660] Exponentiating by squaring not performed for x * y * y * y * y

2024-04-09 Thread antoshkka at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114660 --- Comment #1 from Antony Polukhin --- The above godbolt link for an old version of GCC, here's for 14.0 https://godbolt.org/z/dTPYY1T9W

[Bug middle-end/114660] New: Exponentiating by squaring not performed for x * y * y * y * y

2024-04-09 Thread antoshkka at gmail dot com via Gcc-bugs
-optimization Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- For the following code: int mul(int x, int y) { return x * y * y * y * y; } with -O2

[Bug middle-end/114559] New: After function inlining some optimizations missing

2024-04-02 Thread antoshkka at gmail dot com via Gcc-bugs
Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the example: template int AtomicUpdate(int& atomic, Func updater) { int old_value = atomic; while (

[Bug middle-end/114391] catch() and immediate throw; could be optimized to noop

2024-03-19 Thread antoshkka at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114391 --- Comment #2 from Antony Polukhin --- > Is there something to optimize when foo() cannot be tail-called? Yes. Just `catch (...) { throw; }`, no more restrictions. I do not even think, that it should be the outer most EH region: void foo();

[Bug middle-end/114391] New: catch() and immediate throw; could be optimized to noop

2024-03-19 Thread antoshkka at gmail dot com via Gcc-bugs
Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the example: void foo(); void test() { try { foo(); } catch

[Bug middle-end/114270] New: Integer multiplication on floating point constant with conversion back to integer is not optimized

2024-03-07 Thread antoshkka at gmail dot com via Gcc-bugs
: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the following example: unsigned test(unsigned

[Bug middle-end/113959] New: Optimize `__builtin_isnan(x) || __builtin_isinf(x)` to `__builtin_isfinite(x)`

2024-02-16 Thread antoshkka at gmail dot com via Gcc-bugs
: missed-optimization Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Sometimes people check for finite number using `__builtin_isnan(x

[Bug tree-optimization/112683] New: Optimizing memcpy range by extending to word bounds

2023-11-23 Thread antoshkka at gmail dot com via Gcc-bugs
: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the minimized source code from libstdc++ ``` struct string { unsigned long _M_string_length; enum

[Bug libstdc++/112682] New: More efficient std::basic_string move construction

2023-11-23 Thread antoshkka at gmail dot com via Gcc-bugs
Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- A few places in bits/basic_string.h have the following code: ``` if (__str._M_is_local()) { _M_init_local_buf

[Bug tree-optimization/112584] New: Suboptimal stack usage on third memcpy

2023-11-17 Thread antoshkka at gmail dot com via Gcc-bugs
Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the example: struct string_view { const char* data; unsigned long size; }; void AppendToCharArray(char

[Bug libstdc++/112440] New: Compiler does not grok basic_string::resize and basic_string::reserve if _CharT is char

2023-11-08 Thread antoshkka at gmail dot com via Gcc-bugs
Keywords: missed-optimization Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the example: #include void test1(std::size_t summ

[Bug c++/111690] New: Redefinition of operator == not detected with friend <=>

2023-10-04 Thread antoshkka at gmail dot com via Gcc-bugs
nvalid Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the example: ``` #include struct Foo { friend auto operator<=>(const Foo

[Bug target/110170] Sub-optimal conditional jumps in conditional-swap with floating point

2023-07-11 Thread antoshkka at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110170 --- Comment #13 from Antony Polukhin --- There's a typo at https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/testsuite/g%2B%2B.target/i386/pr110170.C;h=e638b12a5ee2264ecef77acca86432a9f24b103b;hb=d41a57c46df6f8f7dae0c0a8b349e734806a837b#l87 It sh

[Bug target/110457] Unnecessary movsx eax, dil

2023-06-28 Thread antoshkka at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110457 --- Comment #4 from Antony Polukhin --- Oh, if there's an disagreement I'm fine with closing this issue as invalid/later/won't_fix

[Bug tree-optimization/110459] New: Trivial on stack variable was not optimized away

2023-06-28 Thread antoshkka at gmail dot com via Gcc-bugs
Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the example: struct array { char data[4]; }; auto sample2(char c) { array buffer = {c, 0, 0, 0

[Bug target/110457] Unnecessary movsx eax, dil

2023-06-28 Thread antoshkka at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110457 --- Comment #1 from Antony Polukhin --- > However, it could be shortened to just: sample1(char): imul eax,edi,0x10111 ret; missed in previous message

[Bug target/110457] New: Unnecessary movsx eax, dil

2023-06-28 Thread antoshkka at gmail dot com via Gcc-bugs
: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- For the following code int sample1(char c) { return (c << 4) + (c << 8) + (c << 16) + c; } GCC-14 with -O2 generates the assem

[Bug c++/110363] New: New use-after-move warning

2023-06-22 Thread antoshkka at gmail dot com via Gcc-bugs
Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- There's a quite common rule "after the object was moved from it is in the indeterminate state; it should be either destroyed or a new value should be a

[Bug tree-optimization/110362] New: Range information on lower bytes of __uint128_t

2023-06-22 Thread antoshkka at gmail dot com via Gcc-bugs
Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the following example: int test (__uint128_t a, __uint128_t b) { __uint128_t __a = b | (a << 32);

[Bug target/110170] Sub-optimal conditional jumps in conditional-swap with floating point

2023-06-08 Thread antoshkka at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110170 --- Comment #2 from Antony Polukhin --- -fno-trapping-math had no effect Some tests with nans seem to produce the same results for both code snippets: https://godbolt.org/z/GaKM3EhMq

[Bug tree-optimization/110170] New: Sub-optimal conditional jumps in conditional-swap with floating point

2023-06-08 Thread antoshkka at gmail dot com via Gcc-bugs
-optimization Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Some of the C++ algorithms are written in attempt to avoid conditional jumps

[Bug tree-optimization/109931] Knowledge on literal not used in optimization

2023-05-22 Thread antoshkka at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109931 --- Comment #3 from Antony Polukhin --- > But that's because nothing in the function asserts this? Without fully > specializing and unrolling on the constant "hello" argument at least. Yes, I was hoping for that unrolling to happen Probably a

[Bug tree-optimization/109931] New: Knowledge on literal not used in optimization

2023-05-22 Thread antoshkka at gmail dot com via Gcc-bugs
Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Function for comparing a lower-cased string with runtime string of known size: constexpr bool ICaseEqualLowercase(const

[Bug tree-optimization/109829] New: Optimizing __builtin_signbit(x) ? -x : x or abs for FP

2023-05-12 Thread antoshkka at gmail dot com via Gcc-bugs
: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the following 2 functions: __float128 abs1(__float128 x) { return __builtin_fabsf128(x); } __float128

[Bug middle-end/108465] New: Optimize (a < b) == (b < a) to a == b

2023-01-19 Thread antoshkka at gmail dot com via Gcc-bugs
normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- For GCC 12 the following code with -O2: int compare_eq(int a, int b) { return ((a < b) == (b < a)); } compiles into t

[Bug libstdc++/71579] type_traits miss checks for type completeness in some traits

2022-09-01 Thread antoshkka at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71579 --- Comment #22 from Antony Polukhin --- > Maybe we should consider dropping all the static assertions from traits that > are implemented using a compiler built-in. Sounds like the right thing to do. > Our type trait and the __has_virtual_dest

[Bug libstdc++/104361] New: Biased Reference Counting for the standard library

2022-02-03 Thread antoshkka at gmail dot com via Gcc-bugs
Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- There's a research named "Biased Reference Counting: Minimizing Atomic Operations in Garbage Collection" that shows how to speed up reference co

[Bug c++/103745] New: Warn on throwing an exception not derived from std::exception

2021-12-16 Thread antoshkka at gmail dot com via Gcc-bugs
Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Throwing an exception that is derived from std::exception is a common practice. Cases when that practice

[Bug tree-optimization/19661] unnecessary atexit calls emitted for static objects with empty destructors

2021-09-24 Thread antoshkka at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=19661 --- Comment #10 from Antony Polukhin --- Any progress? Multiple compilers already eliminate the atexit call. Moreover, some of the compilers even eliminate the guard variable after that https://godbolt.org/z/dbdfMrroa Note that the atexit elim

[Bug middle-end/101253] New: Optimize i % C1 == C0 || i % C1*C2 == C0 to i % C1 == C0

2021-06-29 Thread antoshkka at gmail dot com via Gcc-bugs
Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the following code bool test_naive(short i) { return i % 100 == 0 || i % 400 == 0

[Bug middle-end/101252] New: Optimize (b ? i % C0 : i % C1) into i & (b ? C0-1 : C1-1) for power of 2 C0 and C1

2021-06-29 Thread antoshkka at gmail dot com via Gcc-bugs
RMED Keywords: missed-optimization Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the following code bool test_naive0(bool b, sho

[Bug middle-end/101251] New: Optimize i % (b ? C0 : C1) into i & (b ? C0-1 : C1-1) for power of 2 C0 and C1

2021-06-29 Thread antoshkka at gmail dot com via Gcc-bugs
ords: missed-optimization Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the following code bool test_optim01(bool b, sho

[Bug c++/58487] Missed return value optimization

2021-06-28 Thread antoshkka at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58487 Antony Polukhin changed: What|Removed |Added CC||antoshkka at gmail dot com

[Bug c++/58050] No return value optimization when calling static function through unnamed temporary

2021-06-28 Thread antoshkka at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58050 Antony Polukhin changed: What|Removed |Added CC||antoshkka at gmail dot com

[Bug c++/100746] New: NRVO should not introduce aliasing

2021-05-24 Thread antoshkka at gmail dot com via Gcc-bugs
Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the example: struct NrvoPassed { NrvoPassed() = default; NrvoPassed(const NrvoPassed&); NrvoPassed(NrvoPassed&&)

[Bug libstdc++/89120] std::minmax_element 2.5 times slower than hand written loop

2021-05-17 Thread antoshkka at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89120 --- Comment #2 from Antony Polukhin --- Long story short: I've found no way to improve the standard library code to always work faster. I'm in favor of closing this ticket as invalid/wont fix. Long story: I've tried to add a specialization of m

[Bug c++/80542] Warn about accidental copying of data in range based for

2021-05-09 Thread antoshkka at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80542 --- Comment #2 from Antony Polukhin --- This issue could be closed. GCC 11 has the required -Wrange-loop-construct warning: https://godbolt.org/z/343M6WMjb

[Bug libstdc++/99612] New: Remove "#pragma GCC system_header" from atomic file to warn on incorrect memory order

2021-03-16 Thread antoshkka at gmail dot com via Gcc-bugs
NCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- GCC has -Winvalid-memory-model that warns if wrong memory model is

[Bug middle-end/98817] Optimize if (a != b) a = b;

2021-01-25 Thread antoshkka at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98817 --- Comment #5 from Antony Polukhin --- Please, close as invalid

[Bug middle-end/98817] Optimize if (a != b) a = b;

2021-01-25 Thread antoshkka at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98817 --- Comment #2 from Antony Polukhin --- (In reply to Jakub Jelinek from comment #1) > I'm not sure about this. Turning it into an unconditional store would mean > that the memory the reference points to must be writable, that might not be > alwa

[Bug middle-end/98817] New: Optimize if (a != b) a = b;

2021-01-25 Thread antoshkka at gmail dot com via Gcc-bugs
Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the example: void arithmetic(int& result, int value) { if (result != value) { result = value; } } GCC generates

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

2021-01-25 Thread antoshkka at gmail dot com via Gcc-bugs
Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Iterators and pointers are quite common in C++ code but newbies tend to forget to dereference them: struct my_vector { void push_back(int); }; struct

[Bug c++/98768] New: Improve diagnostics for incorrect result type checking "-> Type" in concepts

2021-01-20 Thread antoshkka at gmail dot com via Gcc-bugs
Keywords: diagnostic Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the example: template concept Callable0Arg = requires(Function fun

[Bug c++/98767] New: Function signature lost in concept diagnostic message

2021-01-20 Thread antoshkka at gmail dot com via Gcc-bugs
Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the example: template concept Callable1Arg = requires(Function func, T value) { func(value); }; // Should fail and fails

[Bug tree-optimization/78427] missed optimization of loop condition

2020-09-26 Thread antoshkka at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78427 Antony Polukhin changed: What|Removed |Added CC||antoshkka at gmail dot com

[Bug c++/96452] Narrowing conversion is not rejected

2020-08-04 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96452 --- Comment #7 from Antony Polukhin --- (In reply to Jonathan Wakely from comment #6) > Your understanding of what a compiler needs to do for ill-formed programs is > wrong. You're right, thank you!

[Bug c++/96452] Narrowing conversion is not rejected

2020-08-04 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96452 --- Comment #5 from Antony Polukhin --- Hm... My reading of http://eel.is/c++draft/dcl.init.list#3.9 is that the program is ill-formed for narrowing conversions. And http://eel.is/c++draft/dcl.init.list#7.2 states that conversion from double to f

[Bug c++/96452] New: Narrowing conversion is not rejected

2020-08-04 Thread antoshkka at gmail dot com
: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the example: float test_main(double d) { float f2{d}; return f2; } Narrowing of double to float in brace-init is not rejected

[Bug c++/96121] Uninitialized variable copying not diagnosed

2020-07-08 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96121 --- Comment #4 from Antony Polukhin --- Adding members and usage does not make a difference https://godbolt.org/z/VommHu struct A { A(); int i; }; struct B { B(A); int i; }; struct composed2 { B b_; A a_; composed2() : b_(a_) {} }

[Bug c++/96121] New: Uninitialized variable copying not diagnosed

2020-07-08 Thread antoshkka at gmail dot com
Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the example: struct A { A(); }; struct B { B(A); }; struct composed2 { B b_; A a_; composed2() : b_(a_) {} }; GCC does

[Bug libstdc++/96088] New: Range insertion into unordered_map is less effective than a loop with insertion

2020-07-06 Thread antoshkka at gmail dot com
: missed-optimization Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the function f1: static constexpr std::initializer_list>

[Bug c++/96004] New: Copy elision with conditional

2020-06-30 Thread antoshkka at gmail dot com
Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the example: struct Struct { Struct() = default; Struct(Struct&&); }; Struct question10(bool b) { if (b) {

[Bug c++/67302] [C++14] copy elision in return (expression)

2020-06-30 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67302 Antony Polukhin changed: What|Removed |Added CC||antoshkka at gmail dot com

[Bug middle-end/94146] New: Merging functions with same bodies stopped working

2020-03-11 Thread antoshkka at gmail dot com
Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the example: extern int x , y; int ternary(int i) { return i > 0 ? x : y; } int ternary2(int i) { return i >

[Bug libstdc++/94049] New: For better diagnostics CPOs should not use concepts for operator()

2020-03-05 Thread antoshkka at gmail dot com
Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the following code: #include void foo0() { int t = 0; std::ranges::begin(t

[Bug c++/93414] New: Bad diagnostics for dynamic_cast during constant evaluation: implementation details leak out

2020-01-24 Thread antoshkka at gmail dot com
Keywords: diagnostic Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the example that attempts to throw a std::bad_cast: struct Base

[Bug c++/93413] New: Destructor definition not found during constant evaluation

2020-01-24 Thread antoshkka at gmail dot com
Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the example: struct Base { constexpr virtual ~Base(){} }; struct Derived: Base {}; constexpr

[Bug c++/66139] destructor not called for members of partially constructed anonymous struct/array

2019-12-13 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66139 Antony Polukhin changed: What|Removed |Added CC||antoshkka at gmail dot com

[Bug c++/90647] Warn on returning a lambda with captured local variables

2019-11-30 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90647 --- Comment #2 from Antony Polukhin --- -Wreturn-local-addr looks good to me

[Bug target/92592] New: Redundant comparison after subtraction on x86

2019-11-19 Thread antoshkka at gmail dot com
Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the example: int sample(int a, int b) { unsigned diff = (unsigned)b - (unsigned)a; unsigned sign_bit = b <

[Bug middle-end/92455] Unnecessary memory read in a loop

2019-11-11 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92455 --- Comment #4 from Antony Polukhin --- (In reply to Richard Biener from comment #3) > But maybe > you can provide benchmark data (including compile-time/memory-use figures)? OK. Is there any GCC specific tool or flag for that?

[Bug middle-end/92455] Unnecessary memory read in a loop

2019-11-11 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92455 --- Comment #2 from Antony Polukhin --- Can the -ftree-partial-pre flag be enabled by default for -O2?

[Bug middle-end/92455] New: Unnecessary memory read in a loop

2019-11-11 Thread antoshkka at gmail dot com
: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the example: typedef struct { int* ptr_; } int_ptr; int_ptr f1(int_ptr* x) { int_ptr* max = x; for (int i =0 ; i <

[Bug c++/92375] New: Warn on suspicious taking of function address instead of calling a function

2019-11-05 Thread antoshkka at gmail dot com
: diagnostic Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the simple example: bool function(); bool test() { bool result = function; if

[Bug c++/82019] [concepts] ICE if concept is not satisfied

2019-10-15 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82019 --- Comment #2 from Antony Polukhin --- Updated version of the test (works well on GCC 10): // { dg-options "-std=c++2a" } template concept VectorOperations = requires(T& v, const Data& data) { v += data; requires __is_same_as(T&, dec

[Bug c++/92067] New: __is_constructible(incomplete_type) should make the program ill-formed

2019-10-11 Thread antoshkka at gmail dot com
Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Such change brings consistency with Clang and other built-in traits: struct incomplete; // fails on clang, OK on GCC const bool

[Bug c++/92053] Compilation fails or succeeds depending on the optimization flags

2019-10-11 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92053 Antony Polukhin changed: What|Removed |Added Keywords|needs-reduction,|accepts-invalid |rej

[Bug c++/92054] New: `final` does not cause devirtualization of nested calls

2019-10-10 Thread antoshkka at gmail dot com
Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the example: struct A { virtual int f() { return 0; } virtual int g() { return f() + 40

[Bug c++/92053] New: Compilation fails or succeeds depending on the optimization flags

2019-10-10 Thread antoshkka at gmail dot com
-invalid Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the following code: #include #include #include struct widget; using variant_t = std

[Bug rtl-optimization/91981] Speed degradation because of inlining a register clobbering function

2019-10-04 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91981 --- Comment #4 from Antony Polukhin --- It was broken in GCC-9, GCC-8.3 and below do not have this issue.

[Bug middle-end/91981] New: Speed degradation because of inlining a register clobbering function

2019-10-03 Thread antoshkka at gmail dot com
-optimization Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the example that is a simplified version of boost::container::small_vector

[Bug middle-end/91899] Merge constant literals

2019-09-25 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91899 --- Comment #4 from Antony Polukhin --- (In reply to Alexander Monakov from comment #3) > unless the compiler somehow proves that overlap is not > observable? Oh, now I see. Here's a valid example: static const char data1[] = "test"; static con

[Bug middle-end/91899] Merge constant literals

2019-09-25 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91899 --- Comment #1 from Antony Polukhin --- Godbolt playground: https://godbolt.org/z/UA_Xsm

[Bug middle-end/91899] New: Merge constant literals

2019-09-25 Thread antoshkka at gmail dot com
Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the example: static const char data1[] = {'t','e','s','t'}; static const char data2[] = &

[Bug middle-end/91883] New: Division by a constant could be optimized for known variables value range

2019-09-24 Thread antoshkka at gmail dot com
: missed-optimization Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the example: unsigned long long kBorder = (1ull<<62); unsigne

[Bug middle-end/91881] New: Value range knowledge of higher bits not used in optimizations

2019-09-24 Thread antoshkka at gmail dot com
-optimization Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the example: unsigned long long sample2(unsigned long long m) { if (m >=

[Bug middle-end/91866] New: Sign extend of an int is not recognized

2019-09-23 Thread antoshkka at gmail dot com
Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the example: using size_t = unsigned long long; size_t index0(int i) { return size_t(i + 1) - 1; } GCC generates the

[Bug middle-end/91739] New: Missed optimization for arithmetic operations of integers and floating point constants

2019-09-11 Thread antoshkka at gmail dot com
Keywords: missed-optimization Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the example: double foo(unsigned i, unsigned j) { return

[Bug target/91721] New: Missed optimization for checking nan and comparison

2019-09-10 Thread antoshkka at gmail dot com
Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the example: int doubleToString_0(double a) { if ( __builtin_isnan( a ) ) return 1; else if ( a == 0

[Bug middle-end/91709] Missed optimization for multiplication on 1.5 and 1.25

2019-09-10 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91709 --- Comment #3 from Antony Polukhin --- (In reply to jos...@codesourcery.com from comment #2) > If the result of multiplying by 1.5 is outside the range of the integer > type, the version with multiplication is required to raise the FE_INVALID

[Bug middle-end/91709] Missed optimization for multiplication on 1.5 and 1.25

2019-09-09 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91709 --- Comment #1 from Antony Polukhin --- Godbolt playground: https://godbolt.org/z/rHQj2w

[Bug middle-end/91709] New: Missed optimization for multiplication on 1.5 and 1.25

2019-09-09 Thread antoshkka at gmail dot com
: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- On x86_32 for any number X of type (unsigned, unsigned short, unsigned char) multiplication by 1.5 with a conversion back

[Bug target/91681] New: Missed optimization for 128 bit arithmetic operations

2019-09-06 Thread antoshkka at gmail dot com
: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the function: void multiply128x64x2_3 ( const unsigned long a, const unsigned long b, const unsigned

[Bug middle-end/91358] Wrong code with dynamic allocation and optional like class

2019-08-08 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91358 --- Comment #6 from Antony Polukhin --- (In reply to Michael Matz from comment #3) > I don't really see any, no good idea here :-/ How about moving all the optimizations based on reading uninitialized values under a flag like -funinitialized-log

[Bug middle-end/91358] Wrong code with dynamic allocation and optional like class

2019-08-06 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91358 --- Comment #2 from Antony Polukhin --- (In reply to Michael Matz from comment #1) > So, if you've seen a real problem somewhere (and not just valgrind > complaining about uninitialized registers in comparisons), > then you've reduced the testcas

[Bug middle-end/91358] New: Wrong code with dynamic allocation and optional like class

2019-08-05 Thread antoshkka at gmail dot com
Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- The issue is reproduced on GCCs from 5 to 9 with -O2 and -std=c++11. GCC-10 also generates wrong code

[Bug c++/91329] Unnecessary call to __cxa_throw_bad_array_new_length

2019-08-02 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91329 --- Comment #1 from Antony Polukhin --- Ops, sorry. This is invalild. `i` could be negative. Please close as invalid

[Bug c++/91329] New: Unnecessary call to __cxa_throw_bad_array_new_length

2019-08-02 Thread antoshkka at gmail dot com
Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- For the code int* test(int i) { return new int[i]; } The following assembly is generated: test(int): movsx rdi, edi sub

[Bug target/91174] Suboptimal code for arithmetic with bool and char

2019-07-16 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91174 --- Comment #4 from Antony Polukhin --- Sorry, now I understood that the bug is invalid. Please close.

[Bug target/91174] Suboptimal code for arithmetic with bool and char

2019-07-16 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91174 --- Comment #2 from Antony Polukhin --- (In reply to Florian Weimer from comment #1) > For which ABI do you propose the change? It's not correct for GNU/Linux: As far as I understand the proposed change does not touch ABI. `lea eax, [rdi + 48]`

[Bug middle-end/91174] New: Suboptimal code for arithmetic with bool

2019-07-15 Thread antoshkka at gmail dot com
Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the example: int test (bool x) { return '0' + x; } For the above snippet the following suboptimal assembly is

[Bug c++/86375] Lambda call in template parameter causes compile time error

2019-07-12 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86375 --- Comment #1 from Antony Polukhin --- This was fixed in GCC 9.1 Please add a test case for the issue and close it as fixed

[Bug libstdc++/89824] Variant jump table reserves space for __variant_cookie twice

2019-07-12 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89824 Antony Polukhin changed: What|Removed |Added Status|NEW |RESOLVED Resolution|---

[Bug target/88529] G++ clears the return register on x86_64 when returning an empty class

2019-06-18 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88529 --- Comment #5 from Antony Polukhin --- (In reply to Jason Merrill from comment #1) > Created attachment 45899 [details] > Fix Is it enough to test only for `scan-assembler-not mov`? Probably a `scan-assembler-not xor` should be also added?

[Bug libstdc++/71579] type_traits miss checks for type completeness in some traits

2019-05-31 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71579 --- Comment #13 from Antony Polukhin --- I meant + noexcept(noexcept(Tp(std::declval( but now I'm not sure that it would test excactly the same thing.

[Bug libstdc++/71579] type_traits miss checks for type completeness in some traits

2019-05-31 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71579 --- Comment #12 from Antony Polukhin --- (In reply to Jonathan Wakely from comment #11) > This change broke a compiler test: g++.dg/cpp0x/noexcept15.C > > I'll have to figure out how to update that test to keep testing what it was > meant to tes

[Bug libstdc++/71579] type_traits miss checks for type completeness in some traits

2019-05-31 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71579 --- Comment #9 from Antony Polukhin --- (In reply to Jonathan Wakely from comment #8) > Is there more work to do to support the whole of https://wg21.link/lwg2797 ? Looks like I've missed the is_nothrow_invocable_r, is_convertible, is_nothrow_co

  1   2   3   >