Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Jun 2007 18:56:28 +0400
From:      Andrey Chernov <ache@nagual.pp.ru>
To:        Alexander Kabaev <kabaev@gmail.com>
Cc:        kan@freebsd.org, current@freebsd.org
Subject:   Re: Silent gcc 4.2.0 loop optimization bug with -O2
Message-ID:  <20070625145627.GA53685@nagual.pp.ru>
In-Reply-To: <8e5ef5f70706250659v48f64410wb5399985a571087e@mail.gmail.com>
References:  <20070625130913.GA50273@nagual.pp.ru> <20070625133951.GA51324@nagual.pp.ru> <8e5ef5f70706250659v48f64410wb5399985a571087e@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Jun 25, 2007 at 09:59:21AM -0400, Alexander Kabaev wrote:
>  It is trivial to extract a sample for miscompiltations. Just use
>  -save-temps and cut down the code until you have a simple case. If you
>  cannot be bothered to do that, nobody else would either,

Well... Is this small enough?

cc -O2 a.c
./a.out
cc -O a.c
./a.out
------------------------------------------------------------------
#include <stdio.h>

const char *szElem[4];

void main()
{
  float power1[80], total2;
  int i, j;
  char sz[80];

  for (i = 1; i <= 12; i++) {
    if (i <= 4) {
      sprintf(sz, "  -%9.7s:", szElem[i-1]);
      for (j = 1; j < 12; j += 4)
        total2 += power1[i-1+j];
    } else if (i == 6) {
    } else if (i >= 7 && i <= 9) {
      printf("MUST BE HERE!!! %d\n", i);
    }
  }
}
-------------------------------------------------------------------

-- 
http://ache.pp.ru/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070625145627.GA53685>