mirror of
https://gcc.gnu.org/git/gcc.git
synced 2026-02-22 12:00:03 -05:00
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:
committed by
Mark Mitchell
parent
78676653b2
commit
e53ebec609
@@ -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
|
||||
|
||||
@@ -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. */
|
||||
|
||||
@@ -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
|
||||
|
||||
24
gcc/testsuite/g++.dg/expr/bitfield8.C
Normal file
24
gcc/testsuite/g++.dg/expr/bitfield8.C
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user