public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/51447] New: global register variable definition incorrectly removed as dead code
@ 2011-12-07  7:26 pitchumani.s at atmel dot com
  2011-12-07 12:43 ` [Bug rtl-optimization/51447] " rguenth at gcc dot gnu.org
                   ` (22 more replies)
  0 siblings, 23 replies; 24+ messages in thread
From: pitchumani.s at atmel dot com @ 2011-12-07  7:26 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51447

             Bug #: 51447
           Summary: global register variable definition incorrectly
                    removed as dead code
    Classification: Unclassified
           Product: gcc
           Version: 4.6.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: pitchumani.s@atmel.com


Global register variable assignment(ptr = func) in the test case below seem to
be removed as dead code during CSE. As per the gcc manual, global register
variable should not be removed even if it appears to be dead. 

http://gcc.gnu.org/onlinedocs/gcc/Global-Reg-Vars.html

Discussion in gcc mailing list:
http://gcc.gnu.org/ml/gcc-help/2011-12/msg00057.html


Test case:

register void *ptr asm("rbx") ;

void testfn1(void* func)
{
  ptr = func;
  goto *(ptr);
}

Options: -S -O1

-- snip of assembly generated --
        .globl  testfn1
        .type   testfn1, @function
testfn1:
.LFB0:
        jmp     *%rdi
.LFE0:
        .size   testfn1, .-testfn1
-- snip end --


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug rtl-optimization/51447] global register variable definition incorrectly removed as dead code
  2011-12-07  7:26 [Bug c/51447] New: global register variable definition incorrectly removed as dead code pitchumani.s at atmel dot com
@ 2011-12-07 12:43 ` rguenth at gcc dot gnu.org
  2011-12-07 12:57 ` [Bug rtl-optimization/51447] [4.4/4.5/4.6/4.7 Regression] " jakub at gcc dot gnu.org
                   ` (21 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-12-07 12:43 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51447

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011-12-07
          Component|c                           |rtl-optimization
     Ever Confirmed|0                           |1

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-12-07 12:42:58 UTC ---
Confirmed.


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug rtl-optimization/51447] [4.4/4.5/4.6/4.7 Regression] global register variable definition incorrectly removed as dead code
  2011-12-07  7:26 [Bug c/51447] New: global register variable definition incorrectly removed as dead code pitchumani.s at atmel dot com
  2011-12-07 12:43 ` [Bug rtl-optimization/51447] " rguenth at gcc dot gnu.org
@ 2011-12-07 12:57 ` jakub at gcc dot gnu.org
  2011-12-07 13:11 ` jakub at gcc dot gnu.org
                   ` (20 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-12-07 12:57 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51447

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org
   Target Milestone|---                         |4.4.7
            Summary|global register variable    |[4.4/4.5/4.6/4.7
                   |definition incorrectly      |Regression] global register
                   |removed as dead code        |variable definition
                   |                            |incorrectly removed as dead
                   |                            |code

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-12-07 12:56:50 UTC ---
Introduced in between r125000 and r126000, i.e. most likely dataflow branch
merge.


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug rtl-optimization/51447] [4.4/4.5/4.6/4.7 Regression] global register variable definition incorrectly removed as dead code
  2011-12-07  7:26 [Bug c/51447] New: global register variable definition incorrectly removed as dead code pitchumani.s at atmel dot com
  2011-12-07 12:43 ` [Bug rtl-optimization/51447] " rguenth at gcc dot gnu.org
  2011-12-07 12:57 ` [Bug rtl-optimization/51447] [4.4/4.5/4.6/4.7 Regression] " jakub at gcc dot gnu.org
@ 2011-12-07 13:11 ` jakub at gcc dot gnu.org
  2011-12-07 13:49 ` bonzini at gnu dot org
                   ` (19 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-12-07 13:11 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51447

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bonzini at gnu dot org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-12-07 13:09:54 UTC ---
Indeed, fast_dce during cse1 removes this.  Paolo, could you please have a
look?
Thanks.


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug rtl-optimization/51447] [4.4/4.5/4.6/4.7 Regression] global register variable definition incorrectly removed as dead code
  2011-12-07  7:26 [Bug c/51447] New: global register variable definition incorrectly removed as dead code pitchumani.s at atmel dot com
                   ` (2 preceding siblings ...)
  2011-12-07 13:11 ` jakub at gcc dot gnu.org
