* [Bug c/38616] Wrong code when -O3 or -O2 used
2008-12-24 11:53 [Bug c/38616] New: Wrong code when -O3 or -O2 used socketpair at gmail dot com
@ 2008-12-24 13:28 ` socketpair at gmail dot com
2008-12-24 13:35 ` socketpair at gmail dot com
` (11 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: socketpair at gmail dot com @ 2008-12-24 13:28 UTC (permalink / raw)
To: gcc-bugs
------- 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 instead of full
constant string.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38616
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c/38616] Wrong code when -O3 or -O2 used
2008-12-24 11:53 [Bug c/38616] New: Wrong code when -O3 or -O2 used socketpair at gmail dot com
2008-12-24 13:28 ` [Bug c/38616] " socketpair at gmail dot com
@ 2008-12-24 13:35 ` socketpair at gmail dot com
2008-12-24 13:41 ` socketpair at gmail dot com
` (10 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: socketpair at gmail dot com @ 2008-12-24 13:35 UTC (permalink / raw)
To: gcc-bugs
------- 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:
leal 4(%esp), %ecx
andl $-16, %esp
pushl -4(%ecx)
pushl %ebp
movl %esp, %ebp
subl $1064, %esp
movl %gs:20, %eax
movl %eax, -12(%ebp)
xorl %eax, %eax
movl %ecx, -8(%ebp)
movl $255, %ecx
movl %edi, -4(%ebp)
leal -1032(%ebp), %edi
movl $875770417, -1036(%ebp)
movl $1650536505, -1028(%ebp)
movl $1717920867, -1024(%ebp)
rep stosl
leal -1036(%ebp), %eax
movl $943142453, -1032(%ebp)
movl $1785292903, -1020(%ebp)
movl $1852664939, -1016(%ebp)
movw $111, -1012(%ebp)
movl %eax, (%esp)
call puts
xorl %eax, %eax
movl -12(%ebp), %edx
xorl %gs:20, %edx
jne .L6
movl -8(%ebp), %ecx
movl -4(%ebp), %edi
movl %ebp, %esp
popl %ebp
leal -4(%ecx), %esp
ret
.L6:
call __stack_chk_fail
.size main, .-main
.ident "GCC: (Ubuntu 4.3.2-1ubuntu11) 4.3.2"
.section .note.GNU-stack,"",@progbits
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38616
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c/38616] Wrong code when -O3 or -O2 used
2008-12-24 11:53 [Bug c/38616] New: Wrong code when -O3 or -O2 used socketpair at gmail dot com
2008-12-24 13:28 ` [Bug c/38616] " socketpair at gmail dot com
2008-12-24 13:35 ` socketpair at gmail dot com
@ 2008-12-24 13:41 ` socketpair at gmail dot com
2008-12-24 13:59 ` [Bug middle-end/38616] [4.3 only] Wrong code when -O3 or -O2 -fstack-protector used pinskia at gcc dot gnu dot org
` (9 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: socketpair at gmail dot com @ 2008-12-24 13:41 UTC (permalink / raw)
To: gcc-bugs
------- 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 |Removed |Added
----------------------------------------------------------------------------
Attachment #16979|assembler output of wrong |assembler output of wrong
description|generated code |generated code
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38616
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/38616] [4.3 only] Wrong code when -O3 or -O2 -fstack-protector used
2008-12-24 11:53 [Bug c/38616] New: Wrong code when -O3 or -O2 used socketpair at gmail dot com
` (2 preceding siblings ...)
2008-12-24 13:41 ` socketpair at gmail dot com
@ 2008-12-24 13:59 ` pinskia at gcc dot gnu dot org
2008-12-24 15:23 ` socketpair at gmail dot com
` (8 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-12-24 13:59 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from pinskia at gcc dot gnu dot org 2008-12-24 13:57 -------
-fno-fstack-protector is a work around. Ubuntu must enable stack protector by
default.
Note it works on the trunk but fails on an older 4.3.3:
gcc version 4.3.3 20081218 (prerelease) [gcc-4_3-branch revision 142804] (GCC)
I don't have 4.2 to test.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|critical |normal
Component|c |middle-end
Known to fail| |4.3.3
Known to work| |4.4.0
Summary|Wrong code when -O3 or -O2 |[4.3 only] Wrong code when -
|used |O3 or -O2 -fstack-protector
| |used
Target Milestone|--- |4.3.3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38616
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/38616] [4.3 only] Wrong code when -O3 or -O2 -fstack-protector used
2008-12-24 11:53 [Bug c/38616] New: Wrong code when -O3 or -O2 used socketpair at gmail dot com
` (3 preceding siblings ...)
2008-12-24 13:59 ` [Bug middle-end/38616] [4.3 only] Wrong code when -O3 or -O2 -fstack-protector used pinskia at gcc dot gnu dot org
@ 2008-12-24 15:23 ` socketpair at gmail dot com
2008-12-24 15:29 ` socketpair at gmail dot com
` (7 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: socketpair at gmail dot com @ 2008-12-24 15:23 UTC (permalink / raw)
To: gcc-bugs
------- 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.
also, if this bug does not appear in 4.4.0, i want to see decription of
corrected bug (maybe dup of mine)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38616
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/38616] [4.3 only] Wrong code when -O3 or -O2 -fstack-protector used
2008-12-24 11:53 [Bug c/38616] New: Wrong code when -O3 or -O2 used socketpair at gmail dot com
` (4 preceding siblings ...)
2008-12-24 15:23 ` socketpair at gmail dot com
@ 2008-12-24 15:29 ` socketpair at gmail dot com
2008-12-29 20:39 ` [Bug middle-end/38616] [4.3 Regression] " rguenth at gcc dot gnu dot org
` (6 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: socketpair at gmail dot com @ 2008-12-24 15:29 UTC (permalink / raw)
To: gcc-bugs
------- 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?
It stack protector experimental feature?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38616
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/38616] [4.3 Regression] Wrong code when -O3 or -O2 -fstack-protector used
2008-12-24 11:53 [Bug c/38616] New: Wrong code when -O3 or -O2 used socketpair at gmail dot com
` (5 preceding siblings ...)
2008-12-24 15:29 ` socketpair at gmail dot com
@ 2008-12-29 20:39 ` rguenth at gcc dot gnu dot org
2009-01-11 17:29 ` doko at gcc dot gnu dot org
` (5 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-12-29 20:39 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from rguenth at gcc dot gnu dot org 2008-12-29 20:38 -------
Confirmed. Probably fixed on the trunk by
2008-05-04 Uros Bizjak <ubizjak@gmail.com>
* config/i386/i386.md (*strmovsi_1): Simplify asm alternatives.
(*strmovsi_rex_1): Ditto.
(*strsetsi_1): Ditto.
(*strsetsi_rex_1): Ditto.
(add<mode>cc): Macroize expander from addqicc, addhicc, addsicc and
adddicc expanders using SWI mode iterator.
?
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rguenth at gcc dot gnu dot
| |org, ubizjak at gmail dot
| |com
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
GCC build triplet|i386 |
GCC host triplet|i386 |
GCC target triplet|i386 |i?86
Known to fail|4.3.3 |4.3.0 4.3.3
Known to work|4.4.0 |4.2.4 4.4.0
Priority|P3 |P2
Last reconfirmed|0000-00-00 00:00:00 |2008-12-29 20:38:21
date| |
Summary|[4.3 only] Wrong code when -|[4.3 Regression] Wrong code
|O3 or -O2 -fstack-protector |when -O3 or -O2 -fstack-
|used |protector used
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38616
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/38616] [4.3 Regression] Wrong code when -O3 or -O2 -fstack-protector used
2008-12-24 11:53 [Bug c/38616] New: Wrong code when -O3 or -O2 used socketpair at gmail dot com
` (6 preceding siblings ...)
2008-12-29 20:39 ` [Bug middle-end/38616] [4.3 Regression] " rguenth at gcc dot gnu dot org
@ 2009-01-11 17:29 ` doko at gcc dot gnu dot org
2009-01-11 17:38 ` doko at gcc dot gnu dot org
` (4 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: doko at gcc dot gnu dot org @ 2009-01-11 17:29 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from doko at gcc dot gnu dot org 2009-01-11 17:29 -------
Subject: Bug 38616
Author: doko
Date: Sun Jan 11 17:29:23 2009
New Revision: 143276
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=143276
Log:
gcc/
2009-01-11 Matthias Klose <doko@ubuntu.com>
PR middle-end/38616, backport from mainline:
2008-05-04 Uros Bizjak <ubizjak@gmail.com>
* config/i386/i386.md (*strmovsi_1): Simplify asm alternatives.
(*strmovsi_rex_1): Ditto.
(*strsetsi_1): Ditto.
(*strsetsi_rex_1): Ditto.
(add<mode>cc): Macroize expander from addqicc, addhicc, addsicc and
adddicc expanders using SWI mode iterator.
gcc/testsuite/
2009-01-11 Matthias Klose <doko@ubuntu.com>
PR middle-end/38616
* gcc.dg/pr38616.c: New test.
Added:
branches/gcc-4_3-branch/gcc/testsuite/gcc.dg/pr38616.c
Modified:
branches/gcc-4_3-branch/gcc/ChangeLog
branches/gcc-4_3-branch/gcc/config/i386/i386.md
branches/gcc-4_3-branch/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38616
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/38616] [4.3 Regression] Wrong code when -O3 or -O2 -fstack-protector used
2008-12-24 11:53 [Bug c/38616] New: Wrong code when -O3 or -O2 used socketpair at gmail dot com
` (7 preceding siblings ...)
2009-01-11 17:29 ` doko at gcc dot gnu dot org
@ 2009-01-11 17:38 ` doko at gcc dot gnu dot org
2009-01-14 19:18 ` danglin at gcc dot gnu dot org
` (3 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: doko at gcc dot gnu dot org @ 2009-01-11 17:38 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from doko at gcc dot gnu dot org 2009-01-11 17:38 -------
Subject: Bug 38616
Author: doko
Date: Sun Jan 11 17:38:22 2009
New Revision: 143277
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=143277
Log:
2009-01-11 Matthias Klose <doko@ubuntu.com>
PR middle-end/38616
* gcc.dg/pr38616.c: New test.
Added:
trunk/gcc/testsuite/gcc.dg/pr38616.c
Modified:
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38616
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/38616] [4.3 Regression] Wrong code when -O3 or -O2 -fstack-protector used
2008-12-24 11:53 [Bug c/38616] New: Wrong code when -O3 or -O2 used socketpair at gmail dot com
` (8 preceding siblings ...)
2009-01-11 17:38 ` doko at gcc dot gnu dot org
@ 2009-01-14 19:18 ` danglin at gcc dot gnu dot org
2009-01-14 19:24 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: danglin at gcc dot gnu dot org @ 2009-01-14 19:18 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from danglin at gcc dot gnu dot org 2009-01-14 19:18 -------
Test fails on hppa64-hp-hpux11.11:
Executing on host: /mnt/gnu/gcc/objdir/gcc/xgcc -B/mnt/gnu/gcc/objdir/gcc/
/mnt/
gnu/gcc/gcc/gcc/testsuite/gcc.dg/pr38616.c -O2 -fstack-protector
-fno-show-col
umn -lm -o ./pr38616.exe (timeout = 300)
/mnt/gnu/gcc/gcc/gcc/testsuite/gcc.dg/pr38616.c:1: warning: -fstack-protector
no
t supported for this target
ld: Can't find library for -lssp_nonshared
Fatal error.
collect2: ld returned 1 exit status
compiler exited with status 1
output is:
/mnt/gnu/gcc/gcc/gcc/testsuite/gcc.dg/pr38616.c:1: warning: -fstack-protector
no
t supported for this target
ld: Can't find library for -lssp_nonshared
Fatal error.
collect2: ld returned 1 exit status
--
danglin at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |danglin at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38616
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/38616] [4.3 Regression] Wrong code when -O3 or -O2 -fstack-protector used
2008-12-24 11:53 [Bug c/38616] New: Wrong code when -O3 or -O2 used socketpair at gmail dot com
` (9 preceding siblings ...)
2009-01-14 19:18 ` danglin at gcc dot gnu dot org
@ 2009-01-14 19:24 ` pinskia at gcc dot gnu dot org
2009-01-18 17:08 ` hjl dot tools at gmail dot com
2009-01-18 22:06 ` hjl dot tools at gmail dot com
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-01-14 19:24 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from pinskia at gcc dot gnu dot org 2009-01-14 19:24 -------
>/mnt/gnu/gcc/gcc/gcc/testsuite/gcc.dg/pr38616.c:1: warning: -fstack-protector
That has already been fixed:
http://gcc.gnu.org/ml/gcc-cvs/2009-01/msg00372.html
Fixed so closing.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38616
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/38616] [4.3 Regression] Wrong code when -O3 or -O2 -fstack-protector used
2008-12-24 11:53 [Bug c/38616] New: Wrong code when -O3 or -O2 used socketpair at gmail dot com
` (10 preceding siblings ...)
2009-01-14 19:24 ` pinskia at gcc dot gnu dot org
@ 2009-01-18 17:08 ` hjl dot tools at gmail dot com
2009-01-18 22:06 ` hjl dot tools at gmail dot com
12 siblings, 0 replies; 14+ messages in thread
From: hjl dot tools at gmail dot com @ 2009-01-18 17:08 UTC (permalink / raw)
To: gcc-bugs
------- Comment #12 from hjl dot tools at gmail dot com 2009-01-18 17:07 -------
It isn't fixed in 4.3.3. See PR 38902. I will search which
revision fixes it on trunk.
--
hjl dot tools at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
BugsThisDependsOn| |38902
Status|RESOLVED |REOPENED
Resolution|FIXED |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38616
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug middle-end/38616] [4.3 Regression] Wrong code when -O3 or -O2 -fstack-protector used
2008-12-24 11:53 [Bug c/38616] New: Wrong code when -O3 or -O2 used socketpair at gmail dot com
` (11 preceding siblings ...)
2009-01-18 17:08 ` hjl dot tools at gmail dot com
@ 2009-01-18 22:06 ` hjl dot tools at gmail dot com
12 siblings, 0 replies; 14+ messages in thread
From: hjl dot tools at gmail dot com @ 2009-01-18 22:06 UTC (permalink / raw)
To: gcc-bugs
------- Comment #13 from hjl dot tools at gmail dot com 2009-01-18 22:06 -------
PR 38902 has a much better testcase.
*** This bug has been marked as a duplicate of 38902 ***
--
hjl dot tools at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
BugsThisDependsOn|38902 |
Status|REOPENED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38616
^ permalink raw reply [flat|nested] 14+ messages in thread