re PR tree-optimization/61437 (wrong code on x86_64-linux-gnu when compile separately)

2014-06-11  Richard Biener  <rguenther@suse.de>

	PR middle-end/61437
	Revert
	2014-06-04  Richard Biener  <rguenther@suse.de>

	* tree.h (may_be_aliased): Trust TREE_ADDRESSABLE from
	TREE_PUBLIC and DECL_EXTERNAL decls.

	* gcc.dg/torture/20140610-1.c: New testcase.
	* gcc.dg/torture/20140610-2.c: Likewise.

From-SVN: r211436
This commit is contained in:
Richard Biener 2014-06-11 07:35:36 +00:00
parent e257a17cb9
commit 96a3f4dfb6
5 changed files with 47 additions and 2 deletions

View File

@ -1,3 +1,12 @@
2014-06-11 Richard Biener <rguenther@suse.de>
PR middle-end/61437
Revert
2014-06-04 Richard Biener <rguenther@suse.de>
* tree.h (may_be_aliased): Trust TREE_ADDRESSABLE from
TREE_PUBLIC and DECL_EXTERNAL decls.
2014-06-10 Jan Hubicka <hubicka@ucw.cz>
* varasm.c (set_implicit_section): New function.
@ -7,7 +16,8 @@
(default_function_section): Likewise.
(decl_binds_to_current_def_p): Constify argument.
* varasm.h (decl_binds_to_current_def_p): Update prototype.
* asan.c (asan_protect_global): Use symtab_get_node (decl)->implicit_section.
* asan.c (asan_protect_global): Use
symtab_get_node (decl)->implicit_section.
* symtab.c (dump_symtab_base): Dump implicit sections.
(verify_symtab_base): Verify sanity of sectoins and comdats.
(symtab_resolve_alias): Alias share the section of its target.

View File

@ -1,3 +1,9 @@
2014-06-11 Richard Biener <rguenther@suse.de>
PR middle-end/61437
* gcc.dg/torture/20140610-1.c: New testcase.
* gcc.dg/torture/20140610-2.c: Likewise.
2014-06-10 Richard Biener <rguenther@suse.de>
PR tree-optimization/61438

View File

@ -0,0 +1,15 @@
/* { dg-do run } */
/* { dg-additional-sources "20140610-2.c" } */
extern int a;
extern int *p;
void test (void);
int main ()
{
*p = 0;
a = 1;
test ();
return 0;
}

View File

@ -0,0 +1,12 @@
/* { dg-do compile } */
extern void abort (void);
int a;
int *p = &a;
void test (void)
{
if (a != 1)
abort ();
}

View File

@ -4524,7 +4524,9 @@ static inline bool
may_be_aliased (const_tree var)
{
return (TREE_CODE (var) != CONST_DECL
&& TREE_ADDRESSABLE (var)
&& (TREE_PUBLIC (var)
|| DECL_EXTERNAL (var)
|| TREE_ADDRESSABLE (var))
&& !((TREE_STATIC (var) || TREE_PUBLIC (var) || DECL_EXTERNAL (var))
&& ((TREE_READONLY (var)
&& !TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (var)))