This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/33810] New: gcc 4.1.2 mangles results on x86_64 in bitfield operations
- From: "satyaakam at yahoo dot co dot in" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 Oct 2007 10:33:11 -0000
- Subject: [Bug c++/33810] New: gcc 4.1.2 mangles results on x86_64 in bitfield operations
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Run the test case on a x86_64 bit machine to see how gcc 4.1.2 mangles results
in under Linux
We have tested the test case using 3.2.3 Compiler on RHEL 3 on both 32 as well
as 64 bit OS it works well.
Compile the test case provided with the following steps
$gcc -g -I. -Wall -m64 -c bar.c
$g++ -g -I. -Wall -m64 -o foo foo.c bar.o
Actual results: once you run the program foo you will see the following result
foo: i is 3.
bar: i is 3221205968.
Expected results:
foo: i is 3.
bar: i is 3.
Additional info: Test Case follows
----- bar.h -----
typedef struct {
unsigned b1:16;
unsigned b2:16;
} foo;
#ifdef __cplusplus
extern "C"
{
#endif
foo bar(unsigned);
#ifdef __cplusplus
}
#endif
----- bar.c -----
#include <stdio.h>
#include <bar.h>
foo bar(unsigned i)
{
foo myfoo;
myfoo.b1=myfoo.b2=0;
printf("bar: i is %u.\n",i);
return(myfoo);
}
----- foo.c -----
#include <stdio.h>
#include <bar.h>
int main(void)
{
foo myfoo;
unsigned i = 3;
printf("foo: i is %u.\n",i);
myfoo = bar(i);
return 0;
}
--
Summary: gcc 4.1.2 mangles results on x86_64 in bitfield
operations
Product: gcc
Version: 4.1.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: satyaakam at yahoo dot co dot in
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33810