Commit c77935ee by Patrick Palka

re PR c/45584 (typeof with casting from const to non-const does not work properly)

2014-08-19  Patrick Palka  <ppalka@gcc.gnu.org>

	PR c/45584
	* c-typeck.c (build_c_cast): Do a conversion even when the
	TYPE_MAIN_VARIANTs are the same.

2014-08-19  Patrick Palka  <ppalka@gcc.gnu.org>

	PR c/45584
	* gcc.dg/pr13519-1.c: Adjust.

From-SVN: r214151
parent d2077030
2014-08-19 Patrick Palka <ppalka@gcc.gnu.org>
PR c/45584
* c-typeck.c (build_c_cast): Do a conversion even when the
TYPE_MAIN_VARIANTs are the same.
2014-08-19 Marek Polacek <polacek@redhat.com>
* c-decl.c (diagnose_mismatched_decls): Unconditionally call
......
......@@ -4947,6 +4947,9 @@ build_c_cast (location_t loc, tree type, tree expr)
|| TREE_CODE (type) == UNION_TYPE)
pedwarn (loc, OPT_Wpedantic,
"ISO C forbids casting nonscalar to the same type");
/* Convert to remove any qualifiers from VALUE's type. */
value = convert (type, value);
}
else if (TREE_CODE (type) == UNION_TYPE)
{
......
2014-08-19 Patrick Palka <ppalka@gcc.gnu.org>
PR c/45584
* gcc.dg/pr13519-1.c: Adjust.
2014-08-19 Mark Wielaard <mjw@redhat.com>
* gcc.dg/guality/const-volatile.c: Add `used' attribute to pi.
......@@ -7,7 +12,7 @@
PR debug/59051
* gcc.dg/guality/restrict.c: New test.
2014-07-03 Mark Wielaard <mjw@redhat.com>
2014-08-19 Mark Wielaard <mjw@redhat.com>
* lib/gcc-gdb-test.exp (gdb-test): Handle type:var for gdb ptype
matching. Catch '<unknown type in ' to recognize older gdb versions.
......
......@@ -14,9 +14,9 @@ void fn(void)
{ __typeof__(n) a1; a1=0; }
{ __typeof__(c) a2; a2=0; } /* { dg-error "read-only" "correct error" } */
{ __typeof__((int)n) a3; a3=0; }
{ __typeof__((int)c) a4; a4=0; } /* { dg-bogus "read-only" "bogus error" { xfail *-*-* } } */
{ __typeof__((const int)n) a5; a5=0; } /* { dg-error "read-only" "correct error" { xfail *-*-* } } */
{ __typeof__((const int)c) a6; a6=0; } /* { dg-error "read-only" "correct error" } */
{ __typeof__((int)c) a4; a4=0; } /* { dg-bogus "read-only" "bogus error" } */
{ __typeof__((const int)n) a5; a5=0; }
{ __typeof__((const int)c) a6; a6=0; }
{ __typeof__(0) a7; a7=0; }
{ __typeof__(1) a8; a8=0; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment