* [Bug target/46915] Wrong code is generated for conditional branch followed by zero length asm
2010-12-12 22:48 [Bug target/46915] New: Wrong code is generated for conditional branch followed by zero length asm danglin at gcc dot gnu.org
@ 2010-12-13 2:45 ` dave at hiauly1 dot hia.nrc.ca
2010-12-13 2:45 ` dave at hiauly1 dot hia.nrc.ca
` (14 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: dave at hiauly1 dot hia.nrc.ca @ 2010-12-13 2:45 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46915
--- Comment #1 from dave at hiauly1 dot hia.nrc.ca 2010-12-13 02:45:37 UTC ---
Reduced testcase attached.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug target/46915] Wrong code is generated for conditional branch followed by zero length asm
2010-12-12 22:48 [Bug target/46915] New: Wrong code is generated for conditional branch followed by zero length asm danglin at gcc dot gnu.org
2010-12-13 2:45 ` [Bug target/46915] " dave at hiauly1 dot hia.nrc.ca
@ 2010-12-13 2:45 ` dave at hiauly1 dot hia.nrc.ca
2010-12-13 2:50 ` dave at hiauly1 dot hia.nrc.ca
` (13 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: dave at hiauly1 dot hia.nrc.ca @ 2010-12-13 2:45 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46915
--- Comment #2 from dave at hiauly1 dot hia.nrc.ca 2010-12-13 02:45:38 UTC ---
Created attachment 22731
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22731
xxx.c
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug target/46915] Wrong code is generated for conditional branch followed by zero length asm
2010-12-12 22:48 [Bug target/46915] New: Wrong code is generated for conditional branch followed by zero length asm danglin at gcc dot gnu.org
2010-12-13 2:45 ` [Bug target/46915] " dave at hiauly1 dot hia.nrc.ca
2010-12-13 2:45 ` dave at hiauly1 dot hia.nrc.ca
@ 2010-12-13 2:50 ` dave at hiauly1 dot hia.nrc.ca
2010-12-13 3:59 ` dave at hiauly1 dot hia.nrc.ca
` (12 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: dave at hiauly1 dot hia.nrc.ca @ 2010-12-13 2:50 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46915
--- Comment #3 from dave at hiauly1 dot hia.nrc.ca 2010-12-13 02:49:57 UTC ---
Reduced testcase attached.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug target/46915] Wrong code is generated for conditional branch followed by zero length asm
2010-12-12 22:48 [Bug target/46915] New: Wrong code is generated for conditional branch followed by zero length asm danglin at gcc dot gnu.org
` (2 preceding siblings ...)
2010-12-13 2:50 ` dave at hiauly1 dot hia.nrc.ca
@ 2010-12-13 3:59 ` dave at hiauly1 dot hia.nrc.ca
2010-12-13 3:59 ` dave at hiauly1 dot hia.nrc.ca
` (11 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: dave at hiauly1 dot hia.nrc.ca @ 2010-12-13 3:59 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46915
--- Comment #6 from dave at hiauly1 dot hia.nrc.ca 2010-12-13 03:59:09 UTC ---
Created attachment 22734
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22734
pa.c.d
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug target/46915] Wrong code is generated for conditional branch followed by zero length asm
2010-12-12 22:48 [Bug target/46915] New: Wrong code is generated for conditional branch followed by zero length asm danglin at gcc dot gnu.org
` (3 preceding siblings ...)
2010-12-13 3:59 ` dave at hiauly1 dot hia.nrc.ca
@ 2010-12-13 3:59 ` dave at hiauly1 dot hia.nrc.ca
2010-12-13 9:35 ` amylaar at gcc dot gnu.org
` (10 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: dave at hiauly1 dot hia.nrc.ca @ 2010-12-13 3:59 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46915
--- Comment #5 from dave at hiauly1 dot hia.nrc.ca 2010-12-13 03:59:08 UTC ---
Testing attached change. branch_to_delay_slot_p didn't correctly
handle asms, etc. When it is fixed, branch_needs_nop_p isn't needed.
It also didn't handle all cases.
Dave
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug target/46915] Wrong code is generated for conditional branch followed by zero length asm
2010-12-12 22:48 [Bug target/46915] New: Wrong code is generated for conditional branch followed by zero length asm danglin at gcc dot gnu.org
` (4 preceding siblings ...)
2010-12-13 3:59 ` dave at hiauly1 dot hia.nrc.ca
@ 2010-12-13 9:35 ` amylaar at gcc dot gnu.org
2010-12-13 10:59 ` jakub at gcc dot gnu.org
` (9 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: amylaar at gcc dot gnu.org @ 2010-12-13 9:35 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46915
Jorn Wolfgang Rennecke <amylaar at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |amylaar at gcc dot gnu.org
--- Comment #7 from Jorn Wolfgang Rennecke <amylaar at gcc dot gnu.org> 2010-12-13 09:34:49 UTC ---
(In reply to comment #6)
> Created attachment 22734 [details]
> pa.c.d
This will break if you have an asm that gcc thinks is non-zero in length,
but which is, in fact, zero length. E.g you might have a comment explaining
why no code is needed, and gcc sees a line, which it equates to an insn.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug target/46915] Wrong code is generated for conditional branch followed by zero length asm
2010-12-12 22:48 [Bug target/46915] New: Wrong code is generated for conditional branch followed by zero length asm danglin at gcc dot gnu.org
` (5 preceding siblings ...)
2010-12-13 9:35 ` amylaar at gcc dot gnu.org
@ 2010-12-13 10:59 ` jakub at gcc dot gnu.org
2010-12-13 12:44 ` dave at hiauly1 dot hia.nrc.ca
` (8 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: jakub at gcc dot gnu.org @ 2010-12-13 10:59 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46915
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> 2010-12-13 10:59:28 UTC ---
Yeah, the insn count for asm is just a guess. You should never put inline asm
into a delay slot, you really don't know how big it is or if it is suitable for
the delay slot.
I guess the bug is in checking just for ASM_INPUT, that should be also testing
extract_asm_operands () != NULL_RTX.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug target/46915] Wrong code is generated for conditional branch followed by zero length asm
2010-12-12 22:48 [Bug target/46915] New: Wrong code is generated for conditional branch followed by zero length asm danglin at gcc dot gnu.org
` (6 preceding siblings ...)
2010-12-13 10:59 ` jakub at gcc dot gnu.org
@ 2010-12-13 12:44 ` dave at hiauly1 dot hia.nrc.ca
2010-12-13 12:52 ` dave at hiauly1 dot hia.nrc.ca
` (7 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: dave at hiauly1 dot hia.nrc.ca @ 2010-12-13 12:44 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46915
--- Comment #9 from dave at hiauly1 dot hia.nrc.ca 2010-12-13 12:44:21 UTC ---
> Yeah, the insn count for asm is just a guess. You should never put inline asm
> into a delay slot, you really don't know how big it is or if it is suitable for
> the delay slot.
> I guess the bug is in checking just for ASM_INPUT, that should be also testing
> extract_asm_operands () != NULL_RTX.
Thanks, I'll look at that. However, I think branch_to_delay_slot_p can
be improved. It probably should also check for asms and return FALSE
if it finds one.
Dave
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug target/46915] Wrong code is generated for conditional branch followed by zero length asm
2010-12-12 22:48 [Bug target/46915] New: Wrong code is generated for conditional branch followed by zero length asm danglin at gcc dot gnu.org
` (7 preceding siblings ...)
2010-12-13 12:44 ` dave at hiauly1 dot hia.nrc.ca
@ 2010-12-13 12:52 ` dave at hiauly1 dot hia.nrc.ca
2010-12-18 17:10 ` danglin at gcc dot gnu.org
` (6 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: dave at hiauly1 dot hia.nrc.ca @ 2010-12-13 12:52 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46915
--- Comment #10 from dave at hiauly1 dot hia.nrc.ca 2010-12-13 12:51:51 UTC ---
> Thanks, I'll look at that. However, I think branch_to_delay_slot_p can
> be improved. It probably should also check for asms and return FALSE
> if it finds one.
Another related issue is the "useskip" check. It also needs to check
for asms.
Dave
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug target/46915] Wrong code is generated for conditional branch followed by zero length asm
2010-12-12 22:48 [Bug target/46915] New: Wrong code is generated for conditional branch followed by zero length asm danglin at gcc dot gnu.org
` (8 preceding siblings ...)
2010-12-13 12:52 ` dave at hiauly1 dot hia.nrc.ca
@ 2010-12-18 17:10 ` danglin at gcc dot gnu.org
2010-12-18 22:28 ` eike@sf-mail.de
` (5 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: danglin at gcc dot gnu.org @ 2010-12-18 17:10 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46915
--- Comment #11 from John David Anglin <danglin at gcc dot gnu.org> 2010-12-18 17:10:37 UTC ---
Author: danglin
Date: Sat Dec 18 17:10:34 2010
New Revision: 168026
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=168026
Log:
PR target/46915
* config/pa/pa.c (branch_to_delay_slot_p): Use next_active_insn instead
of next_real_insn. Search forward checking for both ASM_INPUT and
ASM_OPERANDS asms until exit condition is found.
(branch_needs_nop_p): Likewise.
(use_skip_p): New function.
(output_cbranch): Use use_skip_p.
(output_bb, output_bvb): Likewise.
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/pa/pa.c
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug target/46915] Wrong code is generated for conditional branch followed by zero length asm
2010-12-12 22:48 [Bug target/46915] New: Wrong code is generated for conditional branch followed by zero length asm danglin at gcc dot gnu.org
` (9 preceding siblings ...)
2010-12-18 17:10 ` danglin at gcc dot gnu.org
@ 2010-12-18 22:28 ` eike@sf-mail.de
2010-12-18 22:42 ` dave at hiauly1 dot hia.nrc.ca
` (4 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: eike@sf-mail.de @ 2010-12-18 22:28 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46915
--- Comment #12 from Rolf Eike Beer <eike@sf-mail.de> 2010-12-18 22:27:40 UTC ---
Any chance this gets backported?
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug target/46915] Wrong code is generated for conditional branch followed by zero length asm
2010-12-12 22:48 [Bug target/46915] New: Wrong code is generated for conditional branch followed by zero length asm danglin at gcc dot gnu.org
` (10 preceding siblings ...)
2010-12-18 22:28 ` eike@sf-mail.de
@ 2010-12-18 22:42 ` dave at hiauly1 dot hia.nrc.ca
2010-12-19 19:50 ` danglin at gcc dot gnu.org
` (3 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: dave at hiauly1 dot hia.nrc.ca @ 2010-12-18 22:42 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46915
--- Comment #13 from dave at hiauly1 dot hia.nrc.ca 2010-12-18 22:42:13 UTC ---
> Any chance this gets backported?
It's not a regression, but I think it should be backported since it breaks
Linux in a somewhat random manner. I'm currently testing the change on the
4.5 branch.
Dave
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug target/46915] Wrong code is generated for conditional branch followed by zero length asm
2010-12-12 22:48 [Bug target/46915] New: Wrong code is generated for conditional branch followed by zero length asm danglin at gcc dot gnu.org
` (11 preceding siblings ...)
2010-12-18 22:42 ` dave at hiauly1 dot hia.nrc.ca
@ 2010-12-19 19:50 ` danglin at gcc dot gnu.org
2010-12-22 18:47 ` danglin at gcc dot gnu.org
` (2 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: danglin at gcc dot gnu.org @ 2010-12-19 19:50 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46915
--- Comment #14 from John David Anglin <danglin at gcc dot gnu.org> 2010-12-19 19:50:20 UTC ---
Author: danglin
Date: Sun Dec 19 19:50:17 2010
New Revision: 168072
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=168072
Log:
Backport from mainline:
2010-12-18 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
PR target/46915
* config/pa/pa.c (branch_to_delay_slot_p): Use next_active_insn instead
of next_real_insn. Search forward checking for both ASM_INPUT and
ASM_OPERANDS asms until exit condition is found.
(branch_needs_nop_p): Likewise.
(use_skip_p): New function.
(output_cbranch): Use use_skip_p.
(output_bb, output_bvb): Likewise.
Modified:
branches/gcc-4_5-branch/gcc/ChangeLog
branches/gcc-4_5-branch/gcc/config/pa/pa.c
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug target/46915] Wrong code is generated for conditional branch followed by zero length asm
2010-12-12 22:48 [Bug target/46915] New: Wrong code is generated for conditional branch followed by zero length asm danglin at gcc dot gnu.org
` (12 preceding siblings ...)
2010-12-19 19:50 ` danglin at gcc dot gnu.org
@ 2010-12-22 18:47 ` danglin at gcc dot gnu.org
2010-12-22 18:50 ` danglin at gcc dot gnu.org
2010-12-22 18:58 ` danglin at gcc dot gnu.org
15 siblings, 0 replies; 17+ messages in thread
From: danglin at gcc dot gnu.org @ 2010-12-22 18:47 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46915
--- Comment #15 from John David Anglin <danglin at gcc dot gnu.org> 2010-12-22 18:47:04 UTC ---
Author: danglin
Date: Wed Dec 22 18:46:57 2010
New Revision: 168177
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=168177
Log:
Backport from mainline:
2010-12-18 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
PR target/46915
* config/pa/pa.c (branch_to_delay_slot_p): Use next_active_insn instead
of next_real_insn. Search forward checking for both ASM_INPUT and
ASM_OPERANDS asms until exit condition is found.
(branch_needs_nop_p): Likewise.
(use_skip_p): New function.
(output_cbranch): Use use_skip_p.
(output_bb, output_bvb): Likewise.
2009-06-25 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
PR target/40468
* pa.c (branch_to_delay_slot_p, branch_needs_nop_p): New functions.
(output_cbranch): Use new functions.
(output_bb, output_bvb, output_dbra, output_movb): Likewise.
Modified:
branches/gcc-4_4-branch/gcc/ChangeLog
branches/gcc-4_4-branch/gcc/config/pa/pa.c
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug target/46915] Wrong code is generated for conditional branch followed by zero length asm
2010-12-12 22:48 [Bug target/46915] New: Wrong code is generated for conditional branch followed by zero length asm danglin at gcc dot gnu.org
` (13 preceding siblings ...)
2010-12-22 18:47 ` danglin at gcc dot gnu.org
@ 2010-12-22 18:50 ` danglin at gcc dot gnu.org
2010-12-22 18:58 ` danglin at gcc dot gnu.org
15 siblings, 0 replies; 17+ messages in thread
From: danglin at gcc dot gnu.org @ 2010-12-22 18:50 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46915
--- Comment #16 from John David Anglin <danglin at gcc dot gnu.org> 2010-12-22 18:49:31 UTC ---
Author: danglin
Date: Wed Dec 22 18:49:24 2010
New Revision: 168178
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=168178
Log:
Backport from mainline:
2010-12-18 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
PR target/46915
* config/pa/pa.c (branch_to_delay_slot_p): Use next_active_insn instead
of next_real_insn. Search forward checking for both ASM_INPUT and
ASM_OPERANDS asms until exit condition is found.
(branch_needs_nop_p): Likewise.
(use_skip_p): New function.
(output_cbranch): Use use_skip_p.
(output_bb, output_bvb): Likewise.
2009-06-25 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
PR target/40468
* pa.c (branch_to_delay_slot_p, branch_needs_nop_p): New functions.
(output_cbranch): Use new functions.
(output_bb, output_bvb, output_dbra, output_movb): Likewise.
Modified:
branches/gcc-4_3-branch/gcc/ChangeLog
branches/gcc-4_3-branch/gcc/config/pa/pa.c
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug target/46915] Wrong code is generated for conditional branch followed by zero length asm
2010-12-12 22:48 [Bug target/46915] New: Wrong code is generated for conditional branch followed by zero length asm danglin at gcc dot gnu.org
` (14 preceding siblings ...)
2010-12-22 18:50 ` danglin at gcc dot gnu.org
@ 2010-12-22 18:58 ` danglin at gcc dot gnu.org
15 siblings, 0 replies; 17+ messages in thread
From: danglin at gcc dot gnu.org @ 2010-12-22 18:58 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46915
John David Anglin <danglin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
--- Comment #17 from John David Anglin <danglin at gcc dot gnu.org> 2010-12-22 18:58:20 UTC ---
Fixed.
^ permalink raw reply [flat|nested] 17+ messages in thread