Bug 22368 - [meta-bug] mis-match types in GCC
: [meta-bug] mis-match types in GCC
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: other
: 4.1.0
: P2 normal
: ---
Assigned To: Not yet assigned to anyone
:
: meta-bug
: 21840 22328 22329 22335 22356 22358 22369 22370 22371 22372 22373 22374 22375 22381 22383 22398 22418 22419 22420 22434 22451 22460 22474 22487 22494 22524 22525 22526 22527 23145 23166 23314 23315 23347 23794 23960 24868 25269 25270 26307 28713 28721 28722 28723 28724 28814 30744 31608 32152 32780 32882 32935
: 23329
  Show dependency treegraph
 
Reported: 2005-07-08 15:21 UTC by Andrew Pinski
Modified: 2012-01-13 06:08 UTC (History)
6 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2007-07-13 15:56:51


Attachments
catch mismatch in MODIFY_EXPR (903 bytes, patch)
2005-07-08 15:34 UTC, Andrew Pinski
Details | Diff
catch mismatch in comparisons (927 bytes, patch)
2005-07-14 01:15 UTC, Andrew Pinski
Details | Diff
catch mismatch in some unary trees (1.18 KB, patch)
2005-07-17 17:43 UTC, Andrew Pinski
Details | Diff
catch mismatch in PHIs (1008 bytes, patch)
2005-07-31 17:06 UTC, Andrew Pinski
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Pinski 2005-07-08 15:21:47 UTC
This is a meta bug for all of the mis-match type bugs in GCC.
Comment 1 Andrew Pinski 2005-07-08 15:34:36 UTC
Created attachment 9229 [details]
catch mismatch in MODIFY_EXPR
Comment 2 Andrew Pinski 2005-07-12 17:04:09 UTC
I should note that you can now bootstrap C with the patch.  But still some
testsuite regressions in the 
testsuite which have been filed already.
Comment 3 Andrew Pinski 2005-07-12 17:25:20 UTC
(In reply to comment #2)
> I should note that you can now bootstrap C with the patch.  But still some testsuite regressions in the 
> testsuite which have been filed already.

With the patch in PR 22358 we can now bootstrap with C++ enabled too.  Though there are many 
regressions which have been filed except for failing to compile testsuite_abi.cc which have not been 
filed/reduced yet but that might not be a C++ specific problem:
/Users/pinskia/src/local/gcc/objdir/powerpc-apple-darwin7.9.0/libstdc++-v3/include/ext/
hashtable.h:793: error: statement types mismatch^M
D.45260_261 = __pD.71381_212;^M
^M
struct pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> 
>,symbol>D.39168 &^M
voidD.34 *^M
/Users/pinskia/src/local/gcc/objdir/powerpc-apple-darwin7.9.0/libstdc++-v3/include/ext/
hashtable.h:793: internal compiler error: verify_stmts failed^M
Please submit a full bug report,^M
with preprocessed source if appropriate.^M
See <URL:http://gcc.gnu.org/bugs.html> for instructions.^M
Comment 4 Andrew Pinski 2005-07-12 17:33:24 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > I should note that you can now bootstrap C with the patch.  But still some testsuite regressions in 
the 
> > testsuite which have been filed already.
> 
> With the patch in PR 22358 we can now bootstrap with C++ enabled too.  Though there are many 
> regressions which have been filed except for failing to compile testsuite_abi.cc which have not been 
> filed/reduced yet but that might not be a C++ specific problem:
yes this is the same as PR 21840.
Comment 5 Andrew Pinski 2005-07-13 14:16:28 UTC
Note fixing all of these issues and we can remove the "hack" in
may_propagate_copy which right now 
says:
  /* FIXME.  GIMPLE is allowing pointer assignments and comparisons of
     pointers that have different alias sets.  This means that these
     pointers will have different memory tags associated to them.

     If we allow copy propagation in these cases, statements de-referencing
     the new pointer will now have a reference to a different memory tag
     with potentially incorrect SSA information.

     This was showing up in libjava/java/util/zip/ZipFile.java with code
     like:

        struct java.io.BufferedInputStream *T.660;
        struct java.io.BufferedInputStream *T.647;
        struct java.io.InputStream *is;
        struct java.io.InputStream *is.662;
        [ ... ]
        T.660 = T.647;
        is = T.660;     <-- This ought to be type-casted
        is.662 = is;

     Also, f/name.c exposed a similar problem with a COND_EXPR predicate
     that was causing DOM to generate and equivalence with two pointers of
     alias-incompatible types:

        struct _ffename_space *n;
        struct _ffename *ns; 
        [ ... ]
        if (n == ns)
          goto lab;
        ...
        lab:
        return n;

     I think that GIMPLE should emit the appropriate type-casts.  For the
     time being, blocking copy-propagation in these cases is the safe thing
     to do.  */
Comment 6 Andrew Pinski 2005-07-13 14:19:06 UTC
Note I think I already fixed the DOM problem in PR 22335.
Comment 7 Andrew Pinski 2005-07-13 20:06:40 UTC
Even though PR 22398 is not caught by my patch it is caught later by VRP.  I
will add a patch to catch 
mismatch in comparisons.
Comment 8 Andrew Pinski 2005-07-14 01:15:49 UTC
Created attachment 9265 [details]
catch mismatch in comparisons

The patch which catches mismatch in comparisons.
Comment 9 Andrew Pinski 2005-07-17 17:33:53 UTC
Note the comparisions patch because of the way gimple removes casts to void*
gets:
int f(int *a, char*b)
{
  return ((void*)a) == ((void*)b);
}

wrong.
The following is also effected:
g++.dg/abi/vbase13.C:
g++.dg/expr/cond1.C
g++.old-deja/g++.abi/primary.C

I have to figure out how to handle that.  Maybe in
tree_ssa_useless_type_conversion_1 remove the 
special case for void*.
Comment 10 Andrew Pinski 2005-07-17 17:43:35 UTC
Created attachment 9294 [details]
catch mismatch in some unary trees
Comment 11 Andrew Pinski 2005-07-31 17:06:59 UTC
Created attachment 9396 [details]
catch mismatch in PHIs

This patch detects mismatch types in PHI_NODEs which can be used with the one
which catches the one in MODIFY_EXPR as some PHIs get moved to MODIFY_EXPR.
Comment 12 Andrew Pinski 2005-08-11 17:06:38 UTC
(In reply to comment #6)
> Note I think I already fixed the DOM problem in PR 22335.

And now the java front-end bug has been fixed, maybe I should go ahead and test a patch to remove 
the hack from may_propagate_copy.

I also filed PR 23329 for the removal of the hack.
Comment 13 Andrew Pinski 2006-08-14 19:14:05 UTC
(In reply to comment #9)
> Note the comparisions patch because of the way gimple removes casts to void*
> gets:
That gets fixed automatically by:
http://gcc.gnu.org/ml/gcc-patches/2006-06/msg00179.html
Comment 14 Francois-Xavier Coudert 2007-05-25 13:55:32 UTC
Rev. 124497 of mainline fails to bootstrap with these patches on i686-linux:

[during stage2]
../../../trunk3/gcc/df-scan.c: In function ‘df_ref_record’:
../../../trunk3/gcc/df-scan.c:1057: error: types mismatch in comparsion
long unsigned int

int

shifttmp.1580_150 == 0;

../../../trunk3/gcc/df-scan.c:1057: internal compiler error: verify_stmts
failed

Debugging this error yields:

Breakpoint 5, verify_expr (tp=0xb70f1b5c, walk_subtrees=0xbfa475f0, data=0x0)
    at ../../../trunk3/gcc/tree-cfg.c:3298
3298                error ("types mismatch in comparsion");
(gdb) p debug_tree(lhs)
 <ssa_name 0xb73e498c
    type <integer_type 0xb7bf1438 long unsigned int sizes-gimplified
asm_written public unsigned SI
        size <integer_cst 0xb7be1658 constant invariant 32>
        unit size <integer_cst 0xb7be1444 constant invariant 4>
        align 32 symtab -1211504504 alias set -1 canonical type 0xb7bf1438
precision 32 min <integer_cst 0xb7be16e4 0> max <integer_cst 0xb7be16c8
4294967295>
        pointer_to_this <pointer_type 0xb7a82a8c>>
    var <var_decl 0xb7b3d284 shifttmp.1580> def_stmt <gimple_modify_stmt
0xb7387214>
    version 150>
$1 = void
(gdb) p debug_tree(rhs)
 <integer_cst 0xb7be1c40 type <integer_type 0xb7bf12f4 int> constant invariant
0>
$2 = void
Comment 15 Richard Guenther 2007-07-13 15:56:51 UTC
http://gcc.gnu.org/ml/gcc-patches/2007-07/msg01265.html

has some fixes for some of this PRs and a verifier.  So while we're working
on this, this is my bug.
Comment 16 Richard Guenther 2007-08-24 15:57:13 UTC
"Finished", so unassigning.
Comment 17 Francois-Xavier Coudert 2007-11-02 14:16:15 UTC
I was willing to check the current state of the Fortran failures (PR28722). I
have thus applied these patches to current trunk, and bootstrap fails due to:

$ cat foo.i
char * getc_unlocked (char *foo) { return foo++; }
$ ../prev-gcc/cc1 -fpreprocessed foo.i -quiet
foo.i: In function ‘getc_unlocked’:
foo.i:1:1: error: types mismatch in comparsion
char *

long unsigned int

foo + 1;

foo.i:1:1: internal compiler error: verify_stmts failed


(In the patches, tree_ssa_useless_type_conversion_1 needs to be changed into
useless_type_conversion_p)
Comment 18 rguenther@suse.de 2007-11-02 14:22:14 UTC
Subject: Re:  [meta-bug] mis-match types in GCC

On Fri, 2 Nov 2007, fxcoudert at gcc dot gnu dot org wrote:

> ------- Comment #17 from fxcoudert at gcc dot gnu dot org  2007-11-02 14:16 -------
> I was willing to check the current state of the Fortran failures (PR28722). I
> have thus applied these patches to current trunk, and bootstrap fails due to:
> 
> $ cat foo.i
> char * getc_unlocked (char *foo) { return foo++; }
> $ ../prev-gcc/cc1 -fpreprocessed foo.i -quiet
> foo.i: In function ‘getc_unlocked’:
> foo.i:1:1: error: types mismatch in comparsion
> char *
> 
> long unsigned int
> 
> foo + 1;
> 
> foo.i:1:1: internal compiler error: verify_stmts failed
> 
> 
> (In the patches, tree_ssa_useless_type_conversion_1 needs to be changed into
> useless_type_conversion_p)

I think all these patches are way out-of-date.  If the fortran FE still
produces mismatched trees (as PR28722 suggests), those should be catched
by --enable-checking=yes,types.

Richard.
Comment 19 Andrew Pinski 2012-01-13 06:08:30 UTC
All bugs have been closed as fixed, so closing this meta-bug as we have
checking now.