I just tried to compile the Suse Linux package fontconfig-2.4.2-83 with the GNU C compiler version 4.4 snapshot 20080502 The compiler said fccharset.c:1174: internal compiler error: in compare_values_warnv, at tree-vrp.c:892 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. Preprocessed source code attached. Flag -O3 required.
Created attachment 15591 [details] C source code
This worked with 20080325.
gcc_assert (POINTER_TYPE_P (TREE_TYPE (val1)) == POINTER_TYPE_P (TREE_TYPE (val2))); :)
Reducing.
# prephitmp.1564_417 = PHI <prephitmp.1561_268(20), pretmp.1563_427(4)> long unsigned int pretmp.1563; prephitmp.1561 is a pointer.
Created attachment 15614 [details] somehwat reduced testcase It's probably PPRE that messes up (-O3 -fno-tree-pre is fine, -O2 -finline-functions as well).
Better reduced testcase: typedef unsigned long int uintptr_t; typedef struct _FcCharLeaf { } FcCharLeaf; struct _FcCharLeafEnt { unsigned int hash; int leaf; }; struct _FcCharSetFreezer { int orig_hash_table[67]; }; struct _FcCharLeafEnt *ent; int a, f(FcCharLeaf * ); void FcCharSetFreeze (struct _FcCharSetFreezer *freezer, int *fcs) { int i; for (i = 0; i < *fcs; i++) { FcCharLeaf *leaf = (FcCharLeaf *)fcs; unsigned int hash = f (leaf); if (ent->hash == hash) a = ent->leaf; if (!a) return; } freezer->orig_hash_table[((uintptr_t) fcs) & 67] = 0; } PRE is creating the mismatched PHI nodes.
More reduced: int f(float * ); __SIZE_TYPE__ FcCharSetFreeze (int *fcs, int b) { int i; int a = 0; for (i = 0; i < *fcs; i++) { float *leaf = (float *)fcs; int hash = f (leaf); if (hash) a = b; if (!a) return; } return (__SIZE_TYPE__) fcs; }
PA_IN/OUT computes different for s/(unsigned long)/(long)/ in the following testcase (long works): int f(float * ); unsigned long FcCharSetFreeze (int *fcs, int b) { int i; int a = 0; for (i = 0; i < *fcs; i++) { float *leaf = (float *)fcs; int hash = f (leaf); if (hash) a = b; if (!a) return; } return (unsigned long) fcs; }
operand_equal_p returns true for (float *) VH.11 and (long unsigned int) VH.11.
I have a patch.
Subject: Bug 36172 Author: rguenth Date: Thu May 8 08:19:16 2008 New Revision: 135070 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=135070 Log: 2008-05-08 Richard Guenther <rguenther@suse.de> PR middle-end/36172 * fold-const.c (operand_equal_p): Two objects which types differ in pointerness are not equal. * gcc.c-torture/compile/pr36172.c: New testcase. Added: trunk/gcc/testsuite/gcc.c-torture/compile/pr36172.c Modified: trunk/gcc/ChangeLog trunk/gcc/fold-const.c trunk/gcc/testsuite/ChangeLog
Subject: Bug 36172 Author: rguenth Date: Thu May 8 08:23:59 2008 New Revision: 135072 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=135072 Log: 2008-05-08 Richard Guenther <rguenther@suse.de> PR middle-end/36154 * tree-ssa-structalias.c (push_fields_onto_fieldstack): Make sure to create a representative for trailing arrays for PTA. * gcc.c-torture/compile/pr36154.c: New testcase. 2008-05-08 Richard Guenther <rguenther@suse.de> PR middle-end/36172 * fold-const.c (operand_equal_p): Two objects which types differ in pointerness are not equal. * gcc.c-torture/compile/pr36172.c: New testcase. Added: branches/gcc-4_3-branch/gcc/testsuite/gcc.c-torture/compile/pr36154.c - copied unchanged from r135071, trunk/gcc/testsuite/gcc.c-torture/compile/pr36154.c branches/gcc-4_3-branch/gcc/testsuite/gcc.c-torture/compile/pr36172.c - copied unchanged from r135071, trunk/gcc/testsuite/gcc.c-torture/compile/pr36172.c Modified: branches/gcc-4_3-branch/gcc/ChangeLog branches/gcc-4_3-branch/gcc/fold-const.c branches/gcc-4_3-branch/gcc/testsuite/ChangeLog branches/gcc-4_3-branch/gcc/tree-ssa-structalias.c
Fixed.