re PR tree-optimization/29680 (Misscompilation of spec2006 gcc)

PR tree-optimization/29680
	* tree-ssa-operands.c (access_can_touch_variable): Revert fix for
	PR 14784.

	* gcc.dg/alias-11.c: New test.


Co-Authored-By: Zdenek Dvorak <dvorakz@suse.cz>

From-SVN: r118754
This commit is contained in:
H.J. Lu 2006-11-13 12:37:29 +00:00 committed by Zdenek Dvorak
parent 84816907e4
commit 5da10ac71f
4 changed files with 130 additions and 1 deletions

View File

@ -1,3 +1,10 @@
2006-11-13 H.J. Lu <hongjiu.lu@intel.com>
Zdenek Dvorak <dvorakz@suse.cz>
PR tree-optimization/29680
* tree-ssa-operands.c (access_can_touch_variable): Revert fix for
PR 14784.
2006-11-12 Jason Merrill <jason@redhat.com>
Andrew Pinski <pinskia@physics.uc.edu>

View File

@ -1,3 +1,9 @@
2006-11-12 H.J. Lu <hongjiu.lu@intel.com>
Zdenek Dvorak <dvorakz@suse.cz>
PR tree-optimization/29680
* gcc.dg/alias-11.c: New test.
2006-11-12 Roger Sayle <roger@eyesopen.com>
PR rtl-optimization/29797

View File

@ -0,0 +1,111 @@
/* { dg-do run } */
/* { dg-require-alias "" } */
/* { dg-options "-O2" } */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct dw_cfi_struct
{
struct dw_cfi_struct *dw_cfi_next;
const char *dw_cfi_addr;
}
dw_cfi_node;
typedef struct dw_fde_struct
{
const char *dw_fde_current_label;
dw_cfi_node *dw_fde_cfi;
}
dw_fde_node;
dw_cfi_node *cie_cfi_head;
unsigned fde_table_in_use;
dw_fde_node *fde_table;
__inline__ void
add_cfi (dw_cfi_node **list_head, dw_cfi_node *cfi)
{
dw_cfi_node **p;
for (p = list_head; (*p) != ((void *)0); p = &(*p)->dw_cfi_next)
;
*p = cfi;
}
__inline__ struct dw_cfi_struct *
new_cfi (void)
{
dw_cfi_node *cfi = (dw_cfi_node *) malloc (sizeof (dw_cfi_node));
memset (cfi, 0, sizeof (dw_cfi_node));
return cfi;
}
char *
dwarf2out_cfi_label (void)
{
static char label[20];
static unsigned long label_num = 0;
sprintf (label, "*.%s%u", "LCFI", (unsigned) (label_num++));
return label;
}
void
add_fde_cfi (const char *label, dw_cfi_node *cfi)
{
if (label)
{
dw_fde_node *fde = fde_table + fde_table_in_use - 1;
if (*label == 0)
label = dwarf2out_cfi_label ();
if (fde->dw_fde_current_label == ((void *)0)
|| strcmp (label, fde->dw_fde_current_label))
{
dw_cfi_node *xcfi;
fde->dw_fde_current_label = label = strdup (label);
xcfi = new_cfi ();
xcfi->dw_cfi_addr = label;
add_cfi (&fde->dw_fde_cfi, xcfi);
}
add_cfi (&fde->dw_fde_cfi, cfi);
}
else
add_cfi (&cie_cfi_head, cfi);
}
int
main ()
{
dw_cfi_node *cfi;
dw_fde_node *fde;
fde_table_in_use = 1;
fde_table = (dw_fde_node *) realloc (fde_table,
sizeof (dw_fde_node));
memset (fde_table, 0, sizeof (dw_fde_node));
cfi = new_cfi ();
add_fde_cfi ("", cfi);
fde = &fde_table[0];
cfi = fde->dw_fde_cfi;
if (cfi == NULL)
abort ();
if (cfi->dw_cfi_addr == NULL)
abort ();
if (strcmp ("*.LCFI0", cfi->dw_cfi_addr))
abort ();
return 0;
}

View File

@ -1151,11 +1151,16 @@ access_can_touch_variable (tree ref, tree alias, HOST_WIDE_INT offset,
&& flag_strict_aliasing
&& TREE_CODE (ref) != INDIRECT_REF
&& !MTAG_P (alias)
&& !var_ann (alias)->is_heapvar
&& (TREE_CODE (base) != INDIRECT_REF
|| TREE_CODE (TREE_TYPE (base)) != UNION_TYPE)
&& !AGGREGATE_TYPE_P (TREE_TYPE (alias))
&& TREE_CODE (TREE_TYPE (alias)) != COMPLEX_TYPE
#if 0
/* FIXME: PR tree-optimization/29680. */
&& !var_ann (alias)->is_heapvar
#else
&& !POINTER_TYPE_P (TREE_TYPE (alias))
#endif
/* When the struct has may_alias attached to it, we need not to
return true. */
&& get_alias_set (base))