From: Richard Guenther Date: Thu, 2 Jun 2005 20:09:01 +0000 (+0000) Subject: c-typeck.c (build_indirect_ref): Build INDIRECT_REF with correct type. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=984dfd8c52a42e3e0ce4838ab77839c4abce4697;p=gcc.git c-typeck.c (build_indirect_ref): Build INDIRECT_REF with correct type. 2005-06-02 Richard Guenther * c-typeck.c (build_indirect_ref): Build INDIRECT_REF with correct type. * gcc.dg/wtypequal.c: New testcase. From-SVN: r100512 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 01fa616d522..530350c0fc0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2005-06-02 Richard Guenther + + * c-typeck.c (build_indirect_ref): Build INDIRECT_REF + with correct type. + 2005-06-02 Ulrich Weigand * config/s390/s390.c (s390_add_execute): Do not handle out-of-pool diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 00f701093ec..694eb696947 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -1638,12 +1638,9 @@ build_indirect_ref (tree ptr, const char *errorstring) else { tree t = TREE_TYPE (type); - tree mvt = t; tree ref; - if (TREE_CODE (mvt) != ARRAY_TYPE) - mvt = TYPE_MAIN_VARIANT (mvt); - ref = build1 (INDIRECT_REF, mvt, pointer); + ref = build1 (INDIRECT_REF, t, pointer); if (!COMPLETE_OR_VOID_TYPE_P (t) && TREE_CODE (t) != ARRAY_TYPE) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5d508e544ec..54647f001ef 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2005-06-02 Richard Guenther + + * gcc.dg/wtypequal.c: New testcase. + 2005-06-02 Diego Novillo PR 21582 diff --git a/gcc/testsuite/gcc.dg/wtypequal.c b/gcc/testsuite/gcc.dg/wtypequal.c new file mode 100644 index 00000000000..9a7189929d3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/wtypequal.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ + +int *__restrict *p; +void f(void) +{ + __typeof(*p) *q = p; /* { dg-bogus "discards qualifiers" } */ +}