public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/20256] New: -ftree-loop-linear  doesn't work right in small loop
@ 2005-03-01  1:27 fjahanian at apple dot com
  2005-03-01  3:01 ` [Bug tree-optimization/20256] Perfect nest transformation not conservative enough dberlin at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 13+ messages in thread
From: fjahanian at apple dot com @ 2005-03-01  1:27 UTC (permalink / raw)
  To: gcc-bugs

This is a small extract from a benchmark. It shows that -O1 -ftree-loop-linear generates a couple
of empty loops, and incorrect behavior. 

/* main.c */
#include <stdio.h>

extern void init();

double mid_wts[8][35];
double  in_pats[1][35];

double  do_mid_forward(int patt)
{
double  sum;
int     neurode, i;

for (neurode=0;neurode<8; neurode++)
{
        sum = 0.0;
        for (i=0; i<35; i++)
        { 
                sum += mid_wts[neurode][i]*in_pats[patt][i];
        }
        sum = 1.0/(1.0+sum);
}
return sum;
}


double value;

main()
{
  init();
  printf(" %e\n", do_mid_forward (0));
}

/* init.c */
extern double mid_wts[8][35];
extern double  in_pats[1][35];

double value;

void init()
{
int i;
int neurode;

value=(double)1.0 - (double) 0.5;

for (neurode = 0; neurode<8; neurode++)
   for (i=0; i<35; i++)
      mid_wts[neurode][i] = value;

for (i=0; i<35; i++)
   in_pats[0][i] = 1.234;
}

% cc -c -O0 init.c
% cc -O1 -ftree-loop-linear main.c init.o
% ./a.out
 -2.384238e+11

Assembly file for ppc-darwin shows a couple of do-nothing empty loops. 
Remove -ftree-loop-linear and program behaves correctly.

-- 
           Summary: -ftree-loop-linear  doesn't work right in small loop
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fjahanian at apple dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: powerpc-apple-darwin
  GCC host triplet: powerpc-apple-darwin
GCC target triplet: powerpc-apple-darwin


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


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

end of thread, other threads:[~2006-08-17 15:02 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-20256-7508@http.gcc.gnu.org/bugzilla/>
2006-03-09 13:29 ` [Bug tree-optimization/20256] Perfect nest transformation not conservative enough pinskia at gcc dot gnu dot org
2006-05-17 14:26 ` spop at gcc dot gnu dot org
2006-05-18  4:57 ` pinskia at gcc dot gnu dot org
2006-08-17 13:14 ` spop at gcc dot gnu dot org
2006-08-17 15:02 ` pinskia at gcc dot gnu dot org
2005-03-01  1:27 [Bug tree-optimization/20256] New: -ftree-loop-linear doesn't work right in small loop fjahanian at apple dot com
2005-03-01  3:01 ` [Bug tree-optimization/20256] Perfect nest transformation not conservative enough dberlin at gcc dot gnu dot org
2005-03-01  3:43 ` pinskia at gcc dot gnu dot org
2005-05-27  2:46 ` pinskia at gcc dot gnu dot org
2005-06-10 21:18 ` pinskia at gcc dot gnu dot org
2005-06-10 21:41 ` pinskia at gcc dot gnu dot org
2005-06-28 23:18 ` bangerth at dealii dot org
2005-06-28 23:20 ` pinskia at gcc dot gnu dot org
2005-06-29  0:11 ` dberlin at dberlin dot 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).