re PR c++/31513 (Miscompilation of Function Passing Bit Field Value to Function)

PR c++/31513
	* call.c (convert_for_arg_passing): Convert bitfields to their
	declared types.
	PR c++/31513
	* g++.dg/expr/bitfield8.C: New test.

From-SVN: r123902
This commit is contained in:
Mark Mitchell
2007-04-16 23:28:21 +00:00
committed by Mark Mitchell
parent 78676653b2
commit e53ebec609
4 changed files with 36 additions and 0 deletions

View File

@@ -1,3 +1,9 @@
2007-04-16 Mark Mitchell <mark@codesourcery.com>
PR c++/31513
* call.c (convert_for_arg_passing): Convert bitfields to their
declared types.
2007-04-13 Jason Merrill <jason@redhat.com>
PR c++/31074

View File

@@ -4658,6 +4658,7 @@ type_passed_as (tree type)
tree
convert_for_arg_passing (tree type, tree val)
{
val = convert_bitfield_to_declared_type (val);
if (val == error_mark_node)
;
/* Pass classes with copy ctors by invisible reference. */

View File

@@ -1,3 +1,8 @@
2007-04-16 Mark Mitchell <mark@codesourcery.com>
PR c++/31513
* g++.dg/expr/bitfield8.C: New test.
2007-04-14 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR testsuite/31578

View File

@@ -0,0 +1,24 @@
// PR c++/31513
// { dg-do run }
extern "C" void abort();
struct tree_type {
unsigned int precision : 9;
};
void bork(unsigned int i) {
if (i != 7)
abort();
}
void foo(struct tree_type *t)
{
bork(t->precision);
}
int main() {
tree_type t;
t.precision = 7;
foo(&t);
}