[Bug c++/114265] New: Unhelpful message when var name is also a struct name

2024-03-07 Thread denis.campredon at gmail dot com via Gcc-bugs
Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- While working with legacy code, I encountered the following problem. The code: struct Struct; int fn(Struct *); Struct *Struct; int fn(Struct

[Bug rtl-optimization/114228] New: memset/memcpy loop not always recognised with -Os

2024-03-04 Thread denis.campredon at gmail dot com via Gcc-bugs
Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- typedef __SIZE_TYPE__ size_t; void baz(char *); void foo( char *__restrict buff, const char*__restrict input) { size_t max = __builtin_strlen

[Bug target/113269] New: X86_64 generates extra mov (and xchg) when passing struct with constant value to function

2024-01-08 Thread denis.campredon at gmail dot com via Gcc-bugs
Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- On today's trunk, compiled with g++ --- typedef struct s{ char *key, *value; }s; s

[Bug tree-optimization/113268] New: (i + (i + 1) * CST) AND (i + i * CST + 1 * CST) not folded the same way

2024-01-08 Thread denis.campredon at gmail dot com via Gcc-bugs
: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- The two following functions should produce the same assembly with optimizations enabled. This lead

[Bug rtl-optimization/113234] New: missing folding to builtin_isunordered if manual nan comparison is used

2024-01-04 Thread denis.campredon at gmail dot com via Gcc-bugs
: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- Compiled with -O1, on x86-64, f1 and f2 should produce the same code than f3 and f4, but f1 and f2 use two

[Bug rtl-optimization/113231] New: x86_64 use MMX instructions for simple shift operations

2024-01-04 Thread denis.campredon at gmail dot com via Gcc-bugs
Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- Compiled with -Os, the following functions use MMX instructions for simple shift. -- void foo(int *i

[Bug c++/108093] New: Quadratic error lines printed with missing include for template

2022-12-14 Thread denis.campredon at gmail dot com via Gcc-bugs
Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- Compiled with -std=c++20, who has only missing includes, the following code prints way too much lines of error. Adding

[Bug rtl-optimization/107991] New: Extra mov instructions with ternary on x86

2022-12-06 Thread denis.campredon at gmail dot com via Gcc-bugs
: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- Compiled with -O2 on x86, gcc trunk produces 3 mov instructions for each of the following functions: int foo(bool b, int i, int j) { return b ? i - j

[Bug tree-optimization/107859] New: Fail to optimize rot13

2022-11-24 Thread denis.campredon at gmail dot com via Gcc-bugs
Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- Compiled with -O2, the following functions produce different assembly although they compute the same things: unsigned rot13_1(unsigned c

[Bug tree-optimization/105883] New: Memcmp folded only when size is a power of two

2022-06-08 Thread denis.campredon at gmail dot com via Gcc-bugs
: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- Compiled with trunk and -O2, on x86-64, the testcase bellow shows, the calls to memcmp are folded just when the size is a power of two. Other archs seems

[Bug target/105338] [12 Regression] Regression: jump or cmove generated for pattern (x ? CST : 0)

2022-04-25 Thread denis.campredon at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105338 --- Comment #13 from denis.campredon at gmail dot com --- Thanks a lots. I have a question though: foo and bar are similar, foo produces a branchless code whereas bar uses a jump. int foo(int i) { return !i ? 0 : -2; } int bar(int i

[Bug rtl-optimization/105338] New: Regression: jump or cmove generated for pattern (x ? CST : 0)

2022-04-21 Thread denis.campredon at gmail dot com via Gcc-bugs
Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- int f(int i) { return i ? 5 : 0; } int g(int i) { return i ? -2 : 0; } int h(int b) { return !!b * -2

[Bug c/105276] New: [12 Regression] executed once loop not optimized anymore

2022-04-14 Thread denis.campredon at gmail dot com via Gcc-bugs
Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- bool foo(unsigned i) { bool result = true; while (i) { i = i % 3; i = i - (i==2 ? 2 : i ? 1 : 0); result

[Bug tree-optimization/104645] New: [12 Regression] i ? i % 2 : 0 not optimized anymore

2022-02-22 Thread denis.campredon at gmail dot com via Gcc-bugs
Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- Was told to file a new PR for that case : -- int foo(unsigned i) { return i ? i % 2 : 0; } -- With trunk

[Bug tree-optimization/104639] [12 Regression] Useless loop not fully optimized anymore

2022-02-22 Thread denis.campredon at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104639 --- Comment #5 from denis.campredon at gmail dot com --- That peace of code seems related but does not need a loop unlike the original one. -- int foo(unsigned i) { return i ? i % 2 : 0; } -- With trunk 12

[Bug tree-optimization/104639] New: Useless loop not fully optimized anymore

2022-02-22 Thread denis.campredon at gmail dot com via Gcc-bugs
-optimization Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- the following code compiled with -02 --- bool foo(int i) { while (i == 4) i += 2; return i; } -- Trunk

[Bug middle-end/97968] [9/10/11/12 Regression] Unnecessary mov instruction with comparison and cmov

2022-01-21 Thread denis.campredon at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97968 --- Comment #3 from denis.campredon at gmail dot com --- This seems to be fixed for gcc12, unlike the code from pr-98303

[Bug tree-optimization/104106] Fail to remove stores to VLA inside loops

2022-01-19 Thread denis.campredon at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104106 --- Comment #2 from denis.campredon at gmail dot com --- The missed optimisations are also present if the arrays are allocated with malloc or new.

[Bug tree-optimization/104106] New: Fail to remove some useless loop

2022-01-18 Thread denis.campredon at gmail dot com via Gcc-bugs
-optimization Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- In the following snippet none of the loops are removed when compiled with -O2 or -O3. In f and g the optimizers shoulds detect that tmp_a is only written and never

[Bug c++/104105] New: Unused nothrow new not optimized

2022-01-18 Thread denis.campredon at gmail dot com via Gcc-bugs
++ Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- g++ can remove new calls when the result is unused, but fails to di the same with nothrow new calls. f() could be compiled to an empty function with optimisations

[Bug c/103647] New: constant array comparison not always folded

2021-12-10 Thread denis.campredon at gmail dot com via Gcc-bugs
Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- On trunk and gcc 11, with -O2 the following functions are not optimized to xor eax, eax bool f() { char a[] = {'a', 'c'}; char b[] = {'a', 'b

[Bug tree-optimization/94802] Failure to recognize identities with __builtin_clz

2021-01-05 Thread denis.campredon at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94802 denis.campredon at gmail dot com changed: What|Removed |Added CC||denis.campredon

[Bug tree-optimization/98278] New: switch optimisation and -fstrict-enums

2020-12-14 Thread denis.campredon at gmail dot com via Gcc-bugs
-optimization Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- Created attachment 49761 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49761=edit input file The attached file, compiled with -O2 -fstrict-enums, o

[Bug tree-optimization/98236] x plus/minus y cmp 0 produces unoptimal code

2020-12-11 Thread denis.campredon at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98236 --- Comment #1 from denis.campredon at gmail dot com --- Created attachment 49734 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49734=edit assemble generated

[Bug tree-optimization/98236] New: x plus/minus y cmp 0 produces unoptimal code

2020-12-11 Thread denis.campredon at gmail dot com via Gcc-bugs
-optimization Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- Created attachment 49733 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49733=edit input file Compiling test.c on x86 with -O2 leads to unoptimal c

[Bug rtl-optimization/98212] New: X86 unoptimal code for float equallity comparison followed by jump

2020-12-09 Thread denis.campredon at gmail dot com via Gcc-bugs
Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- For f1 code an unnecessary `comiss` instruction is used, the parity flag is still set after the `jp` instruction

[Bug tree-optimization/98169] isnan pattern not folded

2020-12-09 Thread denis.campredon at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98169 --- Comment #2 from denis.campredon at gmail dot com --- This also applies to vector types. --- typedef float __attribute__((vector_size(8))) T; T f(T a) { return a != a; } --- Gcc could generate: -- f: xorps xmm1

[Bug tree-optimization/98169] New: isnan pattern not folded

2020-12-07 Thread denis.campredon at gmail dot com via Gcc-bugs
Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- The two following functions should produce the same assembly, at least on x86, but for f1 gcc does not recognize the pattern for f1 and produce not optimal code. The problem

[Bug tree-optimization/98028] New: __builtin_sub_overflow_p not folded to const when some constraints are known

2020-11-27 Thread denis.campredon at gmail dot com via Gcc-bugs
: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- According to godbolt, f1 used to be optimised with gcc 7. The same problem can be seen with signed types

[Bug tree-optimization/98026] New: optimization dependant on condition order

2020-11-27 Thread denis.campredon at gmail dot com via Gcc-bugs
-optimization Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- In all the following functions gcc should recognize that j can't be greater than 100, and link_error should not appear in assembly. Currently only f3

[Bug rtl-optimization/97968] New: Unnecessary mov instruction with comparison and cmov

2020-11-24 Thread denis.campredon at gmail dot com via Gcc-bugs
Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- The same problem applies with all comparison operators but '==' for 'int' and 'long' on x86-64. (Returning a negative value instead of 0 makes

[Bug tree-optimization/97950] Unoptimal code generation with __builtin_*_overflow{,_p} for short and __int128

2020-11-23 Thread denis.campredon at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97950 --- Comment #2 from denis.campredon at gmail dot com --- Thanks for your fast patch. I've opened PR97961 for the __int128 problem

[Bug tree-optimization/97961] New: unnecessary moves with __builtin_{add,sub}_overflow_p and __int128

2020-11-23 Thread denis.campredon at gmail dot com via Gcc-bugs
Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- In #97950 Jackub told me to open a new bug for that. The snippet bellow has the following problems - f1 and f2

[Bug tree-optimization/97950] New: Unoptimal code generation with __builtin_*_overflow{,_p} for short and __int128

2020-11-23 Thread denis.campredon at gmail dot com via Gcc-bugs
: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- For the following code, the generation is unoptimal on x86-64. For most of the functions with `short

[Bug c++/88577] New: misleading error message with template and auto return type

2018-12-22 Thread denis.campredon at gmail dot com
Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- For the following code template struct s{} auto f() {} g++ produces a rather misleading error

[Bug tree-optimization/88314] New: range calculation of shift

2018-12-03 Thread denis.campredon at gmail dot com
Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- gcc is not able to determine that the possible values of res are 0, 8, 16, 32 and so the following function is not optimized : -- bool f(bool a, bool b, bool c

[Bug tree-optimization/88280] missing folding of logical and bitwise AND

2018-11-30 Thread denis.campredon at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88280 --- Comment #2 from denis.campredon at gmail dot com --- I don't know if I should create a separate bug report or not, since it looks kind of related. I've tried to replace the operator of the function e with other and it generates a branch

[Bug tree-optimization/88280] New: missing folding of logical and bitwise AND

2018-11-30 Thread denis.campredon at gmail dot com
: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- The following functions should all produce the same code with optimisations on (it is the same if `a' is replaced with a constant

[Bug tree-optimization/84312] New: Variadic function without named argument not inlined

2018-02-09 Thread denis.campredon at gmail dot com
Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- -- int a; static inline void f2 (...) {a++;} void f1 (void) { f2 (0

[Bug c++/83798] New: Enhancement to Wmain warnings

2018-01-11 Thread denis.campredon at gmail dot com
++ Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- Compiled with g++ the following code produces some rather confusing warnings: --- int main(short s, void** t, int** u, int** v) {} --- 1 : :1:5: warning: first

[Bug c++/83797] New: Inconsistent error messages for main

2018-01-11 Thread denis.campredon at gmail dot com
++ Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- In the following snippet: - inline static constexpr short main() { } - 1 : :1:36: error: cannot declare '::main' to be inline inline static constexpr

[Bug tree-optimization/83311] New: Unable to optimize alloc calls with casts and string builtins

2017-12-06 Thread denis.campredon at gmail dot com
Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- Hello, The fix for #pr83128 does not optimize the following testcase which should produce the same result

[Bug tree-optimization/83128] Unable to optimize {m,c}alloc when strings builtin are used

2017-12-01 Thread denis.campredon at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83128 --- Comment #4 from denis.campredon at gmail dot com --- Hi Richard, Thanks for your quick response. I don't know if I should open a new bug or not, but your patch does not seems to handle casts. It fails to optimize the following snippet

[Bug tree-optimization/83129] New: calloc zero initialization is not taken into account by gcc

2017-11-23 Thread denis.campredon at gmail dot com
Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- It seems that GCC does not know that calloc initialize the memory to zero. The the following functions could

[Bug tree-optimization/83128] New: Unable to optimize {m,c}alloc when strings builtin are used

2017-11-23 Thread denis.campredon at gmail dot com
Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- Currently gcc with -03 is able to optimize -- char f() { char * i = (char*)__builtin_malloc(100); i[0

[Bug c++/82295] New: Two errors produced with private/protected deleted methods

2017-09-22 Thread denis.campredon at gmail dot com
Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- Hello, The following code produces --- class C { int f() = delete; }; int f() { return C().f

[Bug c++/81086] New: ICE with structured binding of initializer_list

2017-06-13 Thread denis.campredon at gmail dot com
++ Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- The following code make the compiler emit an ICE with the latest snapshot :3:13: internal compiler error: in write_unqualified_name, at cp/mangle.c:1318

[Bug tree-optimization/80874] gcc does not emit cmov for minmax

2017-05-25 Thread denis.campredon at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80874 --- Comment #1 from denis.campredon at gmail dot com --- Sorry, minmax3 should not produce the same asm, since minmax return a pair of const reference. But still the code is less than optimal. One part it is because gcc might be because gcc

[Bug tree-optimization/80874] New: gcc does not emit cmov for minmax

2017-05-24 Thread denis.campredon at gmail dot com
-optimization Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- Hello, Considering the following code: -- struct pair { int min, max; }; pair minmax1(int x, int y) { if (x > y) return {y, x}; e

[Bug c++/80789] New: Better error for passing lambda with capture as function pointer

2017-05-16 Thread denis.campredon at gmail dot com
Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- With the following code: - void g(void (*)()); void f() { int x; g([x](){}); } -- gcc produce this error

[Bug c++/77846] Wrong error recovery with switch, goto and initialization skipped

2016-10-04 Thread denis.campredon at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77846 --- Comment #1 from denis.campredon at gmail dot com --- I'm pretty sure it is linked the following code, compiled with '-fpermissive' only prints A instead of AB -- enum E{ A, B }; class C {public:C(){};}; static inline void f(E e

[Bug c++/77846] New: Wrong error recovery with switch, goto and initialization skipped

2016-10-04 Thread denis.campredon at gmail dot com
Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- Compiling the following code with -Wswitch --- enum E {A, B}; class C {public: C();}; void f(E e) { goto out

[Bug c++/72806] New: Extra note/missing not location for __builtin_va_list

2016-08-04 Thread denis.campredon at gmail dot com
Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- Compiling the following code void f(struct __builtin_va_list* ap); Will result in an unfinished message ./Messages.h:1:15: error

[Bug c++/71982] New: Wrong error and note range with macro

2016-07-23 Thread denis.campredon at gmail dot com
++ Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- Created attachment 38956 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38956=edit Reproducer to the bug Compiling the attached file with `g++ ./bug.cpp' s

[Bug c++/71718] New: ICE on erroneous recursive template error printing

2016-06-30 Thread denis.campredon at gmail dot com
Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- template class A : T{}; template using sp = A; struct Base {}; template const sp rec() { return rec<T, num - 1>(); } static void f(void) {

[Bug c++/71566] Attribute [[aligned(16)]] on function is ignored

2016-06-17 Thread denis.campredon at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71566 denis.campredon at gmail dot com changed: What|Removed |Added CC||denis.campredon

[Bug tree-optimization/71558] New: missed optimization for type short, char and floating point types

2016-06-16 Thread denis.campredon at gmail dot com
Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- for the following code gcc should produce the same code for fun and fun2, but fail for shorts and char with -01

[Bug c++/71542] New: unhelpfull error for wrong initializer of initializer list

2016-06-15 Thread denis.campredon at gmail dot com
Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- For the following code #include struct s { int *i; }; void f() { std::initializer_list initializer = {{false

[Bug c++/48050] New: [c++] ice with c++ code

2011-03-09 Thread denis.campredon at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48050 Summary: [c++] ice with c++ code Product: gcc Version: 4.4.5 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org