Here's what the alias-7.c test looks like, after preprocessing: > int foo __asm__ ("_" "foo") __attribute__((nocommon)); > extern __typeof (foo) bar __attribute__ ((weak, alias ("foo"))); > > int > main (void) > { > if (&foo != &bar || foo || bar) > abort (); > return bar; > }
But here's how it compiles down using 4.5.0 on i686-pc-cygwin: > alias-7.c.003t.original: > ;; Function main (null) > ;; enabled by -tree-original > > > { > if (1) > { > abort (); > } > return bar; > } I've established that fold_comparison is returning (integer_cst 1) for the "&foo != &bar" test. In this clause, > /* For non-equal bases we can simplify if they are addresses > of local binding decls or constants. */ > else if (indirect_base0 && indirect_base1 > /* We know that !operand_equal_p (base0, base1, 0) > because the if condition was false. But make > sure two decls are not the same. */ > && base0 != base1 > && TREE_CODE (arg0) == ADDR_EXPR > && TREE_CODE (arg1) == ADDR_EXPR > && (((TREE_CODE (base0) == VAR_DECL > || TREE_CODE (base0) == PARM_DECL) > && (targetm.binds_local_p (base0) > || CONSTANT_CLASS_P (base1))) > || CONSTANT_CLASS_P (base0)) > && (((TREE_CODE (base1) == VAR_DECL > || TREE_CODE (base1) == PARM_DECL) > && (targetm.binds_local_p (base1) > || CONSTANT_CLASS_P (base0))) > || CONSTANT_CLASS_P (base1))) > { > if (code == EQ_EXPR) > return omit_two_operands_loc (loc, type, boolean_false_node, > arg0, arg1); > else if (code == NE_EXPR) > return omit_two_operands_loc (loc, type, boolean_true_node, > arg0, arg1); > } it seems that i386_pe_binds_local_p is incorrectly returning true even for the weak symbol. I have a patch. -- Summary: FAIL: gcc.dg/alias-7.c execution test Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: davek at gcc dot gnu dot org ReportedBy: davek at gcc dot gnu dot org GCC build triplet: i686-pc-cygwin GCC host triplet: i686-pc-cygwin GCC target triplet: i686-pc-cygwin http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43888