[Bug tree-optimization/59429] Missed optimization opportunity in qsort-style comparison functions

2024-03-22 Thread redbeard0531 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59429 --- Comment #16 from Mathias Stearn --- Trunk still generates different code for all cases (in some cases subtly so) for both aarch64 and x86_64: https://www.godbolt.org/z/1s6sxrMWq. For both arches, it seems like LE and LG generate the best

[Bug target/113723] -freorder-blocks-and-partition emits bogus asm directives on aarch64

2024-02-02 Thread redbeard0531 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113723 --- Comment #1 from Mathias Stearn --- As a workaround sticking [[gnu::optimize("no-reorder-blocks-and-partition")]] on each function that triggers this seems to work. But that is obviously not a scalable solution.

[Bug target/113723] New: -freorder-blocks-and-partition emits bogus asm directives on aarch64

2024-02-02 Thread redbeard0531 at gmail dot com via Gcc-bugs
Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- It tries to subtract labels across the function split which the assembler rejects. At the very least it does this when

[Bug middle-end/113682] Branches in branchless binary search rather than cmov/csel/csinc

2024-02-01 Thread redbeard0531 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113682 --- Comment #5 from Mathias Stearn --- (In reply to Andrew Pinski from comment #2) > I should note that on x86, 2 cmov in a row might be an issue and worse than > branches. There is a cost model and the x86 backend rejects that. > > There are

[Bug other/113682] New: Branches in branchless binary search rather than cmov/csel/csinc

2024-01-31 Thread redbeard0531 at gmail dot com via Gcc-bugs
Priority: P3 Component: other Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- I've been trying to eliminate unpredictable branches in a hot function where perf counters show a high mispredict percentage

[Bug middle-end/113585] New: Poor codegen turning int compare into -1,0,1

2024-01-24 Thread redbeard0531 at gmail dot com via Gcc-bugs
: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- https://www.godbolt.org/z/Y31xG7EeT These two functions should be equivalent, but comp2() produces better code than comp1() on both arm64 and x86_64 int comp1

[Bug libstdc++/111588] Provide opt-out of shared_ptr single-threaded optimization

2023-10-27 Thread redbeard0531 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111588 --- Comment #5 from Mathias Stearn --- Mea culpa. The difference between boost and std was due to the code to fast-path shared_ptrs that aren't actually shared:

[Bug libstdc++/111588] Provide opt-out of shared_ptr single-threaded optimization

2023-10-27 Thread redbeard0531 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111588 --- Comment #4 from Mathias Stearn --- So even though I already knew in the back of my mind about how this can affect benchmark results, I *still* got burned by it! I was benchmarking a simple hazard pointer implementation against shared ptrs

[Bug other/111976] Large constant zero-valued objects should go in .bss rather than .rodata

2023-10-25 Thread redbeard0531 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111976 --- Comment #1 from Mathias Stearn --- Just to be clear, I think we should only do this for "large" objects or collections of objects. If you did it for small objects in general, there is a risk that they will spread out mutable data that is

[Bug other/111976] New: Large constant zero-valued objects should go in .bss rather than .rodata

2023-10-25 Thread redbeard0531 at gmail dot com via Gcc-bugs
: normal Priority: P3 Component: other Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- Right now constant objects always go in .rodata. This is nice because it will give a nice loud error if you ever write

[Bug target/104611] memcmp/strcmp/strncmp can be optimized when the result is tested for [in]equality with 0 on aarch64

2023-09-25 Thread redbeard0531 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104611 Mathias Stearn changed: What|Removed |Added CC||redbeard0531 at gmail dot com

[Bug libstdc++/111589] New: Use relaxed atomic increment (but not decrement!) in shared_ptr

2023-09-25 Thread redbeard0531 at gmail dot com via Gcc-bugs
Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- The atomic increment when copying a shared_ptr can be relaxed because it is never actually used as a synchronization

[Bug libstdc++/111588] New: Provide opt-out of shared_ptr single-threaded optimization

2023-09-25 Thread redbeard0531 at gmail dot com via Gcc-bugs
Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- Right now there is a fast-path for single-threaded programs to avoid the overhead of atomics in shared_ptr

[Bug c++/89997] Garbled expression in error message with -fconcepts

2022-10-05 Thread redbeard0531 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89997 --- Comment #6 from Mathias Stearn --- > I think this is probably not concepts-specific, and just another variant of > PR 49152. Perhaps the busted pretty printer is a general problem, but at least in this case I think the fix may be in

