------- 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 via email to