[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 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 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 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 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++/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 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++/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++/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] 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++/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 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 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] 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 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 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 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++/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++/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++/55249] New: Multiple copy constructors for template class lead to link errors

2012-11-09 Thread antoshkka at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55249 Bug #: 55249 Summary: Multiple copy constructors for template class lead to link errors Classification: Unclassified Product: gcc Version: 4.6.3 Status: UNC

[Bug c++/55249] Multiple copy constructors for template class lead to link errors

2012-11-09 Thread antoshkka at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55249 --- Comment #1 from Antony Polukhin 2012-11-09 10:24:49 UTC --- Created attachment 28648 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28648 Preprocessed file that triggers the bug

[Bug c++/55249] Multiple copy constructors for template class lead to link errors

2012-11-09 Thread antoshkka at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55249 --- Comment #4 from Antony Polukhin 2012-11-09 12:28:11 UTC --- (In reply to comment #3) Yes, thanks. `output.txt` will be the same. Also, reproduced this bug on GCC 4.7.2: [cc@ontos-soa-01 ~]$ gcc -v Using built-in specs. COLLEC

[Bug c++/88445] New: noexcept(expr) should return true with -fno-exceptions

2018-12-11 Thread antoshkka at gmail dot com
: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the following example: #include struct test { test(); test(test&&); test& operator=(test&

[Bug c++/88445] noexcept(expr) should return true with -fno-exceptions

2018-12-11 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88445 --- Comment #1 from Antony Polukhin --- Hm... This was discussed in Clang and looks like such optimization could break ABI and cause ODR violations https://bugs.llvm.org/show_bug.cgi?id=27442#c4 If nothing changed since then, I'm OK with closin

[Bug libstdc++/87431] valueless_by_exception() should unconditionally return false if all the constructors are noexcept

2019-01-06 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87431 --- Comment #11 from Antony Polukhin --- Looks good. Note that boost::variant went further: if all the types are nothrow movable then variant always does the trick with moving from temporary. In that way `valueless_by_exception()` like states ne

[Bug libstdc++/87431] valueless_by_exception() should unconditionally return false if all the constructors are noexcept

2019-01-06 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87431 --- Comment #13 from Antony Polukhin --- Yeah... but some whitelist of types to move could be hardcoded. For example std::basic_string, std::vector, std::unique_ptr and std::shared_ptr could be safely moved and `valueless_by_exception()` never ha

[Bug c++/53294] Optimize out some exception code

2019-01-11 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53294 --- Comment #3 from Antony Polukhin --- Any progress?

[Bug c++/89036] ICE if destructor has a requires

2019-01-24 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89036 --- Comment #1 from Antony Polukhin --- Compile with flags: -std=c++2a -fconcepts

[Bug c++/89036] New: ICE if destructor has a requires

2019-01-24 Thread antoshkka at gmail dot com
++ Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- The following code: template struct Y { ~Y() requires(true) = default; ~Y() requires(false) {} }; causes ICE: :6:27: internal compiler error: in add_method, at cp/class.c:1137

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

2019-01-30 Thread antoshkka at gmail dot com
Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- std::minmax_element is slow when there's a lot of data and it does not fit into the CPU cache: http://quick-benc

[Bug libstdc++/89121] New: std::min_element (and max_element) 3.6 times slower than hand written loop

2019-01-30 Thread antoshkka at gmail dot com
: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- std::min_element is slow when there's a lot of data and it does not fit into the CPU cache: http://quick-benc

[Bug c++/82899] *this in constructors could not alias with reference input parameters of the same type

2018-05-03 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82899 --- Comment #8 from Antony Polukhin --- (In reply to Richard Biener from comment #4) > (In reply to Antony Polukhin from comment #2) > > Looks like [class.ctor] paragraph 14 covers this case: > > > > "During the construction of an object, if the

[Bug c++/82899] *this in constructors could not alias with reference input parameters of the same type

2018-05-10 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82899 --- Comment #9 from Antony Polukhin --- There's an identical issue for clang: https://bugs.llvm.org/show_bug.cgi?id=37329 During review of that issue Richard Smith noted that the solution could be made more generic by adding `__restrict` for `th

[Bug c++/82899] *this in constructors could not alias with reference input parameters of the same type

2018-05-10 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82899 --- Comment #11 from Antony Polukhin --- Seems perfect https://godbolt.org/g/GX3GQd The mov is not generated for any constructor and the following code: extern struct A a; struct A { int m, n; A(const A &v); }; A::A(const A &v) : m(v.m), n(

[Bug c++/82899] *this in constructors could not alias with reference input parameters of the same type