[Bug c++/89997] Garbled expression in error message with -fconcepts

2022-10-05 Thread redbeard0531 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89997 --- Comment #3 from Mathias Stearn --- Please reopen. It still seems to be broken with -std=c++20 as the only flag: https://godbolt.org/z/bWMq4s6xb (trunk) https://godbolt.org/z/W3xWjWaGe (12.2) Output: : In function 'void test()': :16:15:

[Bug c++/105397] Cannot export module initializer symbols with `-fvisibility=hidden`

2022-06-09 Thread redbeard0531 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105397 Mathias Stearn changed: What|Removed |Added CC||redbeard0531 at gmail dot com

[Bug target/105661] New: Comparisons to atomic variables generates less efficient code

2022-05-19 Thread redbeard0531 at gmail dot com via Gcc-bugs
Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- With normal variables, gcc will generate a nice cmp/js pair when checking if the high bit is null. When using an atomic, gcc

[Bug c++/105560] New: Spurious -Wunused-local-typedefs warning on a typedef used on returned type

2022-05-11 Thread redbeard0531 at gmail dot com via Gcc-bugs
: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- https://godbolt.org/z/zcY11ezev #include #include template typename F::Out call(F&& fun) { typename F:

[Bug c++/105534] -Wmaybe-uninitialized cases shouldn't suppress -Wuninitialized warnings

2022-05-09 Thread redbeard0531 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105534 --- Comment #4 from Mathias Stearn --- (In reply to Richard Biener from comment #2) > Note there's > > _2 = value_1(D) * x_2; > > where _2 might be effectively uninitialized iff x_2 is not zero. When x_2 > is zero then _2 has a

[Bug c++/105534] -Wmaybe-uninitialized cases shouldn't suppress -Wuninitialized warnings

2022-05-09 Thread redbeard0531 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105534 --- Comment #3 from Mathias Stearn --- One slightly confusing aspect is that the wording of the flag implies that the variable may or may not be uninitialzied (because in -Wmaybe-uninitialized maybe binds directly to uninitialized), while

[Bug c++/105534] New: -Wmaybe-uninitialized shouldn't suppress -Wuninitialized warnings

2022-05-09 Thread redbeard0531 at gmail dot com via Gcc-bugs
Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- The following function emits a -Wuninitialized warning on ++count with -Wall https://godbolt.org/z/KfaMEETY1: int test(bool cond

[Bug target/105496] New: Comparison optimizations result in unnecessary cmp instructions

2022-05-05 Thread redbeard0531 at gmail dot com via Gcc-bugs
Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- https://godbolt.org/z/1zdYsaqEj Consider these equivalent functions: int test1(int x) { if (x <= 10) return

[Bug libstdc++/104223] New: GCC unable to inline trivial functions passed to views::filter and transform unless lifted into types

2022-01-25 Thread redbeard0531 at gmail dot com via Gcc-bugs
: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- I'm not sure if this is an issue with the optimizer or the way that the library code

[Bug c++/102876] GCC fails to use constant initialization even when it knows the value to initialize

2021-10-26 Thread redbeard0531 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102876 --- Comment #12 from Mathias Stearn --- (In reply to Jakub Jelinek from comment #10) > So we'd just punt at optimizing that, we don't know if b is read or written > by foo (and, note, it doesn't have to be just the case of explicitly being >

[Bug c++/102876] GCC fails to use constant initialization even when it knows the value to initialize

2021-10-21 Thread redbeard0531 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102876 --- Comment #3 from Mathias Stearn --- > Why not just make the function constexpr though? That isn't always possible. Sometimes the initializer may call a third-party function that is inline, but not yet marked constexpr (it may need to

[Bug c++/102876] New: GCC fails to use constant initialization even when it knows the value to initialize

2021-10-21 Thread redbeard0531 at gmail dot com via Gcc-bugs
Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- See: https://godbolt.org/z/KnKv9j8b9 #include using namespace std::literals; /*not constexpr*/ inline std

[Bug ipa/102528] Unused out-of-line functions emitted for trivial coroutines

2021-10-05 Thread redbeard0531 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102528 --- Comment #8 from Mathias Stearn --- Sorry again about the confusion caused by my typo. I am not able to edit the comment to make it clear that the comment#0 should be ignored. If that happens again, would it be better for me to close the

