[PATCH] Fix PR66110
Richard Biener
rguenther@suse.de
Tue May 12 13:50:00 GMT 2015
The following patch fixes PR66110 - there is no reason why two alias-sets
conflict just because one or the other has a child with alias-set zero.
We need to paper over strict-aliasing bugs in dfp.c (re-using
struct real_value unsigned long sig[] as decimal128) by adding
-Wno-strict-aliasing, otherwise bootstrap with -Werror fails.
Bootstrapped and tested on x86_64-unknown-linux-gnu (with
--disable-werror, now re-trying with just the dfp.c issue workaround).
I intent to commit this if that succeeds.
Thanks,
Richard.
2015-05-12 Richard Biener <rguenther@suse.de>
PR middle-end/66110
* alias.c (alias_sets_conflict_p): Do not treat has_zero_child
specially.
* Makefile.in (dfp.o-warn): Add -Wno-strict-aliasing.
* gcc.dg/alias-2.c: Adjust.
Index: gcc/alias.c
===================================================================
--- gcc/alias.c (revision 223032)
+++ gcc/alias.c (working copy)
@@ -470,15 +470,13 @@ alias_sets_conflict_p (alias_set_type se
/* See if the first alias set is a subset of the second. */
ase = get_alias_set_entry (set1);
if (ase != 0
- && (ase->has_zero_child
- || ase->children->get (set2)))
+ && ase->children->get (set2))
return 1;
/* Now do the same, but with the alias sets reversed. */
ase = get_alias_set_entry (set2);
if (ase != 0
- && (ase->has_zero_child
- || ase->children->get (set1)))
+ && ase->children->get (set1))
return 1;
/* The two alias sets are distinct and neither one is the
Index: gcc/Makefile.in
===================================================================
--- gcc/Makefile.in (revision 223032)
+++ gcc/Makefile.in (working copy)
@@ -211,6 +211,7 @@ libgcov-driver-tool.o-warn = -Wno-error
libgcov-merge-tool.o-warn = -Wno-error
gimple-match.o-warn = -Wno-unused
generic-match.o-warn = -Wno-unused
+dfp.o-warn = -Wno-strict-aliasing
# All warnings have to be shut off in stage1 if the compiler used then
# isn't gcc; configure determines that. WARN_CFLAGS will be either
Index: gcc/testsuite/gcc.dg/alias-2.c
===================================================================
--- gcc/testsuite/gcc.dg/alias-2.c (revision 223032)
+++ gcc/testsuite/gcc.dg/alias-2.c (working copy)
@@ -11,6 +11,6 @@ struct foo {
int
sub1 (long long int foobar)
{
- struct foo *tmp = (struct foo *) &foobar; // { dg-warning "type-punned pointer might" "" }
+ struct foo *tmp = (struct foo *) &foobar; // { dg-warning "type-punned pointer will" "" }
return tmp->i;
}
More information about the Gcc-patches
mailing list