* [Bug target/60520] stack adjustment are not merged anymore
2014-03-13 21:26 [Bug target/60520] New: stack adjustment are not merged anymore ubizjak at gmail dot com
@ 2014-03-13 21:41 ` hjl.tools at gmail dot com
2014-03-13 22:02 ` hjl.tools at gmail dot com
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: hjl.tools at gmail dot com @ 2014-03-13 21:41 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60520
H.J. Lu <hjl.tools at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-03-13
CC| |hjl.tools at gmail dot com
Ever confirmed|0 |1
--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
It is due to
commit 283bfef29552fdda30d92acff64cf38f210a1e58
Author: hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Thu Jan 23 00:12:56 2014 +0000
* config/i386/x86-tune.def (X86_TUNE_ACCUMULATE_OUTGOING_ARGS):
Enable for generic and recent AMD targets.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206947
138bc75d-0d04-0410-961f-82ee72b054a4
Adding -maccumulate-outgoing-args restores the old behavior.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/60520] stack adjustment are not merged anymore
2014-03-13 21:26 [Bug target/60520] New: stack adjustment are not merged anymore ubizjak at gmail dot com
2014-03-13 21:41 ` [Bug target/60520] " hjl.tools at gmail dot com
@ 2014-03-13 22:02 ` hjl.tools at gmail dot com
2014-03-13 22:22 ` hjl.tools at gmail dot com
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: hjl.tools at gmail dot com @ 2014-03-13 22:02 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60520
--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
pro_and_epilogue adds an epilogue after BB 4:
(insn 12 11 15 3 (parallel [
(set (reg/f:SI 7 sp)
(plus:SI (reg/f:SI 7 sp)
(const_int 16 [0x10])))
(clobber (reg:CC 17 flags))
]) pr60520.c:7 265 {*addsi_1}
(expr_list:REG_ARGS_SIZE (const_int 0 [0])
(nil)))
;; succ: 4 [100.0%] (FALLTHRU)
;; lr out 7 [sp]
;; basic block 4, loop depth 0, count 0, freq 3898, maybe hot
;; prev block 3, next block 6, flags: (REACHABLE, RTL, MODIFIED)
;; pred: 3 [100.0%] (FALLTHRU)
;; bb 4 artificial_defs: { }
;; bb 4 artificial_uses: { u-1(7){ }}
;; lr in 7 [sp]
;; lr use 7 [sp]
;; lr def
(code_label 15 12 16 4 1 "" [0 uses])
(note 16 15 27 4 [bb 4] NOTE_INSN_BASIC_BLOCK)
(note 27 16 28 4 NOTE_INSN_EPILOGUE_BEG)
(insn/f 28 27 32 4 (parallel [
(set (reg/f:SI 7 sp)
(plus:SI (reg/f:SI 7 sp)
(const_int 12 [0xc])))
(clobber (reg:CC 17 flags))
(clobber (mem:BLK (scratch) [0 A8]))
]) pr60520.c:8 -1
(expr_list:REG_CFA_ADJUST_CFA (set (reg/f:SI 7 sp)
(plus:SI (reg/f:SI 7 sp)
(const_int 12 [0xc])))
(nil)))
;; succ: 6 [100.0%] (FALLTHRU)
;; lr out 7 [sp]
It is quite hard to optimize 2 stack adjustment cross basic blocks.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/60520] stack adjustment are not merged anymore
2014-03-13 21:26 [Bug target/60520] New: stack adjustment are not merged anymore ubizjak at gmail dot com
2014-03-13 21:41 ` [Bug target/60520] " hjl.tools at gmail dot com
2014-03-13 22:02 ` hjl.tools at gmail dot com
@ 2014-03-13 22:22 ` hjl.tools at gmail dot com
2014-03-14 5:14 ` hjl.tools at gmail dot com
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: hjl.tools at gmail dot com @ 2014-03-13 22:22 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60520
--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> ---
With -O -m32 -fno-shrink-wrap, I got
test:
.LFB0:
.cfi_startproc
subl $12, %esp
.cfi_def_cfa_offset 16
movl bar, %eax
cmpl $0, (%eax)
je .L1
subl $12, %esp
.cfi_def_cfa_offset 28
pushl %eax
.cfi_def_cfa_offset 32
call foo
addl $16, %esp
.cfi_def_cfa_offset 16
.L1:
addl $12, %esp
.cfi_def_cfa_offset 4
ret
shrink-wrap doesn't add epilogue in such a way that stack
adjustment can be easily optimized.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/60520] stack adjustment are not merged anymore
2014-03-13 21:26 [Bug target/60520] New: stack adjustment are not merged anymore ubizjak at gmail dot com
` (2 preceding siblings ...)
2014-03-13 22:22 ` hjl.tools at gmail dot com
@ 2014-03-14 5:14 ` hjl.tools at gmail dot com
2014-03-14 8:03 ` rguenth at gcc dot gnu.org
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: hjl.tools at gmail dot com @ 2014-03-14 5:14 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60520
--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> ---
This change:
diff --git a/gcc/function.c b/gcc/function.c
index a61e475..3b6718f 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -6238,6 +6238,7 @@ thread_prologue_and_epilogue_insns (void)
}
/* Now duplicate the tails. */
if (!bitmap_empty_p (&bb_tail))
+ {
FOR_EACH_BB_REVERSE_FN (bb, cfun)
{
basic_block copy_bb, tbb;
@@ -6304,6 +6305,17 @@ thread_prologue_and_epilogue_insns (void)
if (bitmap_empty_p (&bb_tail))
break;
}
+
+ /* Basic blocks may have been changed. Merge each basic block
+ with its successor if possible. */
+ FOR_EACH_BB_FN (bb, cfun)
+ if (single_succ_p (bb))
+ {
+ basic_block succ_bb = single_succ (bb);
+ if (can_merge_blocks_p (bb, succ_bb))
+ merge_blocks (bb, succ_bb);
+ }
+ }
}
fail_shrinkwrap:
seems to work.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/60520] stack adjustment are not merged anymore
2014-03-13 21:26 [Bug target/60520] New: stack adjustment are not merged anymore ubizjak at gmail dot com
` (3 preceding siblings ...)
2014-03-14 5:14 ` hjl.tools at gmail dot com
@ 2014-03-14 8:03 ` rguenth at gcc dot gnu.org
2014-03-14 8:27 ` jakub at gcc dot gnu.org
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-03-14 8:03 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60520
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to H.J. Lu from comment #4)
> This change:
>
> diff --git a/gcc/function.c b/gcc/function.c
> index a61e475..3b6718f 100644
> --- a/gcc/function.c
> +++ b/gcc/function.c
> @@ -6238,6 +6238,7 @@ thread_prologue_and_epilogue_insns (void)
> }
> /* Now duplicate the tails. */
> if (!bitmap_empty_p (&bb_tail))
> + {
> FOR_EACH_BB_REVERSE_FN (bb, cfun)
> {
> basic_block copy_bb, tbb;
> @@ -6304,6 +6305,17 @@ thread_prologue_and_epilogue_insns (void)
> if (bitmap_empty_p (&bb_tail))
> break;
> }
> +
> + /* Basic blocks may have been changed. Merge each basic block
> + with its successor if possible. */
> + FOR_EACH_BB_FN (bb, cfun)
> + if (single_succ_p (bb))
> + {
> + basic_block succ_bb = single_succ (bb);
> + if (can_merge_blocks_p (bb, succ_bb))
> + merge_blocks (bb, succ_bb);
> + }
> + }
> }
>
> fail_shrinkwrap:
>
> seems to work.
We have cfg_cleanup for this, no?
>From gcc-bugs-return-446260-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Mar 14 08:05:37 2014
Return-Path: <gcc-bugs-return-446260-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 11422 invoked by alias); 14 Mar 2014 08:05:37 -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 11379 invoked by uid 48); 14 Mar 2014 08:05:34 -0000
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ipa/60518] [4.9 Regression] ICE: in verify_loop_structure, at cfgloop.c:1647
Date: Fri, 14 Mar 2014 08:05:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: ipa
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: rguenth at gcc dot gnu.org
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.9.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status cf_reconfirmed_on assigned_to target_milestone everconfirmed
Message-ID: <bug-60518-4-G8BAUsy1TE@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-60518-4@http.gcc.gnu.org/bugzilla/>
References: <bug-60518-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-03/txt/msg01129.txt.bz2
Content-length: 631
http://gcc.gnu.org/bugzilla/show_bug.cgi?id`518
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2014-03-14
Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org
Target Milestone|--- |4.9.0
Ever confirmed|0 |1
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed, mine.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/60520] stack adjustment are not merged anymore
2014-03-13 21:26 [Bug target/60520] New: stack adjustment are not merged anymore ubizjak at gmail dot com
` (4 preceding siblings ...)
2014-03-14 8:03 ` rguenth at gcc dot gnu.org
@ 2014-03-14 8:27 ` jakub at gcc dot gnu.org
2014-03-14 8:49 ` ubizjak at gmail dot com
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-03-14 8:27 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60520
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |jakub at gcc dot gnu.org
Resolution|--- |FIXED
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Furthermore, it is already fixed since r208551.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/60520] stack adjustment are not merged anymore
2014-03-13 21:26 [Bug target/60520] New: stack adjustment are not merged anymore ubizjak at gmail dot com
` (5 preceding siblings ...)
2014-03-14 8:27 ` jakub at gcc dot gnu.org
@ 2014-03-14 8:49 ` ubizjak at gmail dot com
2014-03-14 8:59 ` ubizjak at gmail dot com
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: ubizjak at gmail dot com @ 2014-03-14 8:49 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60520
--- Comment #7 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Jakub Jelinek from comment #6)
> Furthermore, it is already fixed since r208551.
Indeed, the fix for PR57320 also fixed this one.
>From gcc-bugs-return-446266-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Mar 14 08:53:26 2014
Return-Path: <gcc-bugs-return-446266-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 11697 invoked by alias); 14 Mar 2014 08:53:26 -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 11680 invoked by uid 48); 14 Mar 2014 08:53:22 -0000
From: "david at westcontrol dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/60523] New: Warning flag for octal literals
Date: Fri, 14 Mar 2014 08:53:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c
X-Bugzilla-Version: unknown
X-Bugzilla-Keywords:
X-Bugzilla-Severity: enhancement
X-Bugzilla-Who: david at westcontrol dot com
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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter
Message-ID: <bug-60523-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-03/txt/msg01135.txt.bz2
Content-length: 1308
http://gcc.gnu.org/bugzilla/show_bug.cgi?id`523
Bug ID: 60523
Summary: Warning flag for octal literals
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: david at westcontrol dot com
It would be nice if there were a warning flag that triggered on octal literals.
Octal literals are rarely used in modern C and C++ code, but can easily be
introduced by mistake - "int x = 050;" appears at first reading to set x to 50,
but in C and C++ the leading 0 means it is interpreted as octal and therefore
sets x to 40 (decimal).
As octal literals are seldom useful, and often confusing or accidental, they
are banned by coding standards like MISRA. But as they are part of the
language defined by the C and C++ standards, and are used in some existing
code, they obviously cannot be removed. As a compromise, I would like to
propose the introduction of a warning flags "-Woctal" which would produce a
diagnostic message when a literal is interpreted as an octal number. Of
preference, this would be included in "-Wextra" (it probably should not be in
"-Wall", since octal literals are valid C and C++).
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/60520] stack adjustment are not merged anymore
2014-03-13 21:26 [Bug target/60520] New: stack adjustment are not merged anymore ubizjak at gmail dot com
` (6 preceding siblings ...)
2014-03-14 8:49 ` ubizjak at gmail dot com
@ 2014-03-14 8:59 ` ubizjak at gmail dot com
2014-03-14 15:45 ` hjl.tools at gmail dot com
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: ubizjak at gmail dot com @ 2014-03-14 8:59 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60520
--- Comment #8 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Uroš Bizjak from comment #7)
> (In reply to Jakub Jelinek from comment #6)
> > Furthermore, it is already fixed since r208551.
>
> Indeed, the fix for PR57320 also fixed this one.
However, using "-O2 -m32 -fno-omit-frame-pointer" an unnecessary stack
adjustment remains, even after r208551:
test:
movl bar, %eax
movl (%eax), %edx
testl %edx, %edx
jne .L7
ret
.p2align 4,,10
.p2align 3
pushl %ebp
movl %esp, %ebp
subl $20, %esp
pushl %eax
call foo
addl $16, %esp <<<<
leave
ret
>From gcc-bugs-return-446269-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Mar 14 09:01:05 2014
Return-Path: <gcc-bugs-return-446269-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 17302 invoked by alias); 14 Mar 2014 09:01:05 -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 17250 invoked by uid 48); 14 Mar 2014 09:01:01 -0000
From: "dominiq at lps dot ens.fr" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/60522] WHERE construct causes an ICE in gfc_trans_where_2
Date: Fri, 14 Mar 2014 09:01:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: fortran
X-Bugzilla-Version: unknown
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: dominiq at lps dot ens.fr
X-Bugzilla-Status: NEW
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: bug_status cf_reconfirmed_on cc everconfirmed
Message-ID: <bug-60522-4-zYaUSbAUVE@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-60522-4@http.gcc.gnu.org/bugzilla/>
References: <bug-60522-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-03/txt/msg01138.txt.bz2
Content-length: 801
http://gcc.gnu.org/bugzilla/show_bug.cgi?id`522
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-03-14
CC| |tkoenig at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Confirmed. The ICE goes away when compiling with -fno-frontend-optimize. The
test compiles with r171100 (2011-03-17) and gives the ICE with r171653
(2011-03-29).
The changes of frontend-passes.c in this range are r171653, r171575, and
r171207.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/60520] stack adjustment are not merged anymore
2014-03-13 21:26 [Bug target/60520] New: stack adjustment are not merged anymore ubizjak at gmail dot com
` (7 preceding siblings ...)
2014-03-14 8:59 ` ubizjak at gmail dot com
@ 2014-03-14 15:45 ` hjl.tools at gmail dot com
2014-03-14 16:20 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: hjl.tools at gmail dot com @ 2014-03-14 15:45 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 4492 bytes --]
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60520
--- Comment #9 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Uroš Bizjak from comment #8)
> However, using "-O2 -m32 -fno-omit-frame-pointer" an unnecessary stack
> adjustment remains, even after r208551:
>
> test:
> movl bar, %eax
> movl (%eax), %edx
> testl %edx, %edx
> jne .L7
> ret
> .p2align 4,,10
> .p2align 3
> pushl %ebp
> movl %esp, %ebp
> subl $20, %esp
> pushl %eax
> call foo
> addl $16, %esp <<<<
> leave
> ret
ix86_expand_epilogue restores SP and BP:
(insn 12 11 29 3 (parallel [
(set (reg/f:SI 7 sp)
(plus:SI (reg/f:SI 7 sp)
(const_int 16 [0x10])))
(clobber (reg:CC 17 flags))
]) /tmp/p.i:7 253 {*addsi_1}
(expr_list:REG_ARGS_SIZE (const_int 0 [0])
(nil)))
(note 29 12 30 3 NOTE_INSN_EPILOGUE_BEG)
(insn/f 30 29 34 3 (parallel [
(set (reg/f:SI 7 sp)
(plus:SI (reg/f:SI 6 bp)
(const_int 4 [0x4])))
(set (reg/f:SI 6 bp)
(mem:SI (reg/f:SI 6 bp) [0 S4 A8]))
(clobber (mem:BLK (scratch) [0 A8]))
]) /tmp/p.i:8 -1
(expr_list:REG_CFA_RESTORE (reg/f:SI 6 bp)
(expr_list:REG_CFA_DEF_CFA (plus:SI (reg/f:SI 7 sp)
(const_int 4 [0x4]))
(nil))))
But none of the passes after it kill insn 12.
>From gcc-bugs-return-446302-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Mar 14 15:51:15 2014
Return-Path: <gcc-bugs-return-446302-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 24048 invoked by alias); 14 Mar 2014 15:51:14 -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 24009 invoked by uid 48); 14 Mar 2014 15:51:11 -0000
From: "nicklas.ekstrand at sonymobile dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/60527] New: Incorrectly removed if statement while doing int arithmetics
Date: Fri, 14 Mar 2014 15:51:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
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: nicklas.ekstrand at sonymobile dot com
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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter attachments.created
Message-ID: <bug-60527-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-03/txt/msg01171.txt.bz2
Content-length: 1081
http://gcc.gnu.org/bugzilla/show_bug.cgi?id`527
Bug ID: 60527
Summary: Incorrectly removed if statement while doing int
arithmetics
Product: gcc
Version: 4.6.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: nicklas.ekstrand at sonymobile dot com
Created attachment 32349
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id2349&actioníit
Test program modtest.c
In the following code:
static int getZ() {
int tmp;
Z = Z * A + B;
tmp = Z;
if (tmp == INT_MIN)
tmp++;
if (tmp < 0)
tmp = -tmp;
return tmp % MEMSIZE;
}
The if-statement tmp==INT_MIN is optimized away when using -O2 or higher, e.g.,
$ gcc -Wall -Wextra -g -O2 modtest.c -o pc_modtest -lrt
$ ./pc_modtest
arr=0x7fc1608be010
i=0 A5 BA1
z1#1029 z2=-7483648
Segmentation fault
When using -O0 the problem doesn't happen and the program will not cause a
segmentation fault.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/60520] stack adjustment are not merged anymore
2014-03-13 21:26 [Bug target/60520] New: stack adjustment are not merged anymore ubizjak at gmail dot com
` (8 preceding siblings ...)
2014-03-14 15:45 ` hjl.tools at gmail dot com
@ 2014-03-14 16:20 ` jakub at gcc dot gnu.org
2014-03-14 20:33 ` hjl.tools at gmail dot com
2014-03-19 21:56 ` hjl.tools at gmail dot com
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-03-14 16:20 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60520
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
CC| |rth at gcc dot gnu.org
Resolution|FIXED |---
--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Supposedly csa pass could remove sp additions followed by setting of sp to
something not based on sp?
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/60520] stack adjustment are not merged anymore
2014-03-13 21:26 [Bug target/60520] New: stack adjustment are not merged anymore ubizjak at gmail dot com
` (9 preceding siblings ...)
2014-03-14 16:20 ` jakub at gcc dot gnu.org
@ 2014-03-14 20:33 ` hjl.tools at gmail dot com
2014-03-19 21:56 ` hjl.tools at gmail dot com
11 siblings, 0 replies; 13+ messages in thread
From: hjl.tools at gmail dot com @ 2014-03-14 20:33 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60520
--- Comment #11 from H.J. Lu <hjl.tools at gmail dot com> ---
Created attachment 32353
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32353&action=edit
A patch
This patch checks LEAVE and remove stack deallocation.
It removes 5 stack deallocations in cc1plus on Linux/i686.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/60520] stack adjustment are not merged anymore
2014-03-13 21:26 [Bug target/60520] New: stack adjustment are not merged anymore ubizjak at gmail dot com
` (10 preceding siblings ...)
2014-03-14 20:33 ` hjl.tools at gmail dot com
@ 2014-03-19 21:56 ` hjl.tools at gmail dot com
11 siblings, 0 replies; 13+ messages in thread
From: hjl.tools at gmail dot com @ 2014-03-19 21:56 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60520
H.J. Lu <hjl.tools at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #32353|0 |1
is obsolete| |
--- Comment #12 from H.J. Lu <hjl.tools at gmail dot com> ---
Created attachment 32399
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32399&action=edit
An updated patch
This patch passed regression test on Linux/x86-64
and Linux/x86. I am not sure if this patch is x86
specific. If it is, we can turn it into a target hook.
^ permalink raw reply [flat|nested] 13+ messages in thread