public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "bangerth at dealii dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/33810] gcc 4.1.2 mangles results on x86_64 in bitfield operations
Date: Sun, 13 Jan 2008 06:51:00 -0000	[thread overview]
Message-ID: <20080113031024.30124.qmail@sourceware.org> (raw)
In-Reply-To: <bug-33810-12095@http.gcc.gnu.org/bugzilla/>



------- 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


  reply	other threads:[~2008-01-13  3:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-18 10:33 [Bug c++/33810] New: " satyaakam at yahoo dot co dot in
2008-01-13  6:51 ` bangerth at dealii dot org [this message]
2008-01-13 17:00 ` [Bug c++/33810] " 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080113031024.30124.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).