[Bug c++/102528] Unused out-of-line functions emitted for trivial coroutines

2021-09-29 Thread redbeard0531 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102528 --- Comment #1 from Mathias Stearn --- Sorry, there was a typo in the initial code. I forgot the trivial implementation of await_resume(). (D'oh!) Now I can see that test() is just a ret instruction, but there is still a lot of dead code

[Bug c++/102528] New: Unable to inline even trivial coroutines

2021-09-29 Thread redbeard0531 at gmail dot com via Gcc-bugs
++ Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- https://godbolt.org/z/aoab9W4xG This should all compile away, and test() should just be a single ret instruction. That is not what happens now, even with -O3. #include

[Bug c++/100493] Lambda default copy capture that captures "this" cannot be used in both C++17 and C++20 modes

2021-09-22 Thread redbeard0531 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100493 --- Comment #3 from Mathias Stearn --- When reading https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82611, I noticed that C++17 actually requires the warning on [=, this] from a conforming implementation:

[Bug c++/100493] Lambda default copy capture that captures "this" cannot be used in both C++17 and C++20 modes

2021-09-22 Thread redbeard0531 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100493 Mathias Stearn changed: What|Removed |Added CC||redbeard0531 at gmail dot com

[Bug web/102365] New: Function attribute docs should have an anchor or id on each attribute.

2021-09-16 Thread redbeard0531 at gmail dot com via Gcc-bugs
: normal Priority: P3 Component: web Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- https://gcc.gnu.org/onlinedocs/gcc-4.7.2/gcc/Function-Attributes.html This would make it easier to link to the docs

[Bug c++/102363] New: source_location in await_transform has function_name referring to internal coroutine funclet rather than source-level function

2021-09-16 Thread redbeard0531 at gmail dot com via Gcc-bugs
Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- When a promise_type::await_transform() has

[Bug c++/100876] New: -Wmismatched-new-delete should either look through or ignore placement new

2021-06-02 Thread redbeard0531 at gmail dot com via Gcc-bugs
: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- https://godbolt.org/z/KTTMrEGns Example code: free(new (malloc(4)) int()); // Warns but shouldn't delete new

[Bug libstdc++/99979] New: condition_variable_any has wrong behavior if Lock::lock() throws

2021-04-08 Thread redbeard0531 at gmail dot com via Gcc-bugs
Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- https://eel.is/c++draft/thread.condvarany.wait says "Postconditions: lock is locked by the calling thread. […] Re

[Bug rtl-optimization/99470] Convert fixed index addition to array address offset

2021-03-09 Thread redbeard0531 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99470 Mathias Stearn changed: What|Removed |Added Status|RESOLVED|UNCONFIRMED Resolution|INVALID

[Bug c++/99470] New: Convert fixed index addition to array address offset

2021-03-08 Thread redbeard0531 at gmail dot com via Gcc-bugs
Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- These two functions do the same thing but f() is the cleaner source code (especially when arr is a std::array) while g() generates better code: https

[Bug middle-end/99339] Poor codegen with simple varargs

2021-03-02 Thread redbeard0531 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99339 --- Comment #6 from Mathias Stearn --- > The question is how common in the wild it is and if it is worth the work. I'm not sure how common it is, but this is my use case. The code in the bug report is a slightly simplified example from some

[Bug libstdc++/95079] unorderd_map::insert_or_assign and try_emplace should only hash and mod once unless there is a rehash.

2021-03-02 Thread redbeard0531 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95079 --- Comment #5 from Mathias Stearn --- @François Dumont: Sorry I didn't see your question earlier. The reason that unordered_map perf hurts on 64-bit platforms is because it is designed to do a size_t modulus-by-prime on every lookup, and on

[Bug middle-end/99339] Poor codegen with simple varargs

2021-03-02 Thread redbeard0531 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99339 --- Comment #5 from Mathias Stearn --- I filed a related bug with clang right after this one if anyone want to follow along https://bugs.llvm.org/show_bug.cgi?id=49395. Just because clang does worse doesn't mean gcc shouldn't do better ;)

[Bug c/99339] New: Poor codegen with simple varargs

2021-03-02 Thread redbeard0531 at gmail dot com via Gcc-bugs
Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- These two functions should generate the same code, but the varargs version is much worse. And it is even worser still when you enable -fstack-protector-strong. https://godbolt.org/z/noEYoh

