public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/43560] New: possible wrong code bug
@ 2010-03-28 19:20 regehr at cs dot utah dot edu
2010-03-28 20:12 ` [Bug c/43560] " sezeroz at gmail dot com
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: regehr at cs dot utah dot edu @ 2010-03-28 19:20 UTC (permalink / raw)
To: gcc-bugs
I don't believe the program below should crash when run.
Valgrind says the store at line 20 is at fault, which is strange since it looks
like the "if" branch should execute twice and the "else" branch 0 times.
regehr@john-home:~$ current-gcc -O small.c -o small
regehr@john-home:~$ ./small
Segmentation fault
regehr@john-home:~$ cat small.c
#include <stdio.h>
int g_6[1][2] = {{1,1}};
int g_34 = 0;
int *const g_82 = &g_6[0][1];
int *g_85[2][1] = {{&g_34}, {&g_34}};
void func_4 (void)
{
int i;
for (i = 0; i <= 1; i++) {
if (g_6[0][1]) {
*g_82 = 1;
} else {
int **l_109 = &g_85[1][0];
if (&g_82 != l_109) {
} else {
*l_109 = &g_6[0][1];
}
*g_82 = 1;
}
}
}
int main (void)
{
func_4();
return 0;
}
regehr@john-home:~$ current-gcc -v
Using built-in specs.
COLLECT_GCC=current-gcc
COLLECT_LTO_WRAPPER=/home/regehr/z/compiler-install/gcc-r157783-install/libexec/gcc/i686-pc-linux-gnu/4.5.0/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ../configure --with-libelf=/usr/local --enable-lto
--prefix=/home/regehr/z/compiler-install/gcc-r157783-install
--program-prefix=r157783- --enable-languages=c,c++
Thread model: posix
gcc version 4.5.0 20100328 (experimental) (GCC)
--
Summary: possible wrong code bug
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: regehr at cs dot utah dot edu
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43560
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c/43560] possible wrong code bug
2010-03-28 19:20 [Bug c/43560] New: possible wrong code bug regehr at cs dot utah dot edu
@ 2010-03-28 20:12 ` sezeroz at gmail dot com
2010-03-29 2:49 ` hjl dot tools at gmail dot com
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: sezeroz at gmail dot com @ 2010-03-28 20:12 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from sezeroz at gmail dot com 2010-03-28 20:12 -------
Happens on x86_64-pc-linux-gnu, too. Segfaults with gcc-4.3.0 and 4.3.2 (as
shipped by fedora), but runs fine with 3.3.6, 3.4.6 and my custom 4.4.4.
--
sezeroz at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |sezeroz at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43560
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c/43560] possible wrong code bug
2010-03-28 19:20 [Bug c/43560] New: possible wrong code bug regehr at cs dot utah dot edu
2010-03-28 20:12 ` [Bug c/43560] " sezeroz at gmail dot com
@ 2010-03-29 2:49 ` hjl dot tools at gmail dot com
2010-03-29 2:51 ` [Bug c/43560] [4.5 Regession] " hjl dot tools at gmail dot com
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-03-29 2:49 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from hjl dot tools at gmail dot com 2010-03-29 02:49 -------
It is caused by revision 147083:
http://gcc.gnu.org/ml/gcc-cvs/2009-05/msg00057.html
--
hjl dot tools at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rguenth at gcc dot gnu dot
| |org
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2010-03-29 02:49:04
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43560
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c/43560] [4.5 Regession] possible wrong code bug
2010-03-28 19:20 [Bug c/43560] New: possible wrong code bug regehr at cs dot utah dot edu
2010-03-28 20:12 ` [Bug c/43560] " sezeroz at gmail dot com
2010-03-29 2:49 ` hjl dot tools at gmail dot com
@ 2010-03-29 2:51 ` hjl dot tools at gmail dot com
2010-04-08 11:31 ` [Bug tree-optimization/43560] [4.3/4.4 Regression] " jakub at gcc dot gnu dot org
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-03-29 2:51 UTC (permalink / raw)
To: gcc-bugs
--
hjl dot tools at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to fail| |4.5.0
Known to work| |4.4.3
Summary|possible wrong code bug |[4.5 Regession] possible
| |wrong code bug
Target Milestone|--- |4.5.0
Version|unknown |4.5.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43560
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/43560] [4.3/4.4 Regression] possible wrong code bug
2010-03-28 19:20 [Bug c/43560] New: possible wrong code bug regehr at cs dot utah dot edu
` (2 preceding siblings ...)
2010-03-29 2:51 ` [Bug c/43560] [4.5 Regession] " hjl dot tools at gmail dot com
@ 2010-04-08 11:31 ` jakub at gcc dot gnu dot org
2010-04-08 11:35 ` [Bug tree-optimization/43560] [4.3 " jakub at gcc dot gnu dot org
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-04-08 11:31 UTC (permalink / raw)
To: gcc-bugs
------- Comment #12 from jakub at gcc dot gnu dot org 2010-04-08 11:31 -------
Subject: Bug 43560
Author: jakub
Date: Thu Apr 8 11:31:00 2010
New Revision: 158119
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=158119
Log:
Backport from mainline:
2010-03-29 Richard Guenther <rguenther@suse.de>
PR tree-optimization/43560
* tree-ssa-loop-im.c (ref_always_accessed_p): Add store_p
parameter.
(can_sm_ref_p): Treat stores to readonly locations as
trapping.
* gcc.dg/torture/pr43560.c: New testcase.
Added:
branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/torture/pr43560.c
Modified:
branches/gcc-4_4-branch/gcc/ChangeLog
branches/gcc-4_4-branch/gcc/testsuite/ChangeLog
branches/gcc-4_4-branch/gcc/tree-ssa-loop-im.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43560
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/43560] [4.3 Regression] possible wrong code bug
2010-03-28 19:20 [Bug c/43560] New: possible wrong code bug regehr at cs dot utah dot edu
` (3 preceding siblings ...)
2010-04-08 11:31 ` [Bug tree-optimization/43560] [4.3/4.4 Regression] " jakub at gcc dot gnu dot org
@ 2010-04-08 11:35 ` jakub at gcc dot gnu dot org
2010-04-09 18:24 ` jakub at gcc dot gnu dot org
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-04-08 11:35 UTC (permalink / raw)
To: gcc-bugs
------- Comment #13 from jakub at gcc dot gnu dot org 2010-04-08 11:35 -------
Fixed also for 4.4.
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to work|3.4.6 4.5.0 |3.4.6 4.5.0 4.4.4
Summary|[4.3/4.4 Regression] |[4.3 Regression] possible
|possible wrong code bug |wrong code bug
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43560
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/43560] [4.3 Regression] possible wrong code bug
2010-03-28 19:20 [Bug c/43560] New: possible wrong code bug regehr at cs dot utah dot edu
` (4 preceding siblings ...)
2010-04-08 11:35 ` [Bug tree-optimization/43560] [4.3 " jakub at gcc dot gnu dot org
@ 2010-04-09 18:24 ` jakub at gcc dot gnu dot org
2010-04-11 18:08 ` rguenther at suse dot de
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-04-09 18:24 UTC (permalink / raw)
To: gcc-bugs
------- Comment #14 from jakub at gcc dot gnu dot org 2010-04-09 18:24 -------
Testcase distilled from OO.o that has been also fixed by this bugfix (failed at
-Os). Do we want it for the testsuite too?
struct S
{
int a, b;
char c[10];
};
__attribute__((noinline)) void
test (struct S *x)
{
while (x->b > 1 && x->c[x->b - 1] == '/')
{
x->b--;
x->c[x->b] = '\0';
}
}
const struct S s = { 0, 0, "" };
int
main ()
{
struct S *p;
asm ("" : "=r" (p) : "0" (&s));
test (p);
return 0;
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43560
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/43560] [4.3 Regression] possible wrong code bug
2010-03-28 19:20 [Bug c/43560] New: possible wrong code bug regehr at cs dot utah dot edu
` (5 preceding siblings ...)
2010-04-09 18:24 ` jakub at gcc dot gnu dot org
@ 2010-04-11 18:08 ` rguenther at suse dot de
2010-04-12 10:19 ` jakub at gcc dot gnu dot org
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenther at suse dot de @ 2010-04-11 18:08 UTC (permalink / raw)
To: gcc-bugs
------- Comment #15 from rguenther at suse dot de 2010-04-11 18:08 -------
Subject: Re: [4.3 Regression] possible wrong
code bug
On Fri, 9 Apr 2010, jakub at gcc dot gnu dot org wrote:
> ------- Comment #14 from jakub at gcc dot gnu dot org 2010-04-09 18:24 -------
> Testcase distilled from OO.o that has been also fixed by this bugfix (failed at
> -Os). Do we want it for the testsuite too?
>
> struct S
> {
> int a, b;
> char c[10];
> };
>
> __attribute__((noinline)) void
> test (struct S *x)
> {
> while (x->b > 1 && x->c[x->b - 1] == '/')
> {
> x->b--;
> x->c[x->b] = '\0';
> }
> }
>
> const struct S s = { 0, 0, "" };
>
> int
> main ()
> {
> struct S *p;
> asm ("" : "=r" (p) : "0" (&s));
> test (p);
> return 0;
> }
Yes please.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43560
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/43560] [4.3 Regression] possible wrong code bug
2010-03-28 19:20 [Bug c/43560] New: possible wrong code bug regehr at cs dot utah dot edu
` (6 preceding siblings ...)
2010-04-11 18:08 ` rguenther at suse dot de
@ 2010-04-12 10:19 ` jakub at gcc dot gnu dot org
2010-04-12 10:22 ` jakub at gcc dot gnu dot org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-04-12 10:19 UTC (permalink / raw)
To: gcc-bugs
------- Comment #16 from jakub at gcc dot gnu dot org 2010-04-12 10:18 -------
Subject: Bug 43560
Author: jakub
Date: Mon Apr 12 10:18:39 2010
New Revision: 158220
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=158220
Log:
PR tree-optimization/43560
* gcc.c-torture/execute/pr43560.c: New test.
Added:
trunk/gcc/testsuite/gcc.c-torture/execute/pr43560.c
Modified:
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43560
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/43560] [4.3 Regression] possible wrong code bug
2010-03-28 19:20 [Bug c/43560] New: possible wrong code bug regehr at cs dot utah dot edu
` (7 preceding siblings ...)
2010-04-12 10:19 ` jakub at gcc dot gnu dot org
@ 2010-04-12 10:22 ` jakub at gcc dot gnu dot org
2010-04-12 10:25 ` jakub at gcc dot gnu dot org
2010-05-22 18:36 ` rguenth at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-04-12 10:22 UTC (permalink / raw)
To: gcc-bugs
------- Comment #17 from jakub at gcc dot gnu dot org 2010-04-12 10:22 -------
Subject: Bug 43560
Author: jakub
Date: Mon Apr 12 10:22:21 2010
New Revision: 158221
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=158221
Log:
PR tree-optimization/43560
* gcc.c-torture/execute/pr43560.c: New test.
Added:
branches/gcc-4_5-branch/gcc/testsuite/gcc.c-torture/execute/pr43560.c
Modified:
branches/gcc-4_5-branch/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43560
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/43560] [4.3 Regression] possible wrong code bug
2010-03-28 19:20 [Bug c/43560] New: possible wrong code bug regehr at cs dot utah dot edu
` (8 preceding siblings ...)
2010-04-12 10:22 ` jakub at gcc dot gnu dot org
@ 2010-04-12 10:25 ` jakub at gcc dot gnu dot org
2010-05-22 18:36 ` rguenth at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-04-12 10:25 UTC (permalink / raw)
To: gcc-bugs
------- Comment #18 from jakub at gcc dot gnu dot org 2010-04-12 10:25 -------
Subject: Bug 43560
Author: jakub
Date: Mon Apr 12 10:25:11 2010
New Revision: 158222
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=158222
Log:
PR tree-optimization/43560
* gcc.c-torture/execute/pr43560.c: New test.
Added:
branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/execute/pr43560.c
Modified:
branches/gcc-4_4-branch/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43560
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/43560] [4.3 Regression] possible wrong code bug
2010-03-28 19:20 [Bug c/43560] New: possible wrong code bug regehr at cs dot utah dot edu
` (9 preceding siblings ...)
2010-04-12 10:25 ` jakub at gcc dot gnu dot org
@ 2010-05-22 18:36 ` rguenth at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-05-22 18:36 UTC (permalink / raw)
To: gcc-bugs
------- Comment #19 from rguenth at gcc dot gnu dot org 2010-05-22 18:13 -------
GCC 4.3.5 is being released, adjusting target milestone.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.3.5 |4.3.6
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43560
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2010-05-22 18:36 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-28 19:20 [Bug c/43560] New: possible wrong code bug regehr at cs dot utah dot edu
2010-03-28 20:12 ` [Bug c/43560] " sezeroz at gmail dot com
2010-03-29 2:49 ` hjl dot tools at gmail dot com
2010-03-29 2:51 ` [Bug c/43560] [4.5 Regession] " hjl dot tools at gmail dot com
2010-04-08 11:31 ` [Bug tree-optimization/43560] [4.3/4.4 Regression] " jakub at gcc dot gnu dot org
2010-04-08 11:35 ` [Bug tree-optimization/43560] [4.3 " jakub at gcc dot gnu dot org
2010-04-09 18:24 ` jakub at gcc dot gnu dot org
2010-04-11 18:08 ` rguenther at suse dot de
2010-04-12 10:19 ` jakub at gcc dot gnu dot org
2010-04-12 10:22 ` jakub at gcc dot gnu dot org
2010-04-12 10:25 ` jakub at gcc dot gnu dot org
2010-05-22 18:36 ` rguenth at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).