Trolltech Home | Qt-embedded-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-embedded-interest Archive, October 2007
double and float in qtembedded linked apps on ARM


Message 1 in thread

Hi the list,

I use Qtembedded 3.3.4 compiled for arm to develop applications on a cirrus logic
EP9315 arm9 based system.
The tools chains I use are the ones from ELDK 31 and ELDK 41 from <www.denx.de>.
libqte is used as shared library.
libqte is configured with -DQT_QLOCALE_USES_FCVT switch.

when I compile and link my application with the linker flag "-lqte" I get a
perfectly working apps, BUT for the use of double and float types.
The same code (not calling any qt symbol) compiled and linked without "-lqte" works
fine, but if I add  "-lqte" to the LIBS var in Makefile, I get strange behaviour when using
floating point types, especially if allocated with new operator.

EXAMPLE:
the code
________________________________
#include <stdio.h>

int main()
{
    printf( "build: %s [%s]\r\n", __DATE__,__TIME__);

    double d1 = 1.0 ;
    double * pd = new double(2.);

    printf( "%s:%d: (*pd)=%lf, d1=%lf, (*pd)+d1=%lf.\r\n",__FILE__,__LINE__, (*pd),
    d1, (*pd)+d1 );
    printf( "%s:%d: (*pd)=%lf, d1=%lf, (*pd)+d1=%lf.\r\n",__FILE__,__LINE__, (*pd),
    d1, (*pd)+d1 );

    delete pd;

    return 0;
}
________________________________

linked with -lqte gives the following output:

________________________________
build: Oct  8 2007 [19:05:03]
..../src/main.cpp:10: (*pd)=2.000000, d1=1.000000, (*pd)+d1=3.000000.
..../src/main.cpp:11: (*pd)=2.000000, d1=1.000000, (*pd)+d1=inf.
________________________________


Does someone knows something about this?

Thank you.


-- 
 [ signature omitted ] 

Message 2 in thread

Hi Giovanni,

please try to compile it without compiler optimizations, this means replace "-O2" by "-O0" in the compiler switches.

This can be first manually done (call compiler commands directly) and if it helps, take a look at the "volatile" type qualifier.
Perhaps this helps.

Best regards,
Paul


-----Ursprüngliche Nachricht-----
Von: giovanniangeli@xxxxxxxxxxxxxxxxxxx [mailto:giovanniangeli@xxxxxxxxxxxxxxxxxxx] 
Gesendet: Dienstag, 9. Oktober 2007 15:55
An: qt-embedded-interest@xxxxxxxxxxxxx
Betreff: double and float in qtembedded linked apps on ARM


Hi the list,

I use Qtembedded 3.3.4 compiled for arm to develop applications on a cirrus logic
EP9315 arm9 based system.
The tools chains I use are the ones from ELDK 31 and ELDK 41 from <www.denx.de>.
libqte is used as shared library.
libqte is configured with -DQT_QLOCALE_USES_FCVT switch.

when I compile and link my application with the linker flag "-lqte" I get a
perfectly working apps, BUT for the use of double and float types.
The same code (not calling any qt symbol) compiled and linked without "-lqte" works
fine, but if I add  "-lqte" to the LIBS var in Makefile, I get strange behaviour when using
floating point types, especially if allocated with new operator.

EXAMPLE:
the code
________________________________
#include <stdio.h>

int main()
{
    printf( "build: %s [%s]\r\n", __DATE__,__TIME__);

    double d1 = 1.0 ;
    double * pd = new double(2.);

    printf( "%s:%d: (*pd)=%lf, d1=%lf, (*pd)+d1=%lf.\r\n",__FILE__,__LINE__, (*pd),
    d1, (*pd)+d1 );
    printf( "%s:%d: (*pd)=%lf, d1=%lf, (*pd)+d1=%lf.\r\n",__FILE__,__LINE__, (*pd),
    d1, (*pd)+d1 );

    delete pd;

    return 0;
}
________________________________

linked with -lqte gives the following output:

________________________________
build: Oct  8 2007 [19:05:03]
..../src/main.cpp:10: (*pd)=2.000000, d1=1.000000, (*pd)+d1=3.000000.
..../src/main.cpp:11: (*pd)=2.000000, d1=1.000000, (*pd)+d1=inf.
________________________________


Does someone knows something about this?

Thank you.


-- 
 [ signature omitted ] 

Message 3 in thread

Hi Paul, thanks for your answer.

I tried to compile with 0 optimization (-O0) and to declare my floating point vars as volatile, but
this don't solve the problem.
I remark that it is stricly connected with the linking to the libqte: the same code not linked with
-lqte works fine. I think that some symbol defined in libqte (maybe in the qlocale) overwrite some
symbol in the system libs, but I don't know how to search in this direction.

Best regards, Giovanni.

Bussmann, Paul said:
> Hi Giovanni,
>
> please try to compile it without compiler optimizations, this means replace "-O2" by "-O0" in
> the compiler switches.
>
> This can be first manually done (call compiler commands directly) and if it helps, take a look
> at the "volatile" type qualifier. Perhaps this helps.
>
> Best regards,
> Paul
>
>
> -----Ursprüngliche Nachricht-----
> Von: giovanniangeli@xxxxxxxxxxxxxxxxxxx [mailto:giovanniangeli@xxxxxxxxxxxxxxxxxxx]  Gesendet:
> Dienstag, 9. Oktober 2007 15:55
> An: qt-embedded-interest@xxxxxxxxxxxxx
> Betreff: double and float in qtembedded linked apps on ARM
>
>
> Hi the list,
>
> I use Qtembedded 3.3.4 compiled for arm to develop applications on a cirrus logic EP9315 arm9
> based system.
> The tools chains I use are the ones from ELDK 31 and ELDK 41 from <www.denx.de>. libqte is used
> as shared library.
> libqte is configured with -DQT_QLOCALE_USES_FCVT switch.
>
> when I compile and link my application with the linker flag "-lqte" I get a perfectly working
> apps, BUT for the use of double and float types. The same code (not calling any qt symbol)
> compiled and linked without "-lqte" works fine, but if I add  "-lqte" to the LIBS var in
> Makefile, I get strange behaviour when using floating point types, especially if allocated with
> new operator.
>
> EXAMPLE:
> the code
> ________________________________
> #include <stdio.h>
>
> int main()
> {
>    printf( "build: %s [%s]\r\n", __DATE__,__TIME__);
>
>    double d1 = 1.0 ;
>    double * pd = new double(2.);
>
>    printf( "%s:%d: (*pd)=%lf, d1=%lf, (*pd)+d1=%lf.\r\n",__FILE__,__LINE__, (*pd), d1, (*pd)+d1
>    );
>    printf( "%s:%d: (*pd)=%lf, d1=%lf, (*pd)+d1=%lf.\r\n",__FILE__,__LINE__, (*pd), d1, (*pd)+d1
>    );
>
>    delete pd;
>
>    return 0;
> }
> ________________________________
>
> linked with -lqte gives the following output:
>
> ________________________________
> build: Oct  8 2007 [19:05:03]
> ..../src/main.cpp:10: (*pd)=2.000000, d1=1.000000, (*pd)+d1=3.000000. ..../src/main.cpp:11:
> (*pd)=2.000000, d1=1.000000, (*pd)+d1=inf.
> ________________________________
>
>
> Does someone knows something about this?
>
> Thank you.
>
>
> --
> Giovanni Angeli
>
>
> To unsubscribe - send "unsubscribe" in the subject to
> qt-embedded-interest-request@xxxxxxxxxxxxx


-- 
 [ signature omitted ]