[Bug c++/99047] New: ICE on simple task coroutine example

2021-02-09 Thread redbeard0531 at gmail dot com via Gcc-bugs
++ Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- https://godbolt.org/z/ecxEbb Code compiles on MSVC and clang, and at least on clang produces the expected output. #include #include template struct [[nodiscard]] task

[Bug libstdc++/99021] coroutine_handle<_Promise>::from_address() should be noexcept

2021-02-09 Thread redbeard0531 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99021 --- Comment #3 from Mathias Stearn --- Thanks for the quick fix! Any chance of a backport of this and

[Bug libstdc++/99021] coroutine_handle<_Promise>::from_address() should be noexcept

2021-02-09 Thread redbeard0531 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99021 --- Comment #1 from Mathias Stearn --- clang bug for reference https://bugs.llvm.org/show_bug.cgi?id=49109

[Bug libstdc++/99021] New: coroutine_handle<_Promise>::from_address() should be noexcept

2021-02-09 Thread redbeard0531 at gmail dot com via Gcc-bugs
normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- While it isn't required by the standard, it seems odd that coroutine_handle::from_address() is noexcept while t

[Bug c++/98639] GCC accepts cast from Base to Derived in C++20 mode

2021-01-12 Thread redbeard0531 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98639 Mathias Stearn changed: What|Removed |Added CC||redbeard0531 at gmail dot com

[Bug libstdc++/95079] New: unorderd_map::insert_or_assign and try_emplace should only hash and mod once unless there is a rehash.

2020-05-12 Thread redbeard0531 at gmail dot com
: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- Currently insert_or_assign() and try_emplace() call find(key) and fall back to emplace

[Bug libstdc++/94854] New: Comment in basic_string.tcc incorrectly says std::string doesn't have explicit instantiation in C++17

2020-04-29 Thread redbeard0531 at gmail dot com
Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- https://github.com/gcc-mirror/gcc/blob

[Bug libstdc++/90295] Please define ~exception_ptr inline

2019-11-08 Thread redbeard0531 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90295 Mathias Stearn changed: What|Removed |Added CC||redbeard0531 at gmail dot com

[Bug c++/91759] New: g++ accepts ill-formed deduction guides in wrong scope

2019-09-12 Thread redbeard0531 at gmail dot com
Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- namespace N { template struct X{ X(int); }; } using N::X; X(int) -> X; This is supposed to not compile due to http://eel.is/c++draft/temp.deduct.guid

[Bug c++/90287] New: [concepts] bogus error on overload failure inside requires-expression

2019-04-29 Thread redbeard0531 at gmail dot com
Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- https://godbolt.org/z/30Cf6s #include template constexpr inline bool isAddable = requires(const T& lhs, const U&

[Bug c++/90033] New: [concepts] ICE segfault evaluating a requires clause that transitively depends on itself

2019-04-09 Thread redbeard0531 at gmail dot com
Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- https://godbolt.org/z/SEfFol This is a creduce'd example that tripped a segfault in our Real World Code

[Bug c++/90031] New: Bogus parse error trying to explicitly specialize a template variable inside class scope

2019-04-09 Thread redbeard0531 at gmail dot com
Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- https://godbolt.org/z/y5GQZd struct Struct { template constexpr static bool use_cond = false

[Bug c++/90019] New: [8 regression] Bogus ambiguous overload error for NTTP pack of disjoint enable_ifs unless there is an unsupplied default argument

2019-04-08 Thread redbeard0531 at gmail dot com
Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- This code compiles fine with 7 and trunk but fails

[Bug c++/89997] New: Garbled expression in error message with -fconcepts

2019-04-06 Thread redbeard0531 at gmail dot com
: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- Usually -fconcepts delivers excellent error messages, but this one is pretty bad. It looks like this goes back to 6.2, when it first started to show the expression

[Bug c++/89781] Misleading error messages when initializing a static data member in-class

2019-03-22 Thread redbeard0531 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89781 --- Comment #3 from Mathias Stearn --- Yeah, my point wasn't that this code should be accepted, it was that the error messages should be improved. Ideally there would even be fixits suggesting adding constexpr where it would be valid, otherwise

[Bug c++/89781] New: Misleading error messages when initializing a static data member in-class

2019-03-20 Thread redbeard0531 at gmail dot com
Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- The error messages make sense in a pre-c++17 world before inline variables existed. Now they are lies! struct X{}; struct Y

