public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/33810] New: gcc 4.1.2 mangles results on x86_64 in bitfield operations
@ 2007-10-18 10:33 satyaakam at yahoo dot co dot in
2008-01-13 6:51 ` [Bug c++/33810] " bangerth at dealii dot org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: satyaakam at yahoo dot co dot in @ 2007-10-18 10:33 UTC (permalink / raw)
To: gcc-bugs
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/33810] gcc 4.1.2 mangles results on x86_64 in bitfield operations
2007-10-18 10:33 [Bug c++/33810] New: gcc 4.1.2 mangles results on x86_64 in bitfield operations satyaakam at yahoo dot co dot in
@ 2008-01-13 6:51 ` bangerth at dealii dot org
2008-01-13 17:00 ` mmitchel at gcc dot gnu dot org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: bangerth at dealii dot org @ 2008-01-13 6:51 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from bangerth at dealii dot org 2008-01-13 03:10 -------
Confirmed. Here's a slightly simplified testcase:
-----------bar.h------------
typedef struct {
unsigned : 16;
unsigned : 16;
} foo;
-----------bar.c------------
#include <stdio.h>
#include <bar.h>
foo bar(unsigned i)
{
printf("bar: i is %u.\n",i);
foo myfoo;
return myfoo;
}
-------------foo.cc------------
#include <stdio.h>
#include <bar.h>
extern "C" foo bar(unsigned int);
int main(void)
{
foo myfoo;
unsigned i = 3;
printf("foo: i is %u.\n",i);
myfoo = bar(i);
return 0;
}
-------------------
tmp/g> gcc -I. -c bar.c
tmp/g> g++ -I. -o foo foo.c bar.o
tmp/g> ./foo
foo: i is 3.
bar: i is 1289971520.
Something appears to go wrong when calling the extern "C" function...
This is a wrong-code regression on valid code.
W.
--
bangerth at dealii dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bangerth at dealii dot org,
| |mmitchel at gcc dot gnu dot
| |org
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Keywords| |wrong-code
Last reconfirmed|0000-00-00 00:00:00 |2008-01-13 03:10:24
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33810
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/33810] gcc 4.1.2 mangles results on x86_64 in bitfield operations
2007-10-18 10:33 [Bug c++/33810] New: gcc 4.1.2 mangles results on x86_64 in bitfield operations satyaakam at yahoo dot co dot in
2008-01-13 6:51 ` [Bug c++/33810] " bangerth at dealii dot org
@ 2008-01-13 17:00 ` mmitchel at gcc dot gnu dot org
2008-01-13 18:23 ` [Bug c++/33810] [4.1 Regression] " rguenth at gcc dot gnu dot org
2008-07-04 16:16 ` jsm28 at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2008-01-13 17:00 UTC (permalink / raw)
To: gcc-bugs
--
mmitchel at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33810
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/33810] [4.1 Regression] gcc 4.1.2 mangles results on x86_64 in bitfield operations
2007-10-18 10:33 [Bug c++/33810] New: gcc 4.1.2 mangles results on x86_64 in bitfield operations satyaakam at yahoo dot co dot in
2008-01-13 6:51 ` [Bug c++/33810] " bangerth at dealii dot org
2008-01-13 17:00 ` mmitchel at gcc dot gnu dot org
@ 2008-01-13 18:23 ` rguenth at gcc dot gnu dot org
2008-07-04 16:16 ` jsm28 at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-01-13 18:23 UTC (permalink / raw)
To: gcc-bugs
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rguenth at gcc dot gnu dot
| |org
Known to fail| |4.1.3
Known to work| |3.3.6 4.2.3 4.3.0
Summary|gcc 4.1.2 mangles results on|[4.1 Regression] gcc 4.1.2
|x86_64 in bitfield |mangles results on x86_64 in
|operations |bitfield operations
Target Milestone|--- |4.1.3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33810
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/33810] [4.1 Regression] gcc 4.1.2 mangles results on x86_64 in bitfield operations
2007-10-18 10:33 [Bug c++/33810] New: gcc 4.1.2 mangles results on x86_64 in bitfield operations satyaakam at yahoo dot co dot in
` (2 preceding siblings ...)
2008-01-13 18:23 ` [Bug c++/33810] [4.1 Regression] " rguenth at gcc dot gnu dot org
@ 2008-07-04 16:16 ` jsm28 at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-07-04 16:16 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from jsm28 at gcc dot gnu dot org 2008-07-04 16:15 -------
Closing 4.1 branch.
--
jsm28 at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Target Milestone|4.1.3 |4.2.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33810
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-07-04 16:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-18 10:33 [Bug c++/33810] New: gcc 4.1.2 mangles results on x86_64 in bitfield operations satyaakam at yahoo dot co dot in
2008-01-13 6:51 ` [Bug c++/33810] " bangerth at dealii dot org
2008-01-13 17:00 ` mmitchel at gcc dot gnu dot org
2008-01-13 18:23 ` [Bug c++/33810] [4.1 Regression] " rguenth at gcc dot gnu dot org
2008-07-04 16:16 ` jsm28 at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).