diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d160c8d26d9..47ac043c0d4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2009-07-15 Richard Guenther + + PR middle-end/40753 + * alias.c (ao_ref_from_mem): Reject FUNCTION_DECL and LABEL_DECL + bases. + 2009-07-15 Maxim Kuvyrkov * config/m68k/linux-unwind.h (m68k_fallback_frame_state): Update to diff --git a/gcc/alias.c b/gcc/alias.c index e9cc2d85f96..fc259b8ef2d 100644 --- a/gcc/alias.c +++ b/gcc/alias.c @@ -279,6 +279,11 @@ ao_ref_from_mem (ao_ref *ref, const_rtx mem) && TREE_CODE (TREE_OPERAND (base, 0)) != SSA_NAME) return false; + /* The tree oracle doesn't like to have these. */ + if (TREE_CODE (base) == FUNCTION_DECL + || TREE_CODE (base) == LABEL_DECL) + return false; + /* If this is a reference based on a partitioned decl replace the base with an INDIRECT_REF of the pointer representative we created during stack slot partitioning. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4dc08012919..e58a25b8822 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-07-15 Richard Guenther + + PR middle-end/40753 + * gcc.c-torture/compile/pr40753.c: New testcase. + 2009-07-15 Janus Weil PR fortran/40743 diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40753.c b/gcc/testsuite/gcc.c-torture/compile/pr40753.c new file mode 100644 index 00000000000..507303dac72 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40753.c @@ -0,0 +1,20 @@ +typedef struct { + unsigned nargs; +} ffi_cif; +typedef struct { + char tramp[24]; + ffi_cif *cif; +} ffi_closure; +extern void *memcpy (void *, const void *, __SIZE_TYPE__); +extern void ffi_closure_LINUX64 (void); + +int +ffi_prep_closure_loc (ffi_closure *closure, ffi_cif *cif) +{ + void **tramp = (void **) &closure->tramp[0]; + + memcpy (tramp, (char *) ffi_closure_LINUX64, 16); + closure->cif = cif; + + return 0; +}