This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Incorrect ARM Thumb code generation with gcc-3.0.2

[Get raw message]
Hi GCC gurus,

While compiling in ARM Thumb code with gcc-3.0.2, we have hit a problem with
thumb instruction generation: You will find attached the test program for which
illegal thumb code is generated with "gcc -mthumb -c -O2 -c foo.c"

Notice that it does not occur if -O2 is not specified.

Best regards,
-Eric
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ Eric PAIRE
Web  : http://www.ri.silicomp.com/~paire  | Groupe SILICOMP - Research Institute
Email: eric.paire@ri.silicomp.com         | 2, avenue de Vignate
Phone: +33 (0) 476 63 48 71               | F-38610 Gieres
Fax  : +33 (0) 476 51 05 32               | FRANCE
------  foo.c  ------  foo.c  ------  foo.c  ------  foo.c  ------  foo.c  
------
char *dbg_addint(char *s, int n, int base)
{
    char buf[16];
    char sign = '+';
    unsigned int bpos;
    char *digits = "0123456789ABCDEF";

    if( n < 0 ) n = -n, sign = '-';

    /* Set pos to start */
    bpos = 0;

    /* construct digits into buffer in reverse order */
    if( n == 0 ) buf[bpos++] = '0';
    else while( n != 0 )
    {
        unsigned int d = n % base;
        buf[bpos++] = digits[d];
        n /= base;
    }

    /* set sign if negative. */
    if( sign == '-' )
    {
        buf[bpos] = sign;
    }
    else bpos--;

    /* Now write it out in correct order. */
    while( bpos >= 0 )
        *s++ = buf[bpos--];

    *s = 0;

    return s;
}



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]