@ 2011-12-07 13:49 ` bonzini at gnu dot org
  2011-12-07 14:04 ` bonzini at gnu dot org
                   ` (18 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: bonzini at gnu dot org @ 2011-12-07 13:49 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51447

--- Comment #4 from Paolo Bonzini <bonzini at gnu dot org> 2011-12-07 13:48:42 UTC ---
The bug is that rbx is added to the EXIT_BLOCK uses:

Basic block 1 , prev 2, loop_depth 0, count 0, freq 0.
Predecessors:
;; bb 1 artificial_defs: { }
;; bb 1 artificial_uses: { u-1(3){ }u-1(6){ }u-1(7){ }u-1(20){ }}

Successors:

but "jmp *%rbx" does not have the EXIT_BLOCK as a successor:


Basic block 2 , prev 0, next 1, loop_depth 0, count 0, freq 10000, maybe hot.
Predecessors:  ENTRY [100.0%]  (fallthru)
;; bb 2 artificial_defs: { }
;; bb 2 artificial_uses: { u-1(6){ }u-1(7){ }u-1(16){ }u-1(20){ }}

Successors:

;; Pred edge  ENTRY [100.0%]  (fallthru)
(note 4 0 2 2 [bb 2] NOTE_INSN_BASIC_BLOCK)

(insn 2 4 3 2 (set (reg/v/f:DI 59 [ func ])
        (reg:DI 5 di [ func ])) f.c:4 62 {*movdi_internal_rex64}
     (nil))

(note 3 2 7 2 NOTE_INSN_FUNCTION_BEG)

(jump_insn 7 3 0 2 (set (pc)
        (reg/v/f:DI 59 [ func ])) f.c:5 608 {*indirect_jump}
     (nil))
;; End of basic block 2 -> ()


... so the liveness of rbx is not propagated from the end of basic block 1 to
the end of basic block 2.

I think the testcase is bogus:

   You may not use [goto void *] to jump to code in a different function.
   If you do that, totally unpredictable things will happen.  The best way
   to avoid this is to store the label address only in automatic variables
   and never pass it as an argument.

However, this one also shows the same issue:

  register void *volatile ptr asm("rbx") ;
  void testfn1(void* func)
  {
    for(;;)
      ptr = func;
  }

and the fix should likely work for both.


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug rtl-optimization/51447] [4.4/4.5/4.6/4.7 Regression] global register variable definition incorrectly removed as dead code
  2011-12-07  7:26 [Bug c/51447] New: global register variable definition incorrectly removed as dead code pitchumani.s at atmel dot com
                   ` (3 preceding siblings ...)
  2011-12-07 13:49 ` bonzini at gnu dot org
@ 2011-12-07 14:04 ` bonzini at gnu dot org
  2011-12-07 14:07 ` jakub at gcc dot gnu.org
                   ` (17 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: bonzini at gnu dot org @ 2011-12-07 14:04 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51447

--- Comment #5 from Paolo Bonzini <bonzini at gnu dot org> 2011-12-07 14:04:04 UTC ---
Untested patch...

Index: df-problems.c
===================================================================
--- df-problems.c       (revision 177688)
+++ df-problems.c       (working copy)
@@ -901,6 +901,10 @@ df_lr_local_compute (bitmap all_blocks A
   /* The all-important stack pointer must always be live.  */
   bitmap_set_bit (&df->hardware_regs_used, STACK_POINTER_REGNUM);

+  for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
+    if (global_regs[i])
+      bitmap_set_bit (&df->hardware_regs_used, i);
+
   /* Before reload, there are a few registers that must be forced
      live everywhere -- which might not already be the case for
      blocks within infinite loops.  */
Index: df-scan.c
===================================================================
--- df-scan.c   (revision 177688)
+++ df-scan.c   (working copy)
@@ -3733,8 +3733,12 @@ df_get_entry_block_def_set (bitmap entry
   bitmap_clear (entry_block_defs);

   for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
-    if (FUNCTION_ARG_REGNO_P (i))
-      bitmap_set_bit (entry_block_defs, INCOMING_REGNO (i));
+    {
+      if (global_regs[i])
+        bitmap_set_bit (entry_block_defs, i);
+      if (FUNCTION_ARG_REGNO_P (i))
+        bitmap_set_bit (entry_block_defs, INCOMING_REGNO (i));
+    }

   /* The always important stack pointer.  */
   bitmap_set_bit (entry_block_defs, STACK_POINTER_REGNUM);


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug rtl-optimization/51447] [4.4/4.5/4.6/4.7 Regression] global register variable definition incorrectly removed as dead code
  2011-12-07  7:26 [Bug c/51447] New: global register variable definition incorrectly removed as dead code pitchumani.s at atmel dot com
                   ` (4 preceding siblings ...)
  2011-12-07 14:04 ` bonzini at gnu dot org
@ 2011-12-07 14:07 ` jakub at gcc dot gnu.org
  2011-12-15 11:45 ` jakub at gcc dot gnu.org
                   ` (16 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-12-07 14:07 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51447

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-12-07 14:06:41 UTC ---
I think goto ptr can't be nonlocal, so that testcase indeed would be invalid.

register void *ptr asm ("rbx");

int
foo (void)
{
  __label__ nonlocal_lab;

  __attribute__((noinline, noclone)) void
  bar (void *func)
  {
    ptr = func;
    goto nonlocal_lab;
  }
  bar (&&nonlocal_lab);
  return 1;
nonlocal_lab:
  return ptr != &&nonlocal_lab;
}

ought to be valid though, this is normal non-local goto.


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug rtl-optimization/51447] [4.4/4.5/4.6/4.7 Regression] global register variable definition incorrectly removed as dead code
  2011-12-07  7:26 [Bug c/51447] New: global register variable definition incorrectly removed as dead code pitchumani.s at atmel dot com
                   ` (5 preceding siblings ...)
  2011-12-07 14:07 ` jakub at gcc dot gnu.org
@ 2011-12-15 11:45 ` jakub at gcc dot gnu.org
  2011-12-15 12:09 ` bonzini at gnu dot org
                   ` (15 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-12-15 11:45 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51447

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-12-15 11:32:06 UTC ---
Created attachment 26100
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26100
gcc47-pr51447.patch

While that fixes the testcase at -O1, at -O2 and above it still fails. 
Apparently ud_dce pass removes it.


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug rtl-optimization/51447] [4.4/4.5/4.6/4.7 Regression] global register variable definition incorrectly removed as dead code
  2011-12-07  7:26 [Bug c/51447] New: global register variable definition incorrectly removed as dead code pitchumani.s at atmel dot com
                   ` (6 preceding siblings ...)
  2011-12-15 11:45 ` jakub at gcc dot gnu.org
@ 2011-12-15 12:09 ` bonzini at gnu dot org
  2011-12-16  8:35 ` jakub at gcc dot gnu.org
                   ` (14 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: bonzini at gnu dot org @ 2011-12-15 12:09 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51447

--- Comment #8 from Paolo Bonzini <bonzini at gnu dot org> 2011-12-15 12:01:25 UTC ---
For ud_dce it's simplest to add/remove fake edges around it.  For 4.8 it could
be worthwhile to try adding fake edges around all RTL passes (at least those
running in cfglayout mode) and see what breaks...


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug rtl-optimization/51447] [4.4/4.5/4.6/4.7 Regression] global register variable definition incorrectly removed as dead code
  2011-12-07  7:26 [Bug c/51447] New: global register variable definition incorrectly removed as dead code pitchumani.s at atmel dot com
                   ` (7 preceding siblings ...)
  2011-12-15 12:09 ` bonzini at gnu dot org
@ 2011-12-16  8:35 ` jakub at gcc dot gnu.org
  2012-01-20  8:11 ` abel at gcc dot gnu.org
                   ` (13 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-12-16  8:35 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51447

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug rtl-optimization/51447] [4.4/4.5/4.6/4.7 Regression] global register variable definition incorrectly removed as dead code
  2011-12-07  7:26 [Bug c/51447] New: global register variable definition incorrectly removed as dead code pitchumani.s at atmel dot com
                   ` (8 preceding siblings ...)
  2011-12-16  8:35 ` jakub at gcc dot gnu.org
@ 2012-01-20  8:11 ` abel at gcc dot gnu.org
  2012-03-13 12:48 ` [Bug rtl-optimization/51447] [4.5/4.6/4.7/4.8 " jakub at gcc dot gnu.org
                   ` (12 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: abel at gcc dot gnu.org @ 2012-01-20  8:11 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51447

Andrey Belevantsev <abel at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |abel at gcc dot gnu.org

--- Comment #9 from Andrey Belevantsev <abel at gcc dot gnu.org> 2012-01-20 07:45:57 UTC ---
(In reply to comment #8)
> For ud_dce it's simplest to add/remove fake edges around it.  For 4.8 it could
> be worthwhile to try adding fake edges around all RTL passes (at least those
> running in cfglayout mode) and see what breaks...

Do you mean just add/remove fake edges in init/fini_dce?  For Jakub's test:

    5 NOTE_INSN_BASIC_BLOCK
    2 r60:DI=di:DI
      REG_DEAD: di:DI
    3 r61:DI=r10:DI
      REG_DEAD: r10:DI
    4 NOTE_INSN_FUNCTION_BEG
    7 bx:DI=r60:DI
      REG_DEAD: r60:DI
    9 r63:DI=L0
   10 clobber [scratch]
   11 clobber [bp:DI]
   12 bp:DI=[r61:DI]
   13 clobber [scratch]
   14 clobber [sp:DI]
   15 sp:DI=[r61:DI+0x8]
      REG_DEAD: r61:DI
   16 use bp:DI
   17 use sp:DI
   18 pc=r63:DI
      REG_DEAD: r63:DI
      REG_NON_LOCAL_GOTO: 0

on top of his patch this results in 

 starting the processing of deferred insns
 ending the processing of deferred insns
 df_analyze called
-df_worklist_dataflow_doublequeue:n_basic_blocks 3 n_edges 1 count 3 (    1)
+df_worklist_dataflow_doublequeue:n_basic_blocks 3 n_edges 2 count 3 (    1)
+df_worklist_dataflow_doublequeue:n_basic_blocks 3 n_edges 2 count 3 (    1)
+df_worklist_dataflow_doublequeue:n_basic_blocks 3 n_edges 2 count 3 (    1)


 bar
@@ -45,7 +47,7 @@ Dataflow summary:
 ;; rd  out     (21)
 0, 1, 2, 4, 5, 6, 8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23

-( 0 )->[2]->( )
+( 0 )->[2]->( 1 )
 ;; bb 2 artificial_defs: { }
 ;; bb 2 artificial_uses: { u0(6){ d7(bb 2 insn 12) }u1(7){ d9(bb 2 insn 15)
}u2(16){ d11(bb 0 insn -1) }u3(20){ d12(bb 0 insn -1) }}
 ;; lr  in       5 [di] 6 [bp] 7 [sp] 16 [argp] 20 [frame] 39 [r10]
@@ -60,8 +62,8 @@ Dataflow summary:
 3, 7, 9, 24, 25, 26
 ;; rd  kill    (9)
 3, 4, 7, 8, 9, 10, 24, 25, 26
-;; lr  out      3 [bx] 7 [sp] 16 [argp] 20 [frame]
-;; live  out    3 [bx] 7 [sp] 16 [argp] 20 [frame]
+;; lr  out      3 [bx] 6 [bp] 7 [sp] 16 [argp] 20 [frame]
+;; live  out    3 [bx] 6 [bp] 7 [sp] 16 [argp] 20 [frame]
 ;; rd  out     (24)
 0, 1, 2, 3, 5, 6, 7, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26
 ;;  UD chains for artificial uses
@@ -93,7 +95,7 @@ Dataflow summary:
 ;;      reg 20 { d12(bb 0 insn -1) }
 ;;      reg 63 { d26(bb 2 insn 9) }

-( )->[1]->( )
+( 2 )->[1]->( )
 ;; bb 1 artificial_defs: { }
 ;; bb 1 artificial_uses: { u17(3){ }u18(6){ }u19(7){ }u20(20){ }}
 ;; lr  in       3 [bx] 6 [bp] 7 [sp] 20 [frame]

so we get only extra bp in live outs of block 2 and still kill insn 7 (which is
the actual problem).  Do we need bx to appear in live ins of EXIT (those are
empty with or without the patch)?


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug rtl-optimization/51447] [4.5/4.6/4.7/4.8 Regression] global register variable definition incorrectly removed as dead code
  2011-12-07  7:26 [Bug c/51447] New: global register variable definition incorrectly removed as dead code pitchumani.s at atmel dot com
                   ` (9 preceding siblings ...)
  2012-01-20  8:11 ` abel at gcc dot gnu.org
@ 2012-03-13 12:48 ` jakub at gcc dot gnu.org
  2012-07-02 10:58 ` rguenth at gcc dot gnu.org
                   ` (11 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-03-13 12:48 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51447

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.4.7                       |4.5.4

--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-03-13 12:44:47 UTC ---
4.4 branch is being closed, moving to 4.5.4 target.


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug rtl-optimization/51447] [4.5/4.6/4.7/4.8 Regression] global register variable definition incorrectly removed as dead code
  2011-12-07  7:26 [Bug c/51447] New: global register variable definition incorrectly removed as dead code pitchumani.s at atmel dot com
                   ` (10 preceding siblings ...)
  2012-03-13 12:48 ` [Bug rtl-optimization/51447] [4.5/4.6/4.7/4.8 " jakub at gcc dot gnu.org
@ 2012-07-02 10:58 ` rguenth at gcc dot gnu.org
  2012-11-11 22:05 ` [Bug rtl-optimization/51447] [4.6/4.7/4.8 " steven at gcc dot gnu.org
                   ` (10 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-07-02 10:58 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51447

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.5.4                       |4.6.4

--- Comment #11 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-07-02 10:57:35 UTC ---
The 4.5 branch is being closed, adjusting target milestone.


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug rtl-optimization/51447] [4.6/4.7/4.8 Regression] global register variable definition incorrectly removed as dead code
  2011-12-07  7:26 [Bug c/51447] New: global register variable definition incorrectly removed as dead code pitchumani.s at atmel dot com
                   ` (11 preceding siblings ...)
  2012-07-02 10:58 ` rguenth at gcc dot gnu.org
@ 2012-11-11 22:05 ` steven at gcc dot gnu.org
  2012-11-11 22:12 ` steven at gcc dot gnu.org
                   ` (9 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: steven at gcc dot gnu.org @ 2012-11-11 22:05 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51447

--- Comment #12 from Steven Bosscher <steven at gcc dot gnu.org> 2012-11-11 22:05:37 UTC ---
(In reply to comment #7)
> Created attachment 26100 [details]
> gcc47-pr51447.patch
> 
> While that fixes the testcase at -O1, at -O2 and above it still fails. 
> Apparently ud_dce pass removes it.

I think DCE should never delete an insn setting a global reg. So in
addition to your patch, we'd need the following patch:

Index: dce.c
===================================================================
--- dce.c       (revision 193411)
+++ dce.c       (working copy)
@@ -98,6 +98,11 @@ deletable_insn_p (rtx insn, bool fast, b
   rtx body, x;
   int i;

+  /* If INSN sets a global_reg, leave it untouched.  */
+  for (df_ref *def_rec = DF_INSN_DEFS (insn); *def_rec; def_rec++)
+    if (global_regs[DF_REF_REGNO (*def_rec)])
+      return false;
+  
   if (CALL_P (insn)
       /* We cannot delete calls inside of the recursive dce because
         this may cause basic blocks to be deleted and this messes up


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug rtl-optimization/51447] [4.6/4.7/4.8 Regression] global register variable definition incorrectly removed as dead code
  2011-12-07  7:26 [Bug c/51447] New: global register variable definition incorrectly removed as dead code pitchumani.s at atmel dot com
                   ` (12 preceding siblings ...)
  2012-11-11 22:05 ` [Bug rtl-optimization/51447] [4.6/4.7/4.8 " steven at gcc dot gnu.org
@ 2012-11-11 22:12 ` steven at gcc dot gnu.org
  2012-11-12 20:22 ` steven at gcc dot gnu.org
                   ` (8 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: steven at gcc dot gnu.org @ 2012-11-11 22:12 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51447

Steven Bosscher <steven at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2011-12-07 00:00:00         |2012-11-11 0:00
         AssignedTo|unassigned at gcc dot       |steven at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #13 from Steven Bosscher <steven at gcc dot gnu.org> 2012-11-11 22:11:53 UTC ---
Testing the patches of comment #7 and comment #11.


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug rtl-optimization/51447] [4.6/4.7/4.8 Regression] global register variable definition incorrectly removed as dead code
  2011-12-07  7:26 [Bug c/51447] New: global register variable definition incorrectly removed as dead code pitchumani.s at atmel dot com
                   ` (13 preceding siblings ...)
  2012-11-11 22:12 ` steven at gcc dot gnu.org
@ 2012-11-12 20:22 ` steven at gcc dot gnu.org
  2012-11-12 20:23 ` [Bug rtl-optimization/51447] [4.6/4.7 " steven at gcc dot gnu.org
                   ` (7 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: steven at gcc dot gnu.org @ 2012-11-12 20:22 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51447

--- Comment #14 from Steven Bosscher <steven at gcc dot gnu.org> 2012-11-12 20:22:05 UTC ---
Author: steven
Date: Mon Nov 12 20:21:59 2012
New Revision: 193453

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=193453
Log:
gcc/
    PR rtl-optimization/51447
    * df-scan.c (df_get_entry_block_def_set): Add global regs to the set.
    * df-problems.c (df_lr_local_compute): Make global regs always live.
    * dce.c (deletable_insn_p): Make insns setting a global reg
    inherently necessary.

testsuite/
    PR rtl-optimization/51447
    * gcc.c-torture/execute/pr51447.c: New test.


Added:
    trunk/gcc/testsuite/gcc.c-torture/execute/pr51447.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/dce.c
    trunk/gcc/df-problems.c
    trunk/gcc/df-scan.c
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug rtl-optimization/51447] [4.6/4.7 Regression] global register variable definition incorrectly removed as dead code
  2011-12-07  7:26 [Bug c/51447] New: global register variable definition incorrectly removed as dead code pitchumani.s at atmel dot com
                   ` (14 preceding siblings ...)
  2012-11-12 20:22 ` steven at gcc dot gnu.org
@ 2012-11-12 20:23 ` steven at gcc dot gnu.org
  2013-01-20 22:18 ` howarth at nitro dot med.uc.edu
                   ` (6 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: steven at gcc dot gnu.org @ 2012-11-12 20:23 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51447

Steven Bosscher <steven at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |NEW
         AssignedTo|steven at gcc dot gnu.org   |unassigned at gcc dot
                   |                            |gnu.org
            Summary|[4.6/4.7/4.8 Regression]    |[4.6/4.7 Regression] global
                   |global register variable    |register variable
                   |definition incorrectly      |definition incorrectly
                   |removed as dead code        |removed as dead code

--- Comment #15 from Steven Bosscher <steven at gcc dot gnu.org> 2012-11-12 20:23:37 UTC ---
Fixed on trunk. Could be back-ported, but IMHO this issue is not
important enough for that so I'm not going to work on back-ports.


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug rtl-optimization/51447] [4.6/4.7 Regression] global register variable definition incorrectly removed as dead code
  2011-12-07  7:26 [Bug c/51447] New: global register variable definition incorrectly removed as dead code pitchumani.s at atmel dot com
                   ` (15 preceding siblings ...)
  2012-11-12 20:23 ` [Bug rtl-optimization/51447] [4.6/4.7 " steven at gcc dot gnu.org
@ 2013-01-20 22:18 ` howarth at nitro dot med.uc.edu
  2013-01-21 14:53 ` howarth at nitro dot med.uc.edu
                   ` (5 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: howarth at nitro dot med.uc.edu @ 2013-01-20 22:18 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51447

Jack Howarth <howarth at nitro dot med.uc.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |howarth at nitro dot
                   |                            |med.uc.edu

--- Comment #16 from Jack Howarth <howarth at nitro dot med.uc.edu> 2013-01-20 22:18:04 UTC ---
The test case gcc.c-torture/execute/pr51447.c fails its execution test at -m32
(but not -m64) on x86_64-apple-darwin12 in gcc trunk. Adding -fno-PIC to the
compile flags eliminates the execution failure at all optimization levels for
-m32 on x86_64-apple-darwin12.

# gdb ./pr51447.x0
GNU gdb 6.3.50-20050815 (Apple version gdb-1822) (Sun Aug  5 03:00:42 UTC 2012)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared
libraries ... done

(gdb) b main
Breakpoint 1 at 0x1eed: file
/sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20130120/gcc/testsuite/gcc.c-torture/execute/pr51447.c,
line 13.
Breakpoint 2 at 0x1ec8: file
/sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20130120/gcc/testsuite/gcc.c-torture/execute/pr51447.c,
line 18.
warning: Multiple breakpoints were set.
Use the "delete" command to delete unwanted breakpoints.
(gdb) disp/i $pc
(gdb) r
Starting program:
/sw/src/fink.build/gcc48-4.8.0-1000/darwin_objdir/gcc/testsuite/gcc/pr51447.x0 
warning: posix_spawn failed, trying execvp, error: 86
Reading symbols for shared libraries ++......................... done

Breakpoint 1, 0x00001eed in main () at
/sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20130120/gcc/testsuite/gcc.c-torture/execute/pr51447.c:13
13    {
1: x/i $pc  0x1eed <main+9>:    call   0x1f3e <__x86.get_pc_thunk.bx>
(gdb) si
0x00001f3e in __x86.get_pc_thunk.bx ()
1: x/i $pc  0x1f3e <__x86.get_pc_thunk.bx>:    mov    (%esp),%ebx
(gdb) 
0x00001f41 in __x86.get_pc_thunk.bx ()
1: x/i $pc  0x1f41 <__x86.get_pc_thunk.bx+3>:    ret    
(gdb) 
0x00001ef2 in main () at
/sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20130120/gcc/testsuite/gcc.c-torture/execute/pr51447.c:13
13    {
1: x/i $pc  0x1ef2 <main+14>:    lea    -0x18(%ebp),%eax
(gdb) 
0x00001ef5    13    {
1: x/i $pc  0x1ef5 <main+17>:    mov    %eax,-0x24(%ebp)
(gdb) 
0x00001ef8    13    {
1: x/i $pc  0x1ef8 <main+20>:    mov    %esp,-0x20(%ebp)
(gdb) 
21      bar (&&nonlocal_lab);
1: x/i $pc  0x1efb <main+23>:    lea    -0x24(%ebp),%eax
(gdb) 
0x00001efe    21      bar (&&nonlocal_lab);
1: x/i $pc  0x1efe <main+26>:    lea    0x26(%ebx),%edx
(gdb) 
0x00001f04    21      bar (&&nonlocal_lab);
1: x/i $pc  0x1f04 <main+32>:    mov    %edx,(%esp)
(gdb) 
0x00001f07    21      bar (&&nonlocal_lab);
1: x/i $pc  0x1f07 <main+35>:    mov    %eax,%ecx
(gdb) 
0x00001f09    21      bar (&&nonlocal_lab);
1: x/i $pc  0x1f09 <main+37>:    call   0x1ebd <bar>
(gdb) 
bar (func=0x1f18) at
/sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20130120/gcc/testsuite/gcc.c-torture/execute/pr51447.c:17
17          {
1: x/i $pc  0x1ebd <bar>:    push   %ebp
(gdb) 
0x00001ebe    17          {
1: x/i $pc  0x1ebe <bar+1>:    mov    %esp,%ebp
(gdb) 
0x00001ec0    17          {
1: x/i $pc  0x1ec0 <bar+3>:    push   %ebx
(gdb) 
0x00001ec1    17          {
1: x/i $pc  0x1ec1 <bar+4>:    call   0x1f3e <__x86.get_pc_thunk.bx>
(gdb) 
0x00001f3e in __x86.get_pc_thunk.bx ()
1: x/i $pc  0x1f3e <__x86.get_pc_thunk.bx>:    mov    (%esp),%ebx
(gdb) 
0x00001f41 in __x86.get_pc_thunk.bx ()
1: x/i $pc  0x1f41 <__x86.get_pc_thunk.bx+3>:    ret    
(gdb) 
0x00001ec6 in bar (func=0x1f18) at
/sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20130120/gcc/testsuite/gcc.c-torture/execute/pr51447.c:17
17          {
1: x/i $pc  0x1ec6 <bar+9>:    mov    %ecx,%edx
(gdb) 

Breakpoint 2, bar (func=0x1f18) at
/sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20130120/gcc/testsuite/gcc.c-torture/execute/pr51447.c:18
18        ptr = func;
1: x/i $pc  0x1ec8 <bar+11>:    lea    0x142(%ebx),%eax
(gdb) 
0x00001ece    18        ptr = func;
1: x/i $pc  0x1ece <bar+17>:    mov    (%eax),%eax
(gdb) 
0x00001ed0    18        ptr = func;
1: x/i $pc  0x1ed0 <bar+19>:    mov    0x8(%ebp),%ecx
(gdb) 
0x00001ed3    18        ptr = func;
1: x/i $pc  0x1ed3 <bar+22>:    mov    %ecx,(%eax)
(gdb) 
19        goto nonlocal_lab;
1: x/i $pc  0x1ed5 <bar+24>:    mov    %edx,%eax
(gdb) 
0x00001ed7    19        goto nonlocal_lab;
1: x/i $pc  0x1ed7 <bar+26>:    lea    0x4f(%ebx),%edx
(gdb) 
0x00001edd    19        goto nonlocal_lab;
1: x/i $pc  0x1edd <bar+32>:    mov    (%eax),%ebp
(gdb) 
0x00001edf in bar (func=0xbffff8e0) at
/sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20130120/gcc/testsuite/gcc.c-torture/execute/pr51447.c:19
19        goto nonlocal_lab;
1: x/i $pc  0x1edf <bar+34>:    mov    0x4(%eax),%esp
(gdb) 
0x00001ee2    19        goto nonlocal_lab;
1: x/i $pc  0x1ee2 <bar+37>:    jmp    *%edx
(gdb) 
0x00001f15 in main () at
/sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20130120/gcc/testsuite/gcc.c-torture/execute/pr51447.c:22
22      return 1;
1: x/i $pc  0x1f15 <main+49>:    lea    0x18(%ebp),%ebp
(gdb) 
main () at
/sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20130120/gcc/testsuite/gcc.c-torture/execute/pr51447.c:24
24      if (ptr != &&nonlocal_lab)
1: x/i $pc  0x1f18 <main+52>:    lea    0x116(%ebx),%eax
(gdb) 
0x00001f1e    24      if (ptr != &&nonlocal_lab)
1: x/i $pc  0x1f1e <main+58>:    mov    (%eax),%eax
(gdb) 
0x00001f20    24      if (ptr != &&nonlocal_lab)
1: x/i $pc  0x1f20 <main+60>:    mov    (%eax),%edx
(gdb) 

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0104c700
0x00001f20 in main () at
/sw/src/fink.build/gcc48-4.8.0-1000/gcc-4.8-20130120/gcc/testsuite/gcc.c-torture/execute/pr51447.c:24
24      if (ptr != &&nonlocal_lab)


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug rtl-optimization/51447] [4.6/4.7 Regression] global register variable definition incorrectly removed as dead code
  2011-12-07  7:26 [Bug c/51447] New: global register variable definition incorrectly removed as dead code pitchumani.s at atmel dot com
                   ` (16 preceding siblings ...)
  2013-01-20 22:18 ` howarth at nitro dot med.uc.edu
@ 2013-01-21 14:53 ` howarth at nitro dot med.uc.edu
  2013-04-12 15:15 ` [Bug rtl-optimization/51447] [4.7 " jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: howarth at nitro dot med.uc.edu @ 2013-01-21 14:53 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51447

--- Comment #17 from Jack Howarth <howarth at nitro dot med.uc.edu> 2013-01-21 14:52:35 UTC ---
The failure in comment 16 appears to be PR51784.


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug rtl-optimization/51447] [4.7 Regression] global register variable definition incorrectly removed as dead code
  2011-12-07  7:26 [Bug c/51447] New: global register variable definition incorrectly removed as dead code pitchumani.s at atmel dot com
                   ` (17 preceding siblings ...)
  2013-01-21 14:53 ` howarth at nitro dot med.uc.edu
@ 2013-04-12 15:15 ` jakub at gcc dot gnu.org
  2013-09-10  7:45 ` matthijs at stdin dot nl
                   ` (3 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-04-12 15:15 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51447

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.6.4                       |4.7.4

--- Comment #18 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-04-12 15:15:32 UTC ---
GCC 4.6.4 has been released and the branch has been closed.


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug rtl-optimization/51447] [4.7 Regression] global register variable definition incorrectly removed as dead code
  2011-12-07  7:26 [Bug c/51447] New: global register variable definition incorrectly removed as dead code pitchumani.s at atmel dot com
                   ` (18 preceding siblings ...)
  2013-04-12 15:15 ` [Bug rtl-optimization/51447] [4.7 " jakub at gcc dot gnu.org
@ 2013-09-10  7:45 ` matthijs at stdin dot nl
  2013-09-10  7:52 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: matthijs at stdin dot nl @ 2013-09-10  7:45 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51447

Matthijs Kooijman <matthijs at stdin dot nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |matthijs at stdin dot nl

--- Comment #19 from Matthijs Kooijman <matthijs at stdin dot nl> ---
In case anyone else comes across here and wonders: This fix made it into 4.8,
but was not backported into 4.7.3.

Regarding the bug description that says "4.7 regression", I have also observed
this bug on avr-gcc 4.3.3, so it's not a regression introduced in 4.7.

I also noticed this bug on the AVR platform, using 4.7.2. Just in case it helps
(perhaps for others to find this bug when Googling for avr-gcc), here's the
testcase and bugreport I was preparing before I found this one.

  //
  // Under some circumstances, writes to a global register variable are
  // optimized away, even though that changes behaviour. The below example
  // illustrates this.
  //
  // When compiled as-is, the writes to the variable "global" are removed.
  // However, when compiling with -DDO_CALL, which adds a function call to
  // the main function, the writes are preserved. This leads me to believe
  // that the optimizer sees that main() isn't calling any functions, so
  // it must be safe to just remove the writes (even though documentation
  // [1] says "Stores into this register are never deleted even if they
  // appear to be dead, but references may be deleted or moved or
  // simplified.")
  //
  // It seems that a second condition (in addition to no functions called)
  // is that the main function does not return. If we add a return path,
  // the writes show up again.
  //
  // However, removing these writes does not seem sane, since there is
  // also an interrupt routine, which can access the variable, but the
  // optimizer is apparently not aware that this is a possibility.
  //
  //
  // Tested using:
  // avr-gcc -mmcu=attiny13 register.c -S -o - -O
  // avr-gcc -mmcu=attiny13 register.c -S -o - -O -DDO_CALL
  // avr-gcc -mmcu=attiny13 register.c -S -o - -O -DDO_RETURN
  //
  // [1]: //
http://gcc.gnu.org/onlinedocs/gcc/Global-Reg-Vars.html#Global-Reg-Vars

  #include "avr/io.h"
  #include "avr/cpufunc.h"

  // Define a global variable in a register
  register char global asm("r16");

  // Just a dummy function
  void foo()
  {
          // Add some nops so this function doesn't get inlined
          _NOP(); _NOP(); _NOP();
  }

  // Define an ISR that accesses the global. This doesn't actually seem to
  // make a different, except that if this wasn't here, removing writes to
  // the global would be acceptable
  void ISR(INT0_vect)
  {
          PORTB = global;
  }

  void main()
  {
          global = 1;
          while(1) {
  #ifdef DO_CALL
                  foo();
  #endif
  #ifdef DO_RETURN
                  return;
  #endif
          }
  }


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug rtl-optimization/51447] [4.7 Regression] global register variable definition incorrectly removed as dead code
  2011-12-07  7:26 [Bug c/51447] New: global register variable definition incorrectly removed as dead code pitchumani.s at atmel dot com
                   ` (19 preceding siblings ...)
  2013-09-10  7:45 ` matthijs at stdin dot nl
@ 2013-09-10  7:52 ` jakub at gcc dot gnu.org
  2014-06-12 13:03 ` rguenth at gcc dot gnu.org
  2020-06-10 20:58 ` cvs-commit at gcc dot gnu.org
  22 siblings, 0 replies; 24+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-09-10  7:52 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51447

--- Comment #20 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Matthijs Kooijman from comment #19)
> Regarding the bug description that says "4.7 regression", I have also
> observed this bug on avr-gcc 4.3.3, so it's not a regression introduced in
> 4.7.

That is just because no compilers older than 4.7.0 are supported any longer.
The [... Regression] markers only show list of still affected supported
compiler versions, if it is a regression from any of the older compilers.


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug rtl-optimization/51447] [4.7 Regression] global register variable definition incorrectly removed as dead code
  2011-12-07  7:26 [Bug c/51447] New: global register variable definition incorrectly removed as dead code pitchumani.s at atmel dot com
                   ` (20 preceding siblings ...)
  2013-09-10  7:52 ` jakub at gcc dot gnu.org
@ 2014-06-12 13:03 ` rguenth at gcc dot gnu.org
  2020-06-10 20:58 ` cvs-commit at gcc dot gnu.org
  22 siblings, 0 replies; 24+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-06-12 13:03 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51447

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
      Known to work|                            |4.8.0
         Resolution|---                         |FIXED
   Target Milestone|4.7.4                       |4.8.0
      Known to fail|                            |4.7.4

--- Comment #21 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed for 4.8.0.


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug rtl-optimization/51447] [4.7 Regression] global register variable definition incorrectly removed as dead code
  2011-12-07  7:26 [Bug c/51447] New: global register variable definition incorrectly removed as dead code pitchumani.s at atmel dot com
                   ` (21 preceding siblings ...)
  2014-06-12 13:03 ` rguenth at gcc dot gnu.org
@ 2020-06-10 20:58 ` cvs-commit at gcc dot gnu.org
  22 siblings, 0 replies; 24+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-06-10 20:58 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51447

--- Comment #22 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Alexandre Oliva <aoliva@gcc.gnu.org>:

https://gcc.gnu.org/g:06ef9c119c56568e5f77a5189aa382cb97c95a9e

commit r11-1185-g06ef9c119c56568e5f77a5189aa382cb97c95a9e
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Wed Jun 10 17:56:36 2020 -0300

    [PR51447] restore the global reg var before returning from main

    A runtime system might legitimately hold in rbx a value expected to be
    preserved across the call to main, but its use as a global register
    variable stops main from preserving it.


    for  gcc/testsuite/ChangeLog

            PR rtl-optimization/51447
            * gcc.c-torture/execute/pr51447.c (main): Preserve call-saved
            register.

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2020-06-10 20:58 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-07  7:26 [Bug c/51447] New: global register variable definition incorrectly removed as dead code pitchumani.s at atmel dot com
2011-12-07 12:43 ` [Bug rtl-optimization/51447] " rguenth at gcc dot gnu.org
2011-12-07 12:57 ` [Bug rtl-optimization/51447] [4.4/4.5/4.6/4.7 Regression] " jakub at gcc dot gnu.org
2011-12-07 13:11 ` jakub at gcc dot gnu.org
2011-12-07 13:49 ` bonzini at gnu dot org
2011-12-07 14:04 ` bonzini at gnu dot org
2011-12-07 14:07 ` jakub at gcc dot gnu.org
2011-12-15 11:45 ` jakub at gcc dot gnu.org
2011-12-15 12:09 ` bonzini at gnu dot org
2011-12-16  8:35 ` jakub at gcc dot gnu.org
2012-01-20  8:11 ` abel at gcc dot gnu.org
2012-03-13 12:48 ` [Bug rtl-optimization/51447] [4.5/4.6/4.7/4.8 " jakub at gcc dot gnu.org
2012-07-02 10:58 ` rguenth at gcc dot gnu.org
2012-11-11 22:05 ` [Bug rtl-optimization/51447] [4.6/4.7/4.8 " steven at gcc dot gnu.org
2012-11-11 22:12 ` steven at gcc dot gnu.org
2012-11-12 20:22 ` steven at gcc dot gnu.org
2012-11-12 20:23 ` [Bug rtl-optimization/51447] [4.6/4.7 " steven at gcc dot gnu.org
2013-01-20 22:18 ` howarth at nitro dot med.uc.edu
2013-01-21 14:53 ` howarth at nitro dot med.uc.edu
2013-04-12 15:15 ` [Bug rtl-optimization/51447] [4.7 " jakub at gcc dot gnu.org
2013-09-10  7:45 ` matthijs at stdin dot nl
2013-09-10  7:52 ` jakub at gcc dot gnu.org
2014-06-12 13:03 ` rguenth at gcc dot gnu.org
2020-06-10 20:58 ` cvs-commit at gcc dot gnu.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).