mirror of git://gcc.gnu.org/git/gcc.git
re PR c++/61004 (Spurious warning: dereferencing type-punned pointer)
2014-06-05 Richard Biener <rguenther@suse.de> PR c++/61004 * typeck.c (cp_build_indirect_ref): Do not emit strict-aliasing warnings for accessing empty classes. * g++.dg/diagnostic/pr61004.C: New testcase. From-SVN: r211272
This commit is contained in:
parent
97826595b5
commit
5ae98e828d
|
|
@ -1,3 +1,9 @@
|
|||
2014-06-05 Richard Biener <rguenther@suse.de>
|
||||
|
||||
PR c++/61004
|
||||
* typeck.c (cp_build_indirect_ref): Do not emit strict-aliasing
|
||||
warnings for accessing empty classes.
|
||||
|
||||
2014-06-05 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
PR c/49706
|
||||
|
|
|
|||
|
|
@ -2935,8 +2935,9 @@ cp_build_indirect_ref (tree ptr, ref_operator errorstring,
|
|||
of the result is "T." */
|
||||
tree t = TREE_TYPE (type);
|
||||
|
||||
if (CONVERT_EXPR_P (ptr)
|
||||
|| TREE_CODE (ptr) == VIEW_CONVERT_EXPR)
|
||||
if ((CONVERT_EXPR_P (ptr)
|
||||
|| TREE_CODE (ptr) == VIEW_CONVERT_EXPR)
|
||||
&& (!CLASS_TYPE_P (t) || !CLASSTYPE_EMPTY_P (t)))
|
||||
{
|
||||
/* If a warning is issued, mark it to avoid duplicates from
|
||||
the backend. This only needs to be done at
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
2014-06-05 Richard Biener <rguenther@suse.de>
|
||||
|
||||
PR c++/61004
|
||||
* g++.dg/diagnostic/pr61004.C: New testcase.
|
||||
|
||||
2014-06-05 Yuri Rumyantsev <ysrumyan@gmail.com>
|
||||
|
||||
* gcc.dg/torture/pr61319.c: New test.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
// { dg-do compile }
|
||||
// { dg-options "-O2 -Wall" }
|
||||
|
||||
struct A{ };
|
||||
struct B:A{};
|
||||
void f(A const&);
|
||||
int main()
|
||||
{
|
||||
B b;
|
||||
f(b); // { dg-bogus "strict-aliasing" }
|
||||
}
|
||||
Loading…
Reference in New Issue