2018-05-10 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82899 --- Comment #12 from Antony Polukhin --- (In reply to Marc Glisse from comment #10) > This seems fixed in 8.1 (at least we don't generate the extra mov anymore), > can you check? Actually it still does not work for subobjects. For example https:

[Bug c++/85747] New: suboptimal code without constexpr

2018-05-11 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 following code snippet: // Bubble-like sort. Anything complex enough will work template constexpr void sort(It first, It last

[Bug c++/85747] suboptimal code without constexpr

2018-05-11 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85747 --- Comment #3 from Antony Polukhin --- (In reply to Richard Biener from comment #1) > What's the reason for writing the code as you pasted it? I've tried to provide a simplified case. In real world `generate()` function will have some arguments

[Bug c++/85747] suboptimal code without constexpr

2018-05-11 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85747 --- Comment #4 from Antony Polukhin --- (In reply to Marc Glisse from comment #2) > (In reply to Antony Polukhin from comment #0) > > Could the compiler detect that `a[7]` holds values known at compile time and > > force the constexpr on `sort(a

[Bug c++/85747] suboptimal code without constexpr

2018-05-14 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85747 --- Comment #7 from Antony Polukhin --- (In reply to Jakub Jelinek from comment #6) > IMHO just use constexpr if you care about compile time evaluation > guarantees, that is what it has been added for. Fair point. Overcomplicated logic on the fr

[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 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 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 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 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 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 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] 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 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/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 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] 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 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/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 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/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/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/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/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] 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/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 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 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 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] 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++/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++/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 libstdc++/83754] New: Segmentation fault in regex_search

2018-01-09 Thread antoshkka at gmail dot com
++ Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- The following code #include #include int main() { std::regex pattern("\\w+\\."); std::string s(100, 'a'); return std::regex_search(s, pa

[Bug c++/84099] New: Dynamic initialization is performed in case when constant initialization is permitted