[Bug c++/89780] New: -Wpessimizing-move is too agressive with templates and recommends pessimization

2019-03-20 Thread redbeard0531 at gmail dot com
: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- https://godbolt.org/z/JA-0Gq #include struct Dest { Dest() = default; Dest(Dest&&); Dest(co

[Bug middle-end/89739] New: pessimizing vectorization at -O3 to load two u64 objects

2019-03-16 Thread redbeard0531 at gmail dot com
Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- https://godbolt.org/z/8vIGZ3 using u64 = unsigned long long; struct u128 {u64 a, b;}; inline u64 load8(void* ptr) { u64 out

[Bug c++/89706] New: -Wstringop-truncation strncpy message is confusing and has psuedo-false-positives

2019-03-13 Thread redbeard0531 at gmail dot com
: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- https://godbolt.org/z/BAeXQB "strncpy output truncated copying between 0 and 8 bytes from a string of len

[Bug c++/89688] New: -Wstringop-overflow confused by 2D array of char

2019-03-12 Thread redbeard0531 at gmail dot com
++ Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- Also, for some reason it repeats the warning 3 times. https://godbolt.org/z/SStUsl // Fine extern const char a[2] = {'1'}; auto z = __builtin_strlen(a); // Warns extern

[Bug c++/89682] New: g++9 incorrectly disallows using private static method as default arg to ctor of template type

2019-03-12 Thread redbeard0531 at gmail dot com
Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- New in GCC9. No other compiler errors on this: https://godbolt.org/z/480KfZ template class C

[Bug c++/89640] [9 Regression] g++ chokes on lambda with __attribute__

2019-03-11 Thread redbeard0531 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89640 --- Comment #4 from Mathias Stearn --- @Jakub, This code doesn't have either mutable or noexcept, so the "wrong place in the grammer" issue doesn't apply. That part of the fix seems correct and useful. While it seems correct to fix what the

[Bug c++/89640] [9 Regression] g++ chokes on lambda with __attribute__

2019-03-11 Thread redbeard0531 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89640 --- Comment #2 from Mathias Stearn --- Unfortunately the c++ attributes syntax applies to the lambda type rather than the function, so the warning is correct. The old style __attribute__ syntax seems to be the only way to annotate the lambda

[Bug c++/89640] New: g++ chokes on lambda with __attribute__

2019-03-08 Thread redbeard0531 at gmail dot com
++ Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- Regression in gcc 9 vs 8. https://godbolt.org/z/MGL0H4 void test() { []() __attribute__((noinline,cold)) { asm volatile(""); }(); } : In function

[Bug c++/88865] New: [[no_unique_address]] leads to sizeof(T) == 0, which cannot be

2019-01-15 Thread redbeard0531 at gmail dot com
Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- https://godbolt.org/z/rJT5X9 struct B {}; struct A { [[no_unique_address]] B a; [[no_unique_address]] B b

[Bug c++/87312] New: statics in lambdas should be weak not local symbols

2018-09-14 Thread redbeard0531 at gmail dot com
: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- https://godbolt.org/z/oSuiQO // IN HEADER: inline auto lambda = [] () -> int* { static int foo; return }; inline int* func() { static int foo; ret

[Bug c++/67012] decltype(auto) with trailing return type

2018-08-14 Thread redbeard0531 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67012 Mathias Stearn changed: What|Removed |Added CC||redbeard0531 at gmail dot com

[Bug c++/86276] New: Poor codegen when returning a std::vector

2018-06-21 Thread redbeard0531 at gmail dot com
++ Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- https://godbolt.org/g/aCiuAy While I'm a bit sad that good() isn't just "ret", I think that the current rules for allocation elision require something like that cod

[Bug middle-end/86140] New: constprop clones with identical bodies

2018-06-13 Thread redbeard0531 at gmail dot com
Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- This was tweaked example code to demonstrate something totally unrelated, but I noticed it was doing the constprop clone thing for functions with identical instructions, which

[Bug c++/86072] New: Poor codegen with atomics

2018-06-06 Thread redbeard0531 at gmail dot com
: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- https://godbolt.org/g/aEFhq8 #include std::atomic progress{-1}; void combine_writes1() { // These should be reduced to a single store(0,release), // At least as long as release

[Bug middle-end/86056] Codegen can result in multiple sequential mfence instructions

