From b4c33883987fe5c5a8022d02fa7579688d37b927 Mon Sep 17 00:00:00 2001 From: Andrew Pinski Date: Tue, 18 Jan 2005 17:52:33 +0000 Subject: [PATCH] re PR c/19472 (compiler internal error: in var_ann, at tree-flow-inline.h:34) 2005-01-18 Andrew Pinski PR c/19472 * semantics.c (finish_asm_stmt): Strip nops off input memory operands. 2005-01-18 Andrew Pinski PR C/19472 * c-typeck.c (build_asm_expr): Strip nops off input memory operands. 2005-01-18 Andrew Pinski PR C/19472 * gcc.dg/asm-a.c: New test. From-SVN: r93840 --- gcc/ChangeLog | 6 ++++++ gcc/c-typeck.c | 10 ++++++++-- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/semantics.c | 10 ++++++++-- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/asm-a.c | 14 ++++++++++++++ 6 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/asm-a.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 396f7ce96e4..0ca0d444afb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2005-01-18 Andrew Pinski + + PR C/19472 + * c-typeck.c (build_asm_expr): Strip nops off + input memory operands. + 2005-01-18 David Edelsohn * config/rs6000/aix43.h (CPLUSPLUS_CPP_SPEC): Delete diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 2b065023aa5..f26e3868813 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -6335,8 +6335,14 @@ build_asm_expr (tree string, tree outputs, tree inputs, tree clobbers, { /* If the operand is going to end up in memory, mark it addressable. */ - if (!allows_reg && allows_mem && !c_mark_addressable (input)) - input = error_mark_node; + if (!allows_reg && allows_mem) + { + /* Strip the nops as we allow this case. FIXME, this really + should be rejected or made deprecated. */ + STRIP_NOPS (input); + if (!c_mark_addressable (input)) + input = error_mark_node; + } } else input = error_mark_node; diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7301400fc5b..76e41b5e305 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2005-01-18 Andrew Pinski + + PR c/19472 + * semantics.c (finish_asm_stmt): Strip nops off + input memory operands. + 2005-01-18 Kazu Hirata * Make-lang.in, call.c, cvt.c, init.c, rtti.c, tree.c, diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index b34de199adb..2dc0cbb9ff0 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -1206,8 +1206,14 @@ finish_asm_stmt (int volatile_p, tree string, tree output_operands, { /* If the operand is going to end up in memory, mark it addressable. */ - if (!allows_reg && allows_mem && !cxx_mark_addressable (operand)) - operand = error_mark_node; + if (!allows_reg && allows_mem) + { + /* Strip the nops as we allow this case. FIXME, this really + should be rejected or made deprecated. */ + STRIP_NOPS (operand); + if (!cxx_mark_addressable (operand)) + operand = error_mark_node; + } } else operand = error_mark_node; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 634daa65a2b..aef18d056f6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-01-18 Andrew Pinski + + PR c/19472 + * gcc.dg/asm-a.c: New test. + 2005-01-18 Kaz Kojima * gcc.dg/sh-relax.c: Add prototype for abort. diff --git a/gcc/testsuite/gcc.dg/asm-a.c b/gcc/testsuite/gcc.dg/asm-a.c new file mode 100644 index 00000000000..aca2d4e59af --- /dev/null +++ b/gcc/testsuite/gcc.dg/asm-a.c @@ -0,0 +1,14 @@ +/* { dg-require-effective-target ilp32 } */ +/* { dg-options "-O2" } */ + +/* The problem was we were not striping the long cast here. + Note this really should be invalid code but not for the + current release (4.0) as we have people using it. */ + +void blockCopy_MMX2(int*); +void postProcess_MMX2() +{ + int c, x,y, width; + asm( "" :: "m" ((long)x)); + blockCopy_MMX2(&c); +} -- 2.30.2