[Bug tree-optimization/116518] New: GCC does not optimize-out useless operations. Clang does.

2024-08-28 Thread socketpair at gmail dot com via Gcc-bugs
Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: socketpair at gmail dot com Target Milestone: --- https://godbolt.org/z/d46448vqa -std=c++23 -O3 -fno-exceptions

[Bug c++/111577] New: -Os gives significantly bigger code than -O0

2023-09-24 Thread socketpair at gmail dot com via Gcc-bugs
++ Assignee: unassigned at gcc dot gnu.org Reporter: socketpair at gmail dot com Target Milestone: --- Yes, I saw #35806, #41175 and others. See https://godbolt.org/z/Pnh89Y3Yb ``` #include using namespace std; int main(int argc, char* argv[]) { if (argv[0] == nullptr

[Bug tree-optimization/108418] gcc does not optimize trivial code

2023-01-16 Thread socketpair at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108418 --- Comment #1 from Коренберг Марк --- Sorry, but such kind of code happens as a result of C-code automatic generation.

[Bug tree-optimization/108418] New: gcc does not optimize trivial code

2023-01-16 Thread socketpair at gmail dot com via Gcc-bugs
-optimization Assignee: unassigned at gcc dot gnu.org Reporter: socketpair at gmail dot com Target Milestone: --- https://godbolt.org/z/s3j8jK6ca ``` #include int firewall1(const uint8_t *restrict data) { const uint8_t ip_proto = *data; const uint16_t dst_port = *((const

[Bug tree-optimization/108215] New: Does not optimize trivial case with bit operations

2022-12-23 Thread socketpair at gmail dot com via Gcc-bugs
Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: socketpair at gmail dot com Target Milestone: --- https://godbolt.org/z/5e3eKqPqs ```C #include int firewall3(const uint8_t *restrict data) { const uint32_t src = *((const uint32_t *)data); if

[Bug tree-optimization/107767] [13 Regression] switch to table conversion happening even though using btq is better

2022-12-02 Thread socketpair at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107767 --- Comment #8 from Коренберг Марк --- Okay, but why switch-case is not handled using fast implementation using masks (when difference between smallest and biggest integer <=64 ? See the first function in my first message where it works as expe

[Bug tree-optimization/107767] [13 Regression] switch to table conversion happening even though using btq is better

2022-12-02 Thread socketpair at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107767 --- Comment #5 from Коренберг Марк --- Not only -s problem. I think -O3 in gcc 12.2 will run faster than -O3 in gcc 13 (for this case). this code should not be treated as if-else-if-else-if. gcc 12 does its job right.

[Bug regression/107767] GCC has some problems in optimizer of trivial case

2022-11-21 Thread socketpair at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107767 --- Comment #3 from Коренберг Марк --- I forgot to add. gcc 12.2 - everything is OK. gcc 13 - with bug.

[Bug regression/107767] GCC has some problems in optimizer of trivial case

2022-11-20 Thread socketpair at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107767 --- Comment #1 from Коренберг Марк --- See assembler output for firewall2(). It's not -Os optimized (compare to firewall(), which is ok) ``` firewall: movw64(%rdi), %ax cmpb$17, (%rdi) sete%cl leal

[Bug regression/107767] New: GCC has some problems in optimizer of trivial case

2022-11-20 Thread socketpair at gmail dot com via Gcc-bugs
Component: regression Assignee: unassigned at gcc dot gnu.org Reporter: socketpair at gmail dot com Target Milestone: --- See https://godbolt.org/z/rTfTondfP ``` #include int firewall(const uint8_t *restrict data) { const uint8_t ip_proto = *data; const uint16_t dst_port

[Bug c/70308] memset generates rep stosl instead of rep stosq

2016-03-22 Thread socketpair at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70308 --- Comment #2 from Коренберг Марк --- Please read carefully. All conditions are the same, except different branching. So, gcc choose "rep stosl" by unknown cause.

[Bug c/70308] New: memset generates rep stosl instead of rep stosq

2016-03-19 Thread socketpair at gmail dot com
Assignee: unassigned at gcc dot gnu.org Reporter: socketpair at gmail dot com Target Milestone: --- Consider this program: = #include #include #include int main() { char buf[128]; if (scanf("%s", buf) != 1) return 42;

