System type: Microsoft Windows 2000 [Version 5.00.2195]

Sources file for reproducing the bug:
========= main.cpp (begin) =========
extern "C" void __cdecl _assert (const char*, const char*, int);
#define assert(e)       ((e) ? (void)0 : _assert(#e, __FILE__, __LINE__))

struct st_t {
    int m_i;
    char m_ch[260];
};

void foo(int *pInt, struct st_t st)
{
    assert(*pInt == 123);
}

int main()
{
    int i = 123;

    struct st_t st;
    st.m_i = 1;
    st.m_ch[0] = 0;

    foo(&i, st);
    return 0;
}
========= main.cpp (end) =========

Error output when execute the object file(a.exe):
========= error (begin) ===========
Assertion failed: *pInt == 123, file main.cpp, line 11

abnormal program termination
========= error (end) ===========

The command line and other information:
========== compile information (begin) ============
>gcc -v -save-temps -march=i386 -mrtd main.cpp
Reading specs from 
D:/Elastos/extern/gnuSDK.x86/bin/../lib/gcc/mingw32/3.4.4/specs
Configured with: ../gcc/configure --with-gcc --with-gnu-ld --with-gnu-as --
host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls --
enable-languages=c,c++,f77,ada,objc,java --disable-win32-registry --disable-
shared --enable-sjlj-exceptions --enable-libgcj --disable-java-awt --without-x -
-enable-java-gc=boehm --disable-libgcj-debug --enable-interpreter --enable-hash-
synchronization --enable-libstdcxx-debug
Thread model: win32
gcc version 3.4.4 (mingw special)
 D:/Elastos/extern/gnuSDK.x86/bin/../libexec/gcc/mingw32/3.4.4/cc1plus.exe -E -
quiet -v -iprefix D:\Elastos\extern\gnuSDK.x86\bin/../lib/gcc/mingw32/3.4.4/ 
main.cpp -march=i386 -mrtd -o main.ii
ignoring nonexistent 
directory "D:/Elastos/extern/gnuSDK.x86/bin/../lib/gcc/mingw32/3.4.4/../../../..
/mingw32/include"
ignoring nonexistent 
directory "/mingw/lib/gcc/mingw32/../../../include/c++/3.4.4"
ignoring nonexistent 
directory "/mingw/lib/gcc/mingw32/../../../include/c++/3.4.4/mingw32"
ignoring nonexistent 
directory "/mingw/lib/gcc/mingw32/../../../include/c++/3.4.4/backward"
ignoring nonexistent directory "/mingw/lib/gcc/mingw32/3.4.4/include"
ignoring nonexistent directory "/mingw/lib/gcc/mingw32/../../../mingw32/include"
#include "..." search starts here:
#include <...> search starts here:
 
D:/Elastos/extern/gnuSDK.x86/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c+
+/3.4.4
 
D:/Elastos/extern/gnuSDK.x86/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c+
+/3.4.4/mingw32
 
D:/Elastos/extern/gnuSDK.x86/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c+
+/3.4.4/backward
 D:/Elastos/extern/gnuSDK.x86/bin/../lib/gcc/mingw32/3.4.4/../../../../include
 D:/Elastos/extern/gnuSDK.x86/bin/../lib/gcc/mingw32/3.4.4/include
 /mingw/lib/gcc/mingw32/../../../include
 /mingw/include
 /mingw/include
End of search list.
 D:/Elastos/extern/gnuSDK.x86/bin/../libexec/gcc/mingw32/3.4.4/cc1plus.exe -
fpreprocessed main.ii -quiet -dumpbase main.cpp -march=i386 -mrtd -auxbase 
main -version -o main.s
GNU C++ version 3.4.4 (mingw special) (mingw32)
        compiled by GNU C version 3.4.4.
GGC heuristics: --param ggc-min-expand=47 --param ggc-min-heapsize=32614
 
D:/Elastos/extern/gnuSDK.x86/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/bi
n/as.exe -o main.o main.s
 D:/Elastos/extern/gnuSDK.x86/bin/../libexec/gcc/mingw32/3.4.4/collect2.exe -
Bdynamic /mingw/lib/crt2.o 
D:/Elastos/extern/gnuSDK.x86/bin/../lib/gcc/mingw32/3.4.4/crtbegin.o -
LD:/Elastos/extern/gnuSDK.x86/bin/../lib/gcc/mingw32/3.4.4 -
LD:/Elastos/extern/gnuSDK.x86/bin/../lib/gcc -
LD:/Elastos/extern/gnuSDK.x86/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/l
ib -L/mingw/lib/gcc/mingw32/../../../mingw32/lib -L/mingw/lib -
LD:/Elastos/extern/gnuSDK.x86/bin/../lib/gcc/mingw32/3.4.4/../../.. -
L/mingw/lib/gcc/mingw32/../.. main.o -lmingw32 -lgcc -lmoldname -lmingwex -
lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 -lmingw32 -lgcc -lmoldname -
lmingwex -lmsvcrt 
D:/Elastos/extern/gnuSDK.x86/bin/../lib/gcc/mingw32/3.4.4/crtend.o
========== compile information (end) ============

-- 
           Summary: Error to pass struct parameter when compile with mingw's
                    gcc.exe using "-march=i386 -mrtd" flags
           Product: gcc
           Version: 3.4.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: lyuzhou at 21cn dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: Microsoft Windows 2000
  GCC host triplet: --host=mingw32
GCC target triplet: --target=mingw32


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22017

Reply via email to