2018-06-05 Thread redbeard0531 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86056 --- Comment #2 from Mathias Stearn --- Oh, I agree that this optimization must be permitted. I was using this example to prove this to someone else who didn't believe that. I only mentioned that to explain how that weird source code came to be.

[Bug target/86056] New: Codegen can result in multiple sequential mfence instructions

2018-06-05 Thread redbeard0531 at gmail dot com
Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- This is from an example to prove that atomic_thread_fence does not prevent the compiler from optimizing non-escaped memory. https

[Bug libstdc++/85813] make_exception_ptr should support __cxa_init_primary_exception path even with -fno-exceptions

2018-05-17 Thread redbeard0531 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85813 --- Comment #7 from Mathias Stearn --- > Simply returning an empty exception_ptr is what happened before the PR 64241 > change, so what we do now retains that behaviour. That might be the main > reason for it. Silently dropping errors always

[Bug libstdc++/85813] make_exception_ptr should support __cxa_init_primary_exception path even with -fno-exceptions

2018-05-17 Thread redbeard0531 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85813 --- Comment #3 from Mathias Stearn --- My assumption was that if E(...) throws and it can't be caught, it should be treated as any other case when an -fno-exceptions TU calls a throwing function. In this case that would mean calling terminate()

[Bug libstdc++/85813] New: make_exception_ptr should support __cxa_init_primary_exception path even with -fno-exceptions

2018-05-16 Thread redbeard0531 at gmail dot com
: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- It looks like nothing in that path actually needs exception support. This would

[Bug libstdc++/85812] New: make_exception_ptr can leak the allocated exception if construction throws

2018-05-16 Thread redbeard0531 at gmail dot com
: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- I think if this line throws the exception allocated on line 185 will leak: https://github.com/gcc-mirror/gcc/blob

[Bug c++/85799] __builin_expect doesn't propagate through inlined functions

2018-05-15 Thread redbeard0531 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85799 --- Comment #1 from Mathias Stearn --- LLVM bug: https://bugs.llvm.org/show_bug.cgi?id=37476

[Bug c++/85799] New: __builin_expect doesn't propagate through inlined functions

2018-05-15 Thread redbeard0531 at gmail dot com
Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- It seems like __builtin_expect doesn't propagate to conditions when inlined. This is unfortunate because in some cases it would be nice

[Bug c++/83400] g++ -O1 doesn't execute any code in destructors with a throw statement if it sees another throw

2018-05-15 Thread redbeard0531 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83400 --- Comment #3 from Mathias Stearn --- This is related to https://wg21.link/CWG2219

[Bug c++/85736] New: Support warn_unused or warn_unused_result on specific constructors

2018-05-10 Thread redbeard0531 at gmail dot com
Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- It would be nice to get the benefits of those attributes on a per-constructor basis, rather than requiring them on the whole type

[Bug middle-end/85721] bad codegen for looped copy of primitives at -O2 and -O3 (differently bad)

2018-05-10 Thread redbeard0531 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85721 --- Comment #4 from Mathias Stearn --- Marc Glisse pointed out at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85720#c3 that my I missed an aliasing case when I created this ticket. memmove isn't a valid replacement if out is in the range (in,

[Bug middle-end/85720] bad codegen for looped assignment of primitives at -O2

2018-05-09 Thread redbeard0531 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85720 --- Comment #4 from Mathias Stearn --- (In reply to Marc Glisse from comment #3) > Again, you are ignoring aliasing issues (just like in your other PR the > function copy isn't equivalent to memmove). Does adding __restrict change > the result?

[Bug middle-end/85721] bad codegen for looped copy of primitives at -O2 and -O3 (differently bad)

2018-05-09 Thread redbeard0531 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85721 --- Comment #3 from Mathias Stearn --- @Jonathan Wakely, that is because std::copy cheats and calls memmove directly. A slight modification of the type that shouldn't matter defeats that optimization and causes both forms to degrade to

[Bug middle-end/85720] bad codegen for looped assignment of primitives at -O2

2018-05-09 Thread redbeard0531 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85720 --- Comment #2 from Mathias Stearn --- Hmm. Taking the example from the -ftree-loop-distribute-patterns documentation, it still seems to generate poor code, this time at both -O2 and -O3: https://godbolt.org/g/EsQDj8 Why isn't that transformed

[Bug c++/85721] New: bad codegen for looped copy of primitives at -O2 and -O3 (differently bad)