[Bug lto/68902] --as-needed consider library as unneeded even when library have __init functions

2015-12-16 Thread socketpair at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68902 --- Comment #2 from Коренберг Марк --- https://sourceware.org/bugzilla/show_bug.cgi?id=19372

[Bug lto/68902] New: --as-needed consider library as unneeded even when library have __init functions

2015-12-14 Thread socketpair at gmail dot com
Severity: normal Priority: P3 Component: lto Assignee: unassigned at gcc dot gnu.org Reporter: socketpair at gmail dot com Target Milestone: --- Original bug was reported here: https://github.com/thom311/libnl/issues/93 libnl3 have such function: static void

[Bug c/54340] internal compiler error: Illegal instruction (int main() returns nothing, only when -O2/-O3 used)

2012-08-21 Thread socketpair at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54340 --- Comment #3 from Коренберг Марк 2012-08-21 07:32:25 UTC --- Yes, I tested on gentoo, no error appear. I have reported to ubuntu bug tracker: https://bugs.launchpad.net/ubuntu/+source/gcc-4.6/+bug/1039401

[Bug c/54340] New: internal compiler error: Illegal instruction (int main() returns nothing, only when -O2/-O3 used)

2012-08-21 Thread socketpair at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54340 Bug #: 54340 Summary: internal compiler error: Illegal instruction (int main() returns nothing, only when -O2/-O3 used) Classification: Unclassified Product: gcc Version: 4.6.3

[Bug tree-optimization/45340] __builtin_expect and -Os generates stupid code

2010-08-25 Thread socketpair at gmail dot com
--- Comment #7 from socketpair at gmail dot com 2010-08-25 12:23 --- Well, I understand that problem is not in __builtin_expect. Should I open new, separate bug about block reordering and generating "jmp to next line" ? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45340

[Bug tree-optimization/45340] __builtin_expect and -Os generates stupid code

2010-08-23 Thread socketpair at gmail dot com
--- Comment #5 from socketpair at gmail dot com 2010-08-24 03:35 --- > There is nothing the compiler can do really. Why ? I compared assembler listings with likely() swapped with unlikely(). As I suggest, it helps to choose between je and jne in each case, and other circumstances

[Bug tree-optimization/45340] __builtin_expect and -Os generates stupid code

2010-08-19 Thread socketpair at gmail dot com
--- Comment #3 from socketpair at gmail dot com 2010-08-19 14:28 --- Created an attachment (id=21521) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21521&action=view) without buggy jmp -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45340

[Bug tree-optimization/45340] __builtin_expect and -Os generates stupid code

2010-08-19 Thread socketpair at gmail dot com
--- Comment #2 from socketpair at gmail dot com 2010-08-19 14:28 --- Created an attachment (id=21520) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21520&action=view) with stupid jmp -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45340

[Bug tree-optimization/45340] __builtin_expect and -Os generates stupid code

2010-08-19 Thread socketpair at gmail dot com
--- Comment #1 from socketpair at gmail dot com 2010-08-19 14:17 --- Created an attachment (id=21519) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21519&action=view) C souce file 1. gcc-Os --save-temps -fomit-frame-pointer -fno-stack-protector main.c 2. gcc -DC

[Bug tree-optimization/45340] New: __builtin_expect and -Os generates stupid code

2010-08-19 Thread socketpair at gmail dot com
Severity: minor Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: socketpair at gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45340

[Bug inline-asm/43998] inline assembler: can't set clobbering for input register

2010-05-13 Thread socketpair at gmail dot com
--- Comment #11 from socketpair at gmail dot com 2010-05-14 06:31 --- Suppose this: volatile int x; asm("something"::"a" (1)) x=1; the compiler may think that "something" do not modify eax. So next assignment may use eax ( mov eax, x ). So, "it

[Bug c/44094] New: case xxx statement does not recognize const int value

2010-05-12 Thread socketpair at gmail dot com
Version: unknown Status: UNCONFIRMED Severity: minor Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: socketpair at gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44094

[Bug inline-asm/43998] inline assembler: can't set clobbering for input register

2010-05-06 Thread socketpair at gmail dot com
--- Comment #9 from socketpair at gmail dot com 2010-05-06 15:03 --- > Not if you make the output unused by not using it. I do not understand why gcc distinguish between 'specifying register as output' and 'specifying as clobbering'. I always considered, that

