public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Fix twolf -funroll-loops -O3 miscompilation (a semi-latent web.c bug)
@ 2012-11-18 23:15 Dominique Dhumieres
  2012-11-19  9:50 ` Steven Bosscher
  0 siblings, 1 reply; 68+ messages in thread
From: Dominique Dhumieres @ 2012-11-18 23:15 UTC (permalink / raw)
  To: gcc-patches; +Cc: bonzini, hubicka, stevenb.gcc

> I think this should fix it. Can't test it right now, so help
> appreciated (Honza: hint hint! ;-)

The change at http://gcc.gnu.org/ml/gcc-patches/2012-10/msg01511/remove_dead_eq_notes.diff
(revision 192526) caused

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

Dominique

^ permalink raw reply	[flat|nested] 68+ messages in thread
* Fix twolf -funroll-loops -O3 miscompilation (a semi-latent web.c bug)
@ 2012-10-12 20:14 Jan Hubicka
  2012-10-12 20:36 ` Markus Trippelsdorf
                   ` (2 more replies)
  0 siblings, 3 replies; 68+ messages in thread
From: Jan Hubicka @ 2012-10-12 20:14 UTC (permalink / raw)
  To: gcc-patches

Hi,
I finally tracked down twolf misoptimization triggered by my loop-unroll.c
changes.  It has turned out to be semi-latent wrong code issue in webizer.
What happens is:

1) gcse.c drop REG_EQUAL note on the induction variable
2) loop optimizer unrolls the loop enabling webizer to cleanup
3) webizer do not track reaching refs into REG_EQUAL note because
   the variable is dead and renames it to unused pseudo
   Program is stil valid but the REG_EQUAL is bogus.
4) CSE eventually takes the value and put it back into the code
5) init-regs initializes it to 0

and result is a segfault on the following testcase.
Fixed by making webizer to not prune dead regs.
Will commit it after testing on x86_64-linux.

Honza

/* { dg-do run } */
/* { dg-options "-O3 -funroll-loops" } */
typedef struct rowbox {
    int startx ;
    int endx ;
    int endx1 ;
    int startx2 ;
    int ypos ;
    int desiredL ;
} ROWBOX ;
ROWBOX rowArray1[2] ;
ROWBOX *rowArray = rowArray1;

int numRows = 2;

int row = 1;
int block = 0;
double ckt_size_factor ;

__attribute__ ((noinline))
configure2()
{
  block = 0 ;
  for( row = 1 ; row <= numRows ; row++ ) {
      block++ ;
    if( rowArray[row].endx1 > 0 ) {
      block++ ;
    }
  }
}

main()
{
  configure2();
}

	* web.c (web_main): Do not set DF_RD_PRUNE_DEAD_DEFS flag.
Index: web.c
===================================================================
--- web.c	(revision 192369)
+++ web.c	(working copy)
@@ -313,7 +313,8 @@ web_main (void)
   rtx insn;
 
   df_set_flags (DF_NO_HARD_REGS + DF_EQ_NOTES);
-  df_set_flags (DF_RD_PRUNE_DEAD_DEFS);
+  /* We can not RD_PRUNE_DEAD_DEFS, because we care about REG_EQUAL
+     notes.  */
   df_chain_add_problem (DF_UD_CHAIN);
   df_analyze ();
   df_set_flags (DF_DEFER_INSN_RESCAN);

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

end of thread, other threads:[~2012-12-03 23:28 UTC | newest]

Thread overview: 68+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-18 23:15 Fix twolf -funroll-loops -O3 miscompilation (a semi-latent web.c bug) Dominique Dhumieres
2012-11-19  9:50 ` Steven Bosscher
2012-11-19 11:27   ` Eric Botcazou
2012-11-19 20:35     ` Steven Bosscher
2012-11-19 21:20       ` Steven Bosscher
2012-11-19 21:52         ` Eric Botcazou
2012-11-19 22:03           ` Steven Bosscher
2012-11-19 22:44             ` Eric Botcazou
2012-11-19 22:48               ` Steven Bosscher
2012-11-23 22:46                 ` Steven Bosscher
2012-11-24  1:10                   ` Steven Bosscher
2012-11-25 20:44                     ` Steven Bosscher
2012-11-25 22:38                       ` Steven Bosscher
2012-11-26 14:38                         ` Dominique Dhumieres
2012-11-26 15:46                           ` Steven Bosscher
2012-11-27  9:58                         ` Eric Botcazou
2012-11-27 10:35                           ` Steven Bosscher
2012-11-27 12:01                             ` Steven Bosscher
2012-11-27 12:29                               ` Steven Bosscher
2012-11-27 13:04                                 ` Steven Bosscher
2012-11-27 14:25                                   ` Dominique Dhumieres
2012-11-27 14:49                                     ` Steven Bosscher
2012-11-27 13:48                                 ` Dominique Dhumieres
2012-11-27 14:33                               ` Paolo Bonzini
2012-11-27 16:59                                 ` Eric Botcazou
2012-11-27 23:29                                   ` Steven Bosscher
2012-11-27 23:50                                     ` Eric Botcazou
2012-11-27 23:54                                       ` Steven Bosscher
2012-11-27 23:59                                         ` Steven Bosscher
2012-11-28  0:43                                           ` Steven Bosscher
2012-11-28  7:46                                             ` Eric Botcazou
2012-11-28 15:57                                               ` Steven Bosscher
2012-11-28 22:12                                                 ` Eric Botcazou
2012-11-28 23:54                                                   ` Steven Bosscher
2012-12-01 14:57                                                     ` Eric Botcazou
2012-12-01 16:45                                                       ` Steven Bosscher
2012-12-03 18:26                                                         ` Eric Botcazou
2012-12-03 20:20                                                           ` Steven Bosscher
2012-12-03 21:12                                                             ` Eric Botcazou
2012-12-03 23:28                                                             ` Steven Bosscher
2012-12-03 20:15                                                       ` Paolo Bonzini
2012-11-19 21:29       ` Eric Botcazou
  -- strict thread matches above, loose matches on Subject: below --
2012-10-12 20:14 Jan Hubicka
2012-10-12 20:36 ` Markus Trippelsdorf
2012-10-12 20:44 ` Steven Bosscher
2012-10-12 21:16   ` Jan Hubicka
2012-10-12 21:19     ` Steven Bosscher
2012-10-12 21:31       ` Jan Hubicka
2012-10-12 22:41         ` Steven Bosscher
2012-10-14  9:13           ` Paolo Bonzini
2012-10-14 21:27             ` Steven Bosscher
2012-10-14 21:35               ` Eric Botcazou
2012-10-14 21:45                 ` Steven Bosscher
2012-10-15  8:14               ` Paolo Bonzini
2012-10-15  8:23                 ` Steven Bosscher
2012-10-15  8:35                   ` Paolo Bonzini
2012-10-15  8:38                     ` Steven Bosscher
2012-10-15 10:49                       ` Steven Bosscher
2012-10-15 12:28                       ` Paolo Bonzini
2012-10-15 13:19                         ` Steven Bosscher
2012-10-15 13:29                           ` Paolo Bonzini
2012-10-15 13:49                             ` Steven Bosscher
2012-10-16 10:35                               ` Steven Bosscher
2012-10-16 11:05                                 ` Steven Bosscher
2012-10-16 11:42                                   ` Paolo Bonzini
2012-10-16 22:57                                     ` Steven Bosscher
2012-10-19  5:14                                       ` Bin.Cheng
2012-10-12 21:05 ` Steven Bosscher

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).