2018-05-09 Thread redbeard0531 at gmail dot com
: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- https://godbolt.org/g/Gg9fFt Related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85720, but filed separately because

[Bug c++/85720] New: bad codegen for looped assignment of primitives at -O2

2018-05-09 Thread redbeard0531 at gmail dot com
Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- https://godbolt.org/g/qp19Cv using SIZE_T = decltype(sizeof(0)); void fill(char* p, SIZE_T n) { for (SIZE_T i = 0; i < n; i++){ p[i] =

[Bug c++/85707] -Wclass-memaccess should excempt safe usage inside of a class and its friends

2018-05-09 Thread redbeard0531 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85707 --- Comment #8 from Mathias Stearn --- > If the constructor had other side-effects (e.g., count > the number of objects of the class) bypassing it could > violate the invariant. I thought one of the points of friendship was to allow friends

[Bug c++/85707] -Wclass-memaccess should excempt safe usage inside of a class and its friends

2018-05-08 Thread redbeard0531 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85707 --- Comment #2 from Mathias Stearn --- Here is a boiled down example of some of our code that trips this warning: https://godbolt.org/g/ChLrch. It also shows why we do this, since the codegen is *substantially* better for init_table_memset than

[Bug c++/85707] New: -Wclass-memaccess should excempt safe usage inside of a class and its friends

2018-05-08 Thread redbeard0531 at gmail dot com
: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- I get the point of the warning and would like to be able to turn it on. However we have some types that have been

[Bug c++/85680] Missed optimization for value-init of variable-sized allocation

2018-05-07 Thread redbeard0531 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85680 --- Comment #3 from Mathias Stearn --- MSVC and ICC both also handle this poorly: https://godbolt.org/g/i4wMYa https://developercommunity.visualstudio.com/content/problem/246786/poor-codegen-for-value-init-followed-by-explicit-i.html

[Bug c++/85680] Missed optimization for value-init of variable-sized allocation

2018-05-07 Thread redbeard0531 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85680 --- Comment #2 from Mathias Stearn --- FYI, I don't think this is a signed/unsigned thing since it also repros with unsigned long https://godbolt.org/g/LTmrpi My initial repo actually used size_t, but I (incorrectly) changed it to long rather

[Bug c++/85680] New: Missed optimization for value-init of variable-sized allocation

2018-05-07 Thread redbeard0531 at gmail dot com
Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- https://godbolt.org/g/6yZEKf (compiled with -O3) char* variableSize(long n) { auto p = new char[n](); for (int i = 0; i < n

[Bug c++/83400] New: g++ -O1 doesn't execute any code in destructors with a throw statement if it sees another throw

2017-12-12 Thread redbeard0531 at gmail dot com
Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- Repro code below doesn't print the "in dtor" line when compiled with -O1 or higher. It d

[Bug tree-optimization/77943] [5/6 Regression] Optimization incorrectly commons noexcept calls with non-noexcept calls

2016-10-17 Thread redbeard0531 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77943 --- Comment #12 from Mathias Stearn --- We were hoping to replace many places in our code that does the following with noexcept attributes on functions: > try {doStuffThatShouldntThrow();} catch(...) {std::terminate();} We wanted to take

[Bug c++/77943] Optimization incorrectly commons noexcept calls with non-noexcept calls

2016-10-11 Thread redbeard0531 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77943 --- Comment #3 from Mathias Stearn --- > Not being a C++ expect, but following spec: > http://en.cppreference.com/w/cpp/language/noexcept_spec > > "If a search for a matching exception handler leaves a function marked > noexcept or

[Bug c++/77943] Optimization incorrectly commons noexcept calls with non-noexcept calls

2016-10-11 Thread redbeard0531 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77943 --- Comment #1 from Mathias Stearn --- Created attachment 39787 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=39787=edit Reproducer

[Bug c++/77943] New: Optimization incorrectly commons noexcept calls with non-noexcept calls

2016-10-11 Thread redbeard0531 at gmail dot com
: critical Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- When compiled with -O0 and -01 the program behaves correctly and only calls std::terminate() when passed an argument

[Bug c++/69300] New: g++ segfault on silly noexcept case

2016-01-15 Thread redbeard0531 at gmail dot com
++ Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- Created attachment 37359 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37359=edit Preprocessed test case This is a reduced example from a ridiculous code contest. It compi