[Bug inline-asm/43998] inline assembler: can't set clobbering for input register

2010-05-06 Thread socketpair at gmail dot com
--- Comment #7 from socketpair at gmail dot com 2010-05-06 13:42 --- > Just make eax both input and output. it's not optimal. gcc will try to preserve new eax value. So it will not use eax register in next instructions. If eax is really need, it will save it in esi, edi or so o

[Bug inline-asm/43998] inline assembler: can't set clobbering for input register

2010-05-06 Thread socketpair at gmail dot com
--- Comment #5 from socketpair at gmail dot com 2010-05-06 11:41 --- Well, how to say that to compiler: This instruction receives input in register eax, but after executing it, eax value will be corrupted. I don't need this new value, but compiler should not think that e

[Bug inline-asm/43998] inline assembler: can't set clobbering for input register

2010-05-06 Thread socketpair at gmail dot com
--- Comment #3 from socketpair at gmail dot com 2010-05-06 11:00 --- Thanks alot, but I think it is bug in gcc inline assembler. I think I wrote correct asm() line. I know about cpuid.h I listed this instruction just as example. -- socketpair at gmail dot com changed

[Bug inline-asm/43998] New: inline assembler: can't set clobbering for input register

2010-05-05 Thread socketpair at gmail dot com
Product: gcc Version: 4.4.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: inline-asm AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: socketpair at gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43998

[Bug c/41749] non-needed instructions are not removed (not optimized)

2009-10-19 Thread socketpair at gmail dot com
--- Comment #1 from socketpair at gmail dot com 2009-10-19 07:14 --- gcc322 generates this: (gcc -Os -fomit-frame-pointer qwe.c --save-temps) main: movl$1, %eax

[Bug c/41749] New: non-needed instructions are not removed (not optimized)

2009-10-19 Thread socketpair at gmail dot com
: unassigned at gcc dot gnu dot org ReportedBy: socketpair at gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41749

[Bug middle-end/38616] [4.3 only] Wrong code when -O3 or -O2 -fstack-protector used

2008-12-24 Thread socketpair at gmail dot com
--- Comment #6 from socketpair at gmail dot com 2008-12-24 15:28 --- > -fno-fstack-protector is a work around. Ubuntu must enable stack protector by default. I don't understand. Ubuntu enabled stack protector by default now. Is this error? Should i report bug to Ubuntu?

[Bug middle-end/38616] [4.3 only] Wrong code when -O3 or -O2 -fstack-protector used

2008-12-24 Thread socketpair at gmail dot com
--- Comment #5 from socketpair at gmail dot com 2008-12-24 15:21 --- -fno-stack-protector really helps. i don't understand why "rep stosl" appear in the middle of string initialization.. gdb said that "rep stosl" is a cause of zero byte after first 8 symbols

[Bug c/38616] Wrong code when -O3 or -O2 used

2008-12-24 Thread socketpair at gmail dot com
--- Comment #3 from socketpair at gmail dot com 2008-12-24 13:38 --- (From update of attachment 16979) (i'm not intentionally send assembler output for version where buf[1024] replaced with buf[1023]). -- socketpair at gmail dot com changed: What|Re

[Bug c/38616] Wrong code when -O3 or -O2 used

2008-12-24 Thread socketpair at gmail dot com
--- Comment #2 from socketpair at gmail dot com 2008-12-24 13:33 --- (From update of attachment 16979) .file "zzz2.c" .text .p2align 4,,15 .globl main .type main, @function main: leal4(%esp), %ecx andl$-16, %esp

[Bug c/38616] Wrong code when -O3 or -O2 used

2008-12-24 Thread socketpair at gmail dot com
--- Comment #1 from socketpair at gmail dot com 2008-12-24 13:27 --- Created an attachment (id=16979) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16979&action=view) assembler output of wrong generated code this assembler output generates only 8 characters in output ins

[Bug c/38616] New: Wrong code when -O3 or -O2 used

2008-12-24 Thread socketpair at gmail dot com
or -O2 used Product: gcc Version: 4.3.2 Status: UNCONFIRMED Severity: critical Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: socketpair at gmail dot com GCC build triplet: i386 GCC host triplet: i386 GCC target triplet: i386 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38616