Forums

g++pentium 2.9 compiler problem

Started by samrat April 9, 2007
Hi All,
              I am facing one of the typical scenario in the Tornado
2.2.1/vxWorks 5.5.1 g++pentium 2.9 compiler.
This Compiler is not initialising properly any of the member array of
function pointers either 1-dimensional or 2-dimensional.
              For this problem i got a solution from windriver
because
it is one of the SPR'S it's number : 110843 so
i installed the Service Patch: Tornado 2.2.1 Service Pack 1 (Tornado
2.2.1 Cumulative Update Patch).
              This will update my Tornado version to 2.2.2(earlier
2.2.1) & vxWorks to 5.5.2(earlier 5.5.1). I thought
problem will get resolved after this. But the thing is i am still
facing the same problem.

Source Code:


#include <iostream.h>


using namespace std;


class test;
typedef void (test::*fp)();
class test
{
    public:
        void f1();
        void f2();
        void f3();
        void f4();
        void f5();
        void f6();
        void f7();
        void f8();
        static fp fptr[4][2];
        void f();



};


fp test::fptr[4][2]= {
    {&test::f1,&test::f2},
    {&test::f3,&test::f4},
    {&test::f5,&test::f6},
    {&test::f7,&test::f8}


};


void test::f()
{
    for(int i=0; i<4;i++)
        for(int j=0; j<2;j++)
            (this->*(fptr[i][j]))();
    return;


}


void test::f1()
{
    cout<<"1"<<endl;
    return;


}


void test::f2()
{
    cout<<"2"<<endl;
    return;


}


void test::f3()
{
   cout<<"3"<<endl;
   return;


}


void test::f4()
{
    cout<<"4"<<endl;
    return;


}


void test::f5()
{
    cout<<"5"<<endl;
    return;


}


void test::f6()
{
    cout<<"6"<<endl;
    return;


}


void test::f7()
{
    cout<<"7"<<endl;
    return;


}


void test::f8()
{
    cout<<"8"<<endl;
    return;


}


int main()
{
    test a;
    a.f();


}


Output:

Page Fault
Page Dir Base   : 0x0ff78000
Esp0 0x0feebf48 : 0xeeeeeeee, 0xeeeeeeee, 0xeeeeeeee, 0x00000000
Esp0 0x0feebf58 : 0x00000000, 0x00000000, 0xeeeeeeee, 0xeeeeeeee
Program Counter : 0x013f513d
Code Selector   : 0x00000008
Eflags Register : 0x00010246
Error Code      : 0x00000000
Page Fault Addr : 0xfffffff8
Task: 0xfeebfdc "s2u1"


Procedure How i will do the Compilation:


1)  Here i am doing Cross-Compilation, I m having Solaris 5.8 as well
Windows XP as two different Host.
    In both the host Tornado 2.2.1 for pentium target got installed &
later on after installing the patch both of
    them got upgraded to Tornado 2.2.2
2)  In Solaris  I will do the Compilation in Command line based(i
wont
use Tornado IDE here in Solaris) and
     I  will get an executable file.
3)   I  will copy the executable to the windows host & later I will
download it to the pentium target & then
     using the Tornado IDE in windows XP i will execute.


Command which used to get executable in Solaris Host:


1) g++pentium -c sample.cpp
2) ldpentium -r sample.o
3)  "a.out" i will get.


Important Information to Note:


    The sample program which i given here if i compile in Tornado IDE
of either Windows or Solaris that means
    creating project then adding this sample.cpp file  " i am not
getting any page faults error".
     Everything is working properly.


                         Now my doubt is why not it's working in
Command line based in Solaris & how can i
  make it to work.
                          What procedure should i have to follow.


           Expecting lots of responses from lots of group members.


Regards,
Sakthivel


samrat wrote:

> Hi All, > I am facing one of the typical scenario in the Tornado > 2.2.1/vxWorks 5.5.1 g++pentium 2.9 compiler. > This Compiler is not initialising properly any of the member array of > function pointers either 1-dimensional or 2-dimensional.
Of course it does not. You defined an array of pointers to the poiters to the functions. What do you expect? Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
  No helpful s/w has service patches

 nor service packs . Its bait , they have

 you on the hook , you'll spend the

 next 2 years trying to make it work ,

 and they laugh at you !

  The easiest way is to start at the bottom

 and write it yourself , this way you wont

 bloat it , since its for YOU , and not

 a paycheck ..

On Apr 9, 9:43 am, Vladimir Vassilevsky <antispam_bo...@hotmail.com>
wrote:
> samrat wrote: > > Hi All, > > I am facing one of the typical scenario in the Tornado > > 2.2.1/vxWorks 5.5.1 g++pentium 2.9 compiler. > > This Compiler is not initialising properly any of the member array of > > function pointers either 1-dimensional or 2-dimensional. > > Of course it does not. You defined an array of pointers to the poiters > to the functions. What do you expect? > > Vladimir Vassilevsky > > DSP and Mixed Signal Design Consultant > > http://www.abvolt.com
Hi Vladimir, It's very nice to see u'r reply. Also Vladimir i got struct with this problem for a very long time. Also i need u'r help to solve this problem. i m expecting a suggestion from u'r side, like is there any other alternate method to solve this. regards, sakthivel

samrat wrote:


