Bug 28243 - [4.1 Regression] internal consistency failure when building fontforge with -O3 -fPIC -ftracer
Summary: [4.1 Regression] internal consistency failure when building fontforge with -O...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 4.1.1
: P3 normal
Target Milestone: 4.1.2
Assignee: Eric Botcazou
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: ice-on-valid-code, monitored
Depends on:
Blocks:
 
Reported: 2006-07-04 07:49 UTC by Mike Frysinger
Modified: 2006-09-12 21:54 UTC (History)
6 users (show)

See Also:
Host: i686-linux-gnu
Target: i686-linux-gnu
Build:
Known to work: 4.0.3 4.2.0
Known to fail: 4.1.1 4.1.0
Last reconfirmed: 2006-09-12 06:18:23


Attachments
PR28243-ice.i (336 bytes, text/plain)
2006-07-04 07:53 UTC, Mike Frysinger
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Frysinger 2006-07-04 07:49:53 UTC
when building fontforge with -O3 -ftracer with gcc-4.1.1, the build bombs:

i686-pc-linux-gnu-gcc -O3 -march=pentium-m -pipe -fomit-frame-pointer -ftracer -I/usr/include/freetype2/ -I/usr/include/libxml2/ -I../inc -I/usr/pkg/include -I/usr/pkg/include/giflib -Wmissing-prototypes -Wunused -Wimplicit -Wreturn-type -Wparentheses -Wformat -Wchar-subscripts -DNOTHREADS -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DHAVE_ICONV_H=1 -D_HAS_LONGLONG=1 -DHAVE_LIBINTL_H=1 -DFONTFORGE_CONFIG_TYPE3=1 -DFONTFORGE_CONFIG_DEVICETABLES=1 -DLIBDIR=\"/lib\" -c gpsdraw.c  -fPIC -DPIC -o gpsdraw.lo
gpsdraw.c: In function 'PSDrawElipse':
gpsdraw.c:442: fatal error: internal consistency failure
compilation terminated.

verified on Gentoo and Debian that 4.0.3 works, 4.1.1 fails, mainline works
Comment 1 Mike Frysinger 2006-07-04 07:53:16 UTC
Created attachment 11812 [details]
PR28243-ice.i

$ gcc-4.1.1 -c -ftracer -O3 -m32 -fPIC PR28243-ice.i
PR28243-ice.i: In function 'PSDrawFillCircle':
PR28243-ice.i:31: fatal error: internal consistency failure
compilation terminated.

for the full preprocessed output:
http://bugs.gentoo.org/attachment.cgi?id=84775
Comment 2 Richard Biener 2006-07-04 13:53:11 UTC
Confirmed. -O2 -ftracer -fPIC.
Comment 3 Martin Michlmayr 2006-07-15 20:10:50 UTC
Here's another test case, taken from maxdb:

50015:tbm@deprecation: ~/tmp/src/gcc/delta/bin] gcc-4.1 -c -fPIC -O2 28243.c
28243.c: In function ‘pa01CompareKeywordW’:
28243.c:25: fatal error: internal consistency failure
compilation terminated.
Preprocessed source stored into /tmp/cc4ogkHJ.out file, please attach this to your bugreport.
zsh: exit 1     gcc-4.1 -c -fPIC -O2 28243.c
50016:tbm@deprecation: ~/tmp/src/gcc/delta/bin] cat 28243.c
typedef struct tsp1_packet_header { } tsp81_UCS2Char;
typedef struct
{
  short entry;
  unsigned char keyword[(18)];
  int order_type_key;
  unsigned short keywordW[(18)];
}
api_keyword_tab;
static api_keyword_tab keyword_tab[] = {
};
pa01CompareKeywordW (const unsigned short * strp, int * order_type)
{
  unsigned int i, len1, len2;
  for (i = 0; keyword_tab[i].entry != (99); i++)
    {
        sp81UCS2strlen ((tsp81_UCS2Char *) (keyword_tab[i].keywordW));
      len1 = len1 < len2 ? len1 : len2;
      if (memcmp (keyword_tab[i].keywordW, strp, len1) == 0)
        {
          *order_type = keyword_tab[i].order_type_key;
          break;
        }
    }
}
Comment 4 Steven Bosscher 2006-07-15 22:58:03 UTC
Probably latent on mainline.
Comment 5 Volker Reichelt 2006-07-19 11:40:49 UTC
Here's a slightly shorter testcase:

=========================================
struct A
{
  char c[13];
  int k[1];
};

struct A a[1];

void foo(int* p)
{
  int i, j;
  for (i=0; i<2; ++i)
    if (memcmp (a[i].k, p, j))
    {
      *p = a[i].k[0];
      bar ((struct A*) (a[i].k));
      break;
    }
}
=========================================

Btw, the error should be an internal_error and not a fatal_error IMHO:

flow.c:493:  fatal_error ("internal consistency failure");
flow.c:518:       fatal_error ("internal consistency failure");
flow.c:540:           fatal_error ("internal consistency failure");

We already have issue an ICE with the same message here:

emit-rtl.c:2239:      internal_error ("internal consistency failure");
Comment 6 Eric Botcazou 2006-09-11 10:42:14 UTC
> Here's another test case, taken from maxdb:

Please do not attach "other" testcases to a PR, the underlying problems are very
likely unrelated.  Only testcases reduced from the original one are of any help.
Comment 7 Eric Botcazou 2006-09-12 06:18:23 UTC
Investigating.
Comment 8 Eric Botcazou 2006-09-12 21:48:48 UTC
Subject: Bug 28243

Author: ebotcazou
Date: Tue Sep 12 21:48:40 2006
New Revision: 116906

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116906
Log:
	PR rtl-optimization/28243
	* combine.c (distribute_notes) <REG_DEAD>: Do not consider SETs past
	the insn to which the note was originally attached.


Added:
    trunk/gcc/testsuite/gcc.dg/pr28243.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/combine.c
    trunk/gcc/testsuite/ChangeLog

Comment 9 Eric Botcazou 2006-09-12 21:49:53 UTC
Subject: Bug 28243

Author: ebotcazou
Date: Tue Sep 12 21:49:45 2006
New Revision: 116907

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116907
Log:
	PR rtl-optimization/28243
	* combine.c (distribute_notes) <REG_DEAD>: Do not consider SETs past
	the insn to which the note was originally attached.


Added:
    branches/gcc-4_1-branch/gcc/testsuite/gcc.dg/pr28243.c
Modified:
    branches/gcc-4_1-branch/gcc/ChangeLog
    branches/gcc-4_1-branch/gcc/combine.c
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog

Comment 10 Eric Botcazou 2006-09-12 21:54:24 UTC
Fixed in upcoming 4.1.2 release.