2018-01-29 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: --- The following code struct foo { const char* data_; unsigned size_; foo(const char* data, unsigned

[Bug c++/84103] New: Dynamic initialization is performed for non-local variables in case when constant initialization is permitted

2018-01-29 Thread antoshkka at gmail dot com
Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Following code struct foo { const char* data_; unsigned size_

[Bug middle-end/84147] New: RTTI for base class in anonymous namespace could be avoided

2018-01-31 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 namespace { struct base { virtual int foo() noexcept {return 1;} }; } struct derived1 final : base

[Bug c++/84306] New: Wrong overload selected with -std=c++17, explicit and {}

2018-02-09 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: --- Following code uses function (1), however function (2) must be used. struct foo { foo() = default; foo(foo const&); /

[Bug c++/89301] New: [concepts] requires clause on a template alias is ignored

2019-02-12 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: --- The following code compiles however it should not: template requires(condition) using enable_if_t = T; template> void foo(); void t

[Bug libgcc/89625] New: Freeing memory under the lock in __deregister_frame_info_bases

2019-03-07 Thread antoshkka at gmail dot com
-optimization Severity: normal Priority: P3 Component: libgcc Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- `__deregister_frame_info_bases` in file unwind-dw2-fde.c calls `free (ob->u.sort);` under

[Bug c++/89700] New: Warn if move constructor is not generated and not deleted

2019-03-13 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: --- It would be great to have a warning that helps to identify classes with sub-optimal move semantics. Foe example it

[Bug libstdc++/89728] New: ctype is underconstrained

2019-03-15 Thread antoshkka at gmail dot com
++ Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Because of that overloads from [locale.convenience] compile well with creepy charT template arguments like std::string: std::tolower(std::string{}, std::locale::classic()); That leads to

[Bug c++/89785] New: Incorrect "not a constant expression" error with switch statement that returns

2019-03-21 Thread antoshkka at gmail dot com
Keywords: rejects-valid Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- The following code fails to compile: constexpr int Addrlen(int domain) {

[Bug c++/89785] Incorrect "not a constant expression" error with switch statement that returns

2019-03-21 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89785 --- Comment #2 from Antony Polukhin --- > So you say that Addrlen(0) and Addrlen(2) are proper constexprs? Of course Addrlen(1) is not. Yes. But GCC does not even allow to define the Addrlen function: https://godbolt.org/z/xqR2Lr

[Bug libstdc++/89816] New: [9 Regression] std::variant move construction regressed since GCC 8.3

2019-03-25 Thread antoshkka at gmail dot com
Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- The following code #include struct my_type{ my_type(my_type&&) noexcept; }; using V1 = std::variant; V1 te

[Bug c++/89700] Warn if move constructor is not generated and not deleted

2019-03-25 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89700 --- Comment #6 from Antony Polukhin --- Another way to workaround the warning is to use something like `my_class(my_class&) requires false;`. That's too ugly to use. I'd be fine with closing this issue as a 'won't fix'.

[Bug libstdc++/89816] [9 Regression] std::variant move construction regressed since GCC 8.3

2019-03-25 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89816 --- Comment #6 from Antony Polukhin --- The fix seems pretty trivial: in function `__variant_construct` get the address of the sorage before entering the `__do_visit` and make it switch only by the `__rhs`. Pseudo-code: template void __va

[Bug libstdc++/89819] New: [9 Regression] std::variant operators regressed since GCC 8.3

2019-03-25 Thread antoshkka at gmail dot com
-optimization Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- The following code #include struct my_type{}; bool operator==(const my_type&, const my_

[Bug libstdc++/89816] [9 Regression] std::variant move construction regressed since GCC 8.3

2019-03-25 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89816 --- Comment #9 from Antony Polukhin --- BTW, I think there are some other cases where binary visitation could be simplified to unary (significantly reducing the code size and improving the compile times). I've filled Bug 89819, but looks like ass

[Bug c++/89820] New: Returning empty type produces unnecessary instructions

2019-03-25 Thread antoshkka at gmail dot com
: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the following code struct my_type_impl {}; my_type_impl foo0() { return {}; } my_type_impl foo1() { my_type_impl tmp

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

2019-03-26 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: --- Space for the `__variant_cookie` state is already reserved in _Multi_array `_Multi_array<

[Bug libstdc++/89825] New: Jump table for variant visitation could be shortened for never empty variants

2019-03-26 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: --- The `__do_cookie` computation in `_Multi_array` seems suboptimal. There are

[Bug libstdc++/89825] Jump table for variant visitation could be shortened for never empty variants

2019-03-26 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89825 --- Comment #1 from Antony Polukhin --- There's a typo in proposed solution: it should be `&& !_Never_empty` in `_Multi_array`.

[Bug libstdc++/89825] Jump table for variant visitation could be shortened for never empty variants

2019-03-26 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89825 --- Comment #4 from Antony Polukhin --- > Would you be willing to complete a copyright assignment for contributions to > GCC? Yes, I can do that. Please send the instructions to my email.

[Bug libstdc++/89851] New: [Regression] std::variant comparison operators violate [variant.relops]

2019-03-27 Thread antoshkka at gmail dot com
Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- The following function should return `false` according to [variant.relops]: #include using V = std::variant; bool test1

[Bug middle-end/89922] New: Loop on fixed size array is not unrolled and poorly optimized

2019-04-02 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: struct array { int data[5]; }; array test(int i) { array a = {1

[Bug middle-end/89922] Loop on fixed size array is not unrolled and poorly optimized at -O2

2019-04-04 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89922 --- Comment #2 from Antony Polukhin --- The estimation is very close to the actual result for the loop. But it does not take into the account the instructions before the loop that are eliminated due to unrolling. Some heuristic like "initializin

[Bug middle-end/89922] Loop on fixed size array is not unrolled and poorly optimized at -O2

2019-04-05 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89922 --- Comment #4 from Antony Polukhin --- > Was the testcase just an artificial one or does it appear (in this > isolated form!) in a real application/benchmark? I was not investigating a particular benchmark or real world application at first. M

[Bug libstdc++/90008] New: [9 Regression] variant attempts to copy rhs in comparison operators

2019-04-08 Thread antoshkka at gmail dot com
-valid Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- _VARIANT_RELATION_FUNCTION_TEMPLATE accidentally accepts the second visitable by copy in

[Bug target/90202] New: AVX-512 instructions not used

2019-04-22 Thread antoshkka at gmail dot com
Component: target Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the following test program: struct v { int val[16]; }; v test(v a, v b) { v res; for (int i = 0; i < 16; i++) res.

[Bug c/90204] New: [8 Regression] C code is optimized worse than C++

2019-04-22 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 v { int val[16]; }; struct v test(struct v a, struct v b) { struct v res; for (int i = 0; i

[Bug target/90202] AVX-512 instructions not used

2019-04-22 Thread antoshkka at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90202 --- Comment #2 from Antony Polukhin --- Then I'm fine with the current codegen. However with -mavx512f it produces a few additional instructions for rbp register test(v, v): push rbp ; not necessary mov rax, rdi mov rbp, rsp

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

2019-05-27 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: auto test(int s) { return [&s] { return s; }; } `s` is a local variable, so we re

[Bug c++/90666] New: Warn if an UB was met during constexpr evaluation attempt

2019-05-29 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: constexpr int test() { const char* from = "wow"; char dest[1

[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

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

  1   2   3   >