RFA: how to fix Heisenbug

Dale Johannesen dalej@apple.com
Wed Dec 22 01:16:00 GMT 2004

I have a heisenbug that shows up as a crash in avail_expr_eq in
the dominator optimizer; but the problem is lower down.  The
basic problem is that there are two statements like this:

#   VUSE <TMT.1588_358>;
D.68153_962 = __builtin_strlen (s_356);

#   VUSE <TMT.1588_358>;
D.68154_963 = strlen (s_356);

A hash value is computed using iterative_hash_expr; this
hashes in the pointer value of the callee function_decls, and
computes different hashes for the statements,   The hash values are
compared later using operand_equal_p, which has code
to consider these the same:

     case tcc_declaration:
       /* Consider __builtin_sqrt equal to sqrt.  */

The header comment for iterative_hash_expr says

    This function is intended to produce the same hash for expressions 
    would compare equal using operand_equal_p.  */

Not this time.

The obvious fix is to remove the code shown from operand_equal_p,
but I thought I'd ask for advice at this point.

Since the hash involves pointers, and there is a problem only
if both hashes land in the same bucket, there's no way to make a
reproducible example (in fact, the crash comes and goes
depending on what options I use to build the compiler).

More information about the Gcc mailing list