[Bug c/78408] Aggressive optimization of zeroing results in incorrect behavior

2016-11-17 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78408

Markus Trippelsdorf  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-11-17
 CC||trippels at gcc dot gnu.org
  Known to work||7.0
 Ever confirmed|0   |1
  Known to fail||5.4.0, 6.2.1

--- Comment #4 from Markus Trippelsdorf  ---
Confirmed. Trunk is fine.

--- good2016-11-17 21:45:22.671247332 +0100
+++ bad 2016-11-17 21:45:18.851324283 +0100
@@ -58,11 +58,6 @@
callwrite
testq   %rax, %rax
jle .L10
-   leaq-65536(%rbp), %rax
-   movl$65520, %edx
-   movl$0, %esi
-   movq%rax, %rdi
-   callmemset
leaq-131056(%rbp), %rax
leaq-65536(%rbp), %rcx
movl$65520, %edx
@@ -86,5 +81,5 @@
.cfi_endproc
 .LFE0:
.size   main, .-main
-   .ident  "GCC: (GNU) 7.0.0 20161117 (experimental)"
+   .ident  "GCC: (GNU) 6.2.1 20161017"
.section.note.GNU-stack,"",@progbits

[Bug c/78408] Aggressive optimization of zeroing results in incorrect behavior

2016-11-17 Thread npmccallum at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78408

--- Comment #3 from Nathaniel McCallum  ---
Created attachment 40077
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40077=edit
output assembly from the test case

This assembly was produced with: gcc -S test.c.

[Bug c/78408] Aggressive optimization of zeroing results in incorrect behavior

2016-11-17 Thread npmccallum at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78408

--- Comment #2 from Nathaniel McCallum  ---
Created attachment 40076
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40076=edit
simple test case

Compile with: gcc -o test test.c

This is a simple echo server. It *should* echo whatever the client types. 
However, if you type "foo" the first time and then type ctrl-d the second time,
the second reply is the same as the first reply. This is because the buffer was
not properly zeroed.

[Bug c/78408] Aggressive optimization of zeroing results in incorrect behavior

2016-11-17 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78408

--- Comment #1 from Marc Glisse  ---
Do you think you could produce a smaller, stand-alone testcase that reproduces
the issue? Or at least attach the preprocessed sources to the report?