Commit 431ed7a1 by Mark Mitchell Committed by Mark Mitchell

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: r123939
parent 50f324bb
2007-04-17 Mark Mitchell <mark@codesourcery.com>
PR c++/31513
* call.c (convert_for_arg_passing): Convert bitfields to their
declared types.
2007-04-17 Simon Martin <simartin@users.sourceforge.net>
PR c++/31517
......
......@@ -4713,6 +4713,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. */
......
2007-04-17 Mark Mitchell <mark@codesourcery.com>
PR c++/31513
* g++.dg/expr/bitfield8.C: New test.
2007-04-17 Joseph Myers <joseph@codesourcery.com>
Richard Sandiford <richard@codesourcery.com>
// 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);
}
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