>>> I am facing one of the typical scenario in the Tornado >>>2.2.1/vxWorks 5.5.1 g++pentium 2.9 compiler. >>>This Compiler is not initialising properly any of the member array of >>>function pointers either 1-dimensional or 2-dimensional. >> >>Of course it does not. You defined an array of pointers to the poiters >>to the functions. What do you expect? >> > > Hi Vladimir, > >It's very nice to see u'r reply. Also > Vladimir i got struct with this problem for a very long time. Also > i need u'r help to solve this problem. i m expecting a suggestion from > u'r side, like is there any other alternate method to solve this. >
My dear friend, Congratulations, you have found the right person. Solving the problems is what I do for living. Your problem is very tough and challenging. It would be my pleasure to help you for the small monetary reward. The email address is at the web site. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
samrat wrote:
>
... snip ...
> > It's very nice to see u'r reply. Also Vladimir i got struct with > this problem for a very long time. Also i need u'r help to solve > this problem. i m expecting a suggestion from u'r side, like is > there any other alternate method to solve this.
Please don't use silly abbreviations such as u'r. -- <http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt> <http://www.securityfocus.com/columnists/423> <http://www.aaxnet.com/editor/edit043.html> "A man who is right every time is not likely to do very much." -- Francis Crick, co-discover of DNA "There is nothing more amazing than stupidity in action." -- Thomas Matthews -- Posted via a free Usenet account from http://www.teranews.com
Vladimir Vassilevsky wrote:
> samrat wrote: >> I am facing one of the typical scenario in the Tornado >> 2.2.1/vxWorks 5.5.1 g++pentium 2.9 compiler. >> This Compiler is not initialising properly any of the member array of >> function pointers either 1-dimensional or 2-dimensional. > > Of course it does not. You defined an array of pointers to the poiters > to the functions. What do you expect?
Nope. That looks like a pretty normal two-dimensional array of member function pointers to me. DJGPP g++ 2.8.1 agrees (the closest to "g++ 2.9" I have here), and generates correct code. Same goes for MinGW g++ 3.4.4 and Borland C++ 5.5.1.
> samrat: >> 1) g++pentium -c sample.cpp >> 2) ldpentium -r sample.o >> 3) "a.out" i will get.
I don't know what your "ldpentium" does. I miss some linking with standard libraries here, and I wonder what that '-r' option does. For the linkers I know, '-r' is used for intermediate linking steps only, not for the final one. But then, I don't know your operating system (and for a Linux kernel module, -r would be right). Stefan
On Mon, 09 Apr 2007 20:22:43 +0200, Stefan Reuther
<stefan.news@arcor.de> wrote:
>Vladimir Vassilevsky wrote: >> samrat wrote: >>> I am facing one of the typical scenario in the Tornado >>> 2.2.1/vxWorks 5.5.1 g++pentium 2.9 compiler. >>> This Compiler is not initialising properly any of the member array of >>> function pointers either 1-dimensional or 2-dimensional. >> >> Of course it does not. You defined an array of pointers to the poiters >> to the functions. What do you expect? > >Nope. That looks like a pretty normal two-dimensional array of member >function pointers to me. DJGPP g++ 2.8.1 agrees (the closest to "g++ 2.9" >I have here), and generates correct code. Same goes for MinGW g++ 3.4.4 >and Borland C++ 5.5.1.
It works with VC (VS 2003) and GCC 3.2.2 as well. Also, based on deciphering the original post, the code works if the IDE is used to create a project and build the image. It only fails when the image is created using the command line tools. This clearly indicates, to me at least, that the OP is missing some tool configuration. To the OP: Please check your tool chain documentation. I am reasonably sure that the answer is in the documentation. One thing that might be missing in the command line is the memory range. Another possibility is that some required libraries are not linked. Also, this is a good question to ask the support team at Wind River. Have a nice day, Pradeep -- All opinions are mine and do not represent the views or policies of my employer. R Pradeep Chandran rpc AT pobox DOT com
On Apr 10, 4:27 am, R Pradeep Chandran <s...@sig.below> wrote:
> On Mon, 09 Apr 2007 20:22:43 +0200, Stefan Reuther > > <stefan.n...@arcor.de> wrote: > >Vladimir Vassilevsky wrote: > >> samrat wrote: > >>> I am facing one of the typical scenario in the Tornado > >>> 2.2.1/vxWorks 5.5.1 g++pentium 2.9 compiler. > >>> This Compiler is not initialising properly any of the member array of > >>> function pointers either 1-dimensional or 2-dimensional. > > >> Of course it does not. You defined an array of pointers to the poiters > >> to the functions. What do you expect? > > >Nope. That looks like a pretty normal two-dimensional array of member > >function pointers to me. DJGPP g++ 2.8.1 agrees (the closest to "g++ 2.9" > >I have here), and generates correct code. Same goes for MinGW g++ 3.4.4 > >and Borland C++ 5.5.1. > > It works with VC (VS 2003) and GCC 3.2.2 as well. Also, based on > deciphering the original post, the code works if the IDE is used to > create a project and build the image. It only fails when the image is > created using the command line tools. This clearly indicates, to me at > least, that the OP is missing some tool configuration. > > To the OP: Please check your tool chain documentation. I am reasonably > sure that the answer is in the documentation. One thing that might be > missing in the command line is the memory range. Another possibility > is that some required libraries are not linked. > > Also, this is a good question to ask the support team at Wind River. > > Have a nice day, > Pradeep > -- > All opinions are mine and do not represent the views or > policies of my employer. > R Pradeep Chandran rpc AT pobox DOT com
Hi Pradeep, When i followed the same procedure to create the "a.out" executable in case of PowerPC target my sample code is working fine without any issues. Steps i used in PPC Board: 1) g++ppc -c sample.cpp 2) ldppc -r sample.o 3) "a.out" i will get. Problem is happening only in case of this version of "g++pentium 2.9 Compiler". I sent a report regarding this problem to windriver, but i didn't find any response from their side. The "g++ppc compiler version is 2.96" the vxworks version is still the same as vxWorks 5.5.1 which i use for the pentium target. i do know how to resolve this issue. Regards, Samrat