* [Bug tree-optimization/60115] wrong code at -O3 on x86_64-linux-gnu
[not found] <bug-60115-4@http.gcc.gnu.org/bugzilla/>
@ 2014-02-08 7:04 ` su at cs dot ucdavis.edu
2014-02-08 9:40 ` [Bug tree-optimization/60115] [4.9 Regression] " jakub at gcc dot gnu.org
` (13 subsequent siblings)
14 siblings, 0 replies; 15+ messages in thread
From: su at cs dot ucdavis.edu @ 2014-02-08 7:04 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60115
--- Comment #1 from Zhendong Su <su at cs dot ucdavis.edu> ---
The reported testcase seems to reveal an independent issue: GCC does warn the
out-of-bound array access at -Os and above, but not at -O0 and -O1, while clang
warns at all optimization levels.
$ gcc-trunk -Warray-bounds -O0 small.c
$ gcc-trunk -Warray-bounds -O1 small.c
$
$ gcc-trunk -Warray-bounds -Os small.c
small.c: In function ‘main’:
small.c:8:10: warning: array subscript is above array bounds [-Warray-bounds]
if (b[613])
^
$
$ clang-trunk -Warray-bounds -O0 small.c
small.c:8:9: warning: array index 613 is past the end of the array (which
contains 1 element) [-Warray-bounds]
if (b[613])
^ ~~~
small.c:1:1: note: array 'b' declared here
int a, b[1];
^
1 warning generated.
$
>From gcc-bugs-return-443020-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Feb 08 07:23:16 2014
Return-Path: <gcc-bugs-return-443020-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 32539 invoked by alias); 8 Feb 2014 07:23:15 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 32513 invoked by uid 48); 8 Feb 2014 07:23:09 -0000
From: "glisse at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/60113] Internal compiler error
Date: Sat, 08 Feb 2014 07:23:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.6.3
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: glisse at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-60113-4-56CshDmUDh@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-60113-4@http.gcc.gnu.org/bugzilla/>
References: <bug-60113-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-02/txt/msg00777.txt.bz2
Content-length: 446
http://gcc.gnu.org/bugzilla/show_bug.cgi?id`113
--- Comment #1 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to lmat from comment #0)
> Attached is the output from command line along with the
> preprocessed code that I was trying to compile.
Looks like you forgot to attach it?
> Please let me know if I can provide any more information!
http://gcc.gnu.org/bugs/
We also want to know the command line, the target system, etc.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug tree-optimization/60115] [4.9 Regression] wrong code at -O3 on x86_64-linux-gnu
[not found] <bug-60115-4@http.gcc.gnu.org/bugzilla/>
2014-02-08 7:04 ` [Bug tree-optimization/60115] wrong code at -O3 on x86_64-linux-gnu su at cs dot ucdavis.edu
@ 2014-02-08 9:40 ` jakub at gcc dot gnu.org
2014-02-08 16:14 ` su at cs dot ucdavis.edu
` (12 subsequent siblings)
14 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-02-08 9:40 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60115
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-02-08
CC| |jakub at gcc dot gnu.org
Target Milestone|--- |4.9.0
Summary|wrong code at -O3 on |[4.9 Regression] wrong code
|x86_64-linux-gnu |at -O3 on x86_64-linux-gnu
Ever confirmed|0 |1
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I have to use something like:
int a, b[1];
int
main ()
{
lbl:
for (; a; a--)
if (b[10000000])
goto lbl;
return 0;
}
to actually successfully reproduce it. Anyway, started with r204458.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug tree-optimization/60115] [4.9 Regression] wrong code at -O3 on x86_64-linux-gnu
[not found] <bug-60115-4@http.gcc.gnu.org/bugzilla/>
2014-02-08 7:04 ` [Bug tree-optimization/60115] wrong code at -O3 on x86_64-linux-gnu su at cs dot ucdavis.edu
2014-02-08 9:40 ` [Bug tree-optimization/60115] [4.9 Regression] " jakub at gcc dot gnu.org
@ 2014-02-08 16:14 ` su at cs dot ucdavis.edu
2014-02-08 23:05 ` su at cs dot ucdavis.edu
` (11 subsequent siblings)
14 siblings, 0 replies; 15+ messages in thread
From: su at cs dot ucdavis.edu @ 2014-02-08 16:14 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60115
--- Comment #4 from Zhendong Su <su at cs dot ucdavis.edu> ---
(In reply to Jakub Jelinek from comment #2)
> I have to use something like:
> int a, b[1];
>
> int
> main ()
> {
> lbl:
> for (; a; a--)
> if (b[10000000])
> goto lbl;
>
> return 0;
> }
>
> to actually successfully reproduce it. Anyway, started with r204458.
Should I report the out-out-bound array access warning issue as a separate
report? Thanks.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug tree-optimization/60115] [4.9 Regression] wrong code at -O3 on x86_64-linux-gnu
[not found] <bug-60115-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2014-02-08 16:14 ` su at cs dot ucdavis.edu
@ 2014-02-08 23:05 ` su at cs dot ucdavis.edu
2014-02-08 23:07 ` su at cs dot ucdavis.edu
` (10 subsequent siblings)
14 siblings, 0 replies; 15+ messages in thread
From: su at cs dot ucdavis.edu @ 2014-02-08 23:05 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60115
--- Comment #5 from Zhendong Su <su at cs dot ucdavis.edu> ---
(In reply to Jakub Jelinek from comment #2)
> I have to use something like:
> int a, b[1];
>
> int
> main ()
> {
> lbl:
> for (; a; a--)
> if (b[10000000])
> goto lbl;
>
> return 0;
> }
>
> to actually successfully reproduce it. Anyway, started with r204458.
It also affects the current 4.8 branch that I just built (but not the 4.8
releases).
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/su/software/local/gcc-4.8/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.8.3/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.8/configure --enable-languages=c,c++
Thread model: posix
gcc version 4.8.3 20140208 (prerelease) [gcc-4_8-branch revision 207632] (GCC)
$
$ gcc -O3 small.c; a.out
Segmentation fault (core dumped)
$
$ gcc-4.8.2 -O3 small.c; a.out
$ gcc-4.8.1 -O3 small.c; a.out
$ gcc-4.8.0 -O3 small.c; a.out
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug tree-optimization/60115] [4.9 Regression] wrong code at -O3 on x86_64-linux-gnu
[not found] <bug-60115-4@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
2014-02-08 23:05 ` su at cs dot ucdavis.edu
@ 2014-02-08 23:07 ` su at cs dot ucdavis.edu
2014-02-08 23:17 ` su at cs dot ucdavis.edu
` (9 subsequent siblings)
14 siblings, 0 replies; 15+ messages in thread
From: su at cs dot ucdavis.edu @ 2014-02-08 23:07 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60115
--- Comment #6 from Zhendong Su <su at cs dot ucdavis.edu> ---
So, it's also a 4.8 regression.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug tree-optimization/60115] [4.9 Regression] wrong code at -O3 on x86_64-linux-gnu
[not found] <bug-60115-4@http.gcc.gnu.org/bugzilla/>
` (4 preceding siblings ...)
2014-02-08 23:07 ` su at cs dot ucdavis.edu
@ 2014-02-08 23:17 ` su at cs dot ucdavis.edu
2014-02-08 23:45 ` pinskia at gcc dot gnu.org
` (8 subsequent siblings)
14 siblings, 0 replies; 15+ messages in thread
From: su at cs dot ucdavis.edu @ 2014-02-08 23:17 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60115
--- Comment #7 from Zhendong Su <su at cs dot ucdavis.edu> ---
> Should I report the out-out-bound array access warning issue as a separate
> report? Thanks.
Reported it as
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60121
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug tree-optimization/60115] [4.9 Regression] wrong code at -O3 on x86_64-linux-gnu
[not found] <bug-60115-4@http.gcc.gnu.org/bugzilla/>
` (5 preceding siblings ...)
2014-02-08 23:17 ` su at cs dot ucdavis.edu
@ 2014-02-08 23:45 ` pinskia at gcc dot gnu.org
2014-02-09 0:10 ` pinskia at gcc dot gnu.org
` (7 subsequent siblings)
14 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-02-08 23:45 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60115
--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
LIM is pulling the out of bounds load out of the loop.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug tree-optimization/60115] [4.9 Regression] wrong code at -O3 on x86_64-linux-gnu
[not found] <bug-60115-4@http.gcc.gnu.org/bugzilla/>
` (6 preceding siblings ...)
2014-02-08 23:45 ` pinskia at gcc dot gnu.org
@ 2014-02-09 0:10 ` pinskia at gcc dot gnu.org
2014-02-09 0:14 ` pinskia at gcc dot gnu.org
` (6 subsequent siblings)
14 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-02-09 0:10 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60115
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |fmartinez at gmv dot com
--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 60122 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug tree-optimization/60115] [4.9 Regression] wrong code at -O3 on x86_64-linux-gnu
[not found] <bug-60115-4@http.gcc.gnu.org/bugzilla/>
` (7 preceding siblings ...)
2014-02-09 0:10 ` pinskia at gcc dot gnu.org
@ 2014-02-09 0:14 ` pinskia at gcc dot gnu.org
2014-02-10 9:46 ` rguenth at gcc dot gnu.org
` (5 subsequent siblings)
14 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-02-09 0:14 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60115
--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 60121 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug tree-optimization/60115] [4.9 Regression] wrong code at -O3 on x86_64-linux-gnu
[not found] <bug-60115-4@http.gcc.gnu.org/bugzilla/>
` (8 preceding siblings ...)
2014-02-09 0:14 ` pinskia at gcc dot gnu.org
@ 2014-02-10 9:46 ` rguenth at gcc dot gnu.org
2014-02-10 11:05 ` [Bug tree-optimization/60115] [4.8/4.9 " rguenth at gcc dot gnu.org
` (4 subsequent siblings)
14 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-02-10 9:46 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60115
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org
--- Comment #11 from Richard Biener <rguenth at gcc dot gnu.org> ---
Mine then.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug tree-optimization/60115] [4.8/4.9 Regression] wrong code at -O3 on x86_64-linux-gnu
[not found] <bug-60115-4@http.gcc.gnu.org/bugzilla/>
` (9 preceding siblings ...)
2014-02-10 9:46 ` rguenth at gcc dot gnu.org
@ 2014-02-10 11:05 ` rguenth at gcc dot gnu.org
2014-02-10 13:51 ` [Bug tree-optimization/60115] [4.8 " rguenth at gcc dot gnu.org
` (3 subsequent siblings)
14 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-02-10 11:05 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60115
--- Comment #12 from Richard Biener <rguenth at gcc dot gnu.org> ---
The issue is that tree_could_trap_p, while handling
case ARRAY_REF:
base = TREE_OPERAND (expr, 0);
if (tree_could_trap_p (base))
return true;
if (TREE_THIS_NOTRAP (expr))
return false;
return !in_array_bounds_p (expr);
doesn't handle out-of-bound accesses via MEM_REF at all.
case MEM_REF:
if (TREE_CODE (TREE_OPERAND (expr, 0)) == ADDR_EXPR)
return false;
I have a fix.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug tree-optimization/60115] [4.8 Regression] wrong code at -O3 on x86_64-linux-gnu
[not found] <bug-60115-4@http.gcc.gnu.org/bugzilla/>
` (10 preceding siblings ...)
2014-02-10 11:05 ` [Bug tree-optimization/60115] [4.8/4.9 " rguenth at gcc dot gnu.org
@ 2014-02-10 13:51 ` rguenth at gcc dot gnu.org
2014-02-10 13:52 ` rguenth at gcc dot gnu.org
` (2 subsequent siblings)
14 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-02-10 13:51 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60115
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to work| |4.9.0
Summary|[4.8/4.9 Regression] wrong |[4.8 Regression] wrong code
|code at -O3 on |at -O3 on x86_64-linux-gnu
|x86_64-linux-gnu |
Known to fail|4.9.0 |
--- Comment #13 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed on trunk sofar.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug tree-optimization/60115] [4.8 Regression] wrong code at -O3 on x86_64-linux-gnu
[not found] <bug-60115-4@http.gcc.gnu.org/bugzilla/>
` (11 preceding siblings ...)
2014-02-10 13:51 ` [Bug tree-optimization/60115] [4.8 " rguenth at gcc dot gnu.org
@ 2014-02-10 13:52 ` rguenth at gcc dot gnu.org
2014-02-10 15:21 ` rguenth at gcc dot gnu.org
2014-02-10 15:29 ` rguenth at gcc dot gnu.org
14 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-02-10 13:52 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60115
--- Comment #14 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Mon Feb 10 13:51:23 2014
New Revision: 207656
URL: http://gcc.gnu.org/viewcvs?rev=207656&root=gcc&view=rev
Log:
2014-02-10 Richard Biener <rguenther@suse.de>
PR tree-optimization/60115
* tree-eh.c (tree_could_trap_p): Unify TARGET_MEM_REF and
MEM_REF handling. Properly verify that the accesses are not
out of the objects bound.
* gcc.dg/torture/pr60115.c: New testcase.
Added:
trunk/gcc/testsuite/gcc.dg/torture/pr60115.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-eh.c
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug tree-optimization/60115] [4.8 Regression] wrong code at -O3 on x86_64-linux-gnu
[not found] <bug-60115-4@http.gcc.gnu.org/bugzilla/>
` (12 preceding siblings ...)
2014-02-10 13:52 ` rguenth at gcc dot gnu.org
@ 2014-02-10 15:21 ` rguenth at gcc dot gnu.org
2014-02-10 15:29 ` rguenth at gcc dot gnu.org
14 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-02-10 15:21 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60115
--- Comment #15 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Mon Feb 10 15:20:30 2014
New Revision: 207659
URL: http://gcc.gnu.org/viewcvs?rev=207659&root=gcc&view=rev
Log:
2014-02-10 Richard Biener <rguenther@suse.de>
Backport from mainline
2014-01-30 Richard Biener <rguenther@suse.de>
PR tree-optimization/59903
* tree-vect-loop.c (vect_transform_loop): Guard multiple-types
check properly.
* gcc.dg/torture/pr59903.c: New testcase.
2014-02-10 Richard Biener <rguenther@suse.de>
PR tree-optimization/60115
* tree-eh.c (tree_could_trap_p): Unify TARGET_MEM_REF and
MEM_REF handling. Properly verify that the accesses are not
out of the objects bound.
* gcc.dg/torture/pr60115.c: New testcase.
Added:
branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/torture/pr59903.c
branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/torture/pr60115.c
Modified:
branches/gcc-4_8-branch/gcc/ChangeLog
branches/gcc-4_8-branch/gcc/testsuite/ChangeLog
branches/gcc-4_8-branch/gcc/tree-eh.c
branches/gcc-4_8-branch/gcc/tree-vect-loop.c
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug tree-optimization/60115] [4.8 Regression] wrong code at -O3 on x86_64-linux-gnu
[not found] <bug-60115-4@http.gcc.gnu.org/bugzilla/>
` (13 preceding siblings ...)
2014-02-10 15:21 ` rguenth at gcc dot gnu.org
@ 2014-02-10 15:29 ` rguenth at gcc dot gnu.org
14 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-02-10 15:29 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60115
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #16 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